User Tools

Site Tools


k20:k20.11:k20.11.1:start

20.11.1 Project Application

The project presented demonstrates the use of the Application (gb) class and uses almost all of its properties - except for Application.Daemon and the two special event handlers - in different contexts.

GUI

Figure 20.11.1.1: GUI for the demonstration programme 'DApplication'.

There are no surprises in the source code:

[1] ' Gambas class file
[2]
[3] Public Sub Form_Open()
[4]   FMain.Center()
[5]   FMain.Resizable = False
[6]   FMain.Title = "Use of the Application class (gb)"
[7]   Application.Priority = 10
[8] End
[9]
[10] Public Sub btnShowInformationsApplication_Click()
[11]   Dim vValue As Variant
[12]   Dim cInformations As New Collection
[13]
[14]   cInformations["PID = "] = Application.Id
[15]   cInformations["Start class = "] = Application.Startup.Name
[16]   cInformations["Titel = "] = Application.Title
[17]   cInformations["Project path = "] = Application.Path
[18]   cInformations["Directory = "] = Application.Dir
[19]   cInformations["Version = "] = Application.Version
[20]   cInformations["Priorityt [-20 (max) ... +19 (min)]  = "] = Application.Priority
[21]   cInformations["Number of arguments = "] = Application.Args.Count
[22]
[23]   txaOutput.Clear
[24]   txaOutput.Insert(gb.NewLine)
[25] '-- Output information
[26]   For Each vValue In cInformations
[27]       txaOutput.Insert(cInformations.Key & cInformations[cInformations.Key] & gb.NewLine)
[28]   Next
[29]
[30] End
[31]
[32] Public Sub btnShowInformationsEnviroment_Click()
[33]   Dim vEnvName As Variant
[34]   Dim i As Integer = 1
[35]
[36]   txaOutput.Clear
[37]   txaOutput.Insert(gb.NewLine)
[38] '-- Output of the environment variables
[39]   txaOutput.Insert("There are " & Application.Env.Count & " Environment variables.")
[40]   txaOutput.Insert(gb.NewLine & gb.NewLine)
[41]   For Each vEnvName In Application.Env
[42]     txaOutput.Insert(Str(i) & ": " & vEnvName & " = " & Application.Env[vEnvName] & gb.NewLine)
[43]     Inc i
[44]   Next
[45]
[46] End
[47]
[48] Public Sub btnEnvRead_Click()
[49]   Dim sCurrentDesktop As String
[50]
[51]   txaOutput.Clear()
[52]   txaOutput.Insert(gb.NewLine)
[53]   sCurrentDesktop = Application.Env["XDG_CURRENT_DESKTOP"]
[54]   txaOutput.Insert("sCurrentDesktop = Application.Env[\"XDG_CURRENT_DESKTOP\"]")
[55]   txaOutput.Insert(gb.NewLine & gb.NewLine)
[56]   txaOutput.Insert("Current Desktop: " & sCurrentDesktop)
[57]
[58] End
[59]
[60] Public Sub btnEnvWrite_Click()
[61]
[62]   Application.Env["GB_JIT"] = "y"
[63]
[64]   txaOutput.Clear
[65]   txaOutput.Insert(gb.NewLine)
[66]   txaOutput.Insert("Die Umgebungsvariable \"GB_JIT\" wurde mit ")
[67]   txaOutput.Insert("Application.Env[\"GB_JIT\"] = \"y\"" & " auf den Wert '")
[68]   txaOutput.Insert(Application.Env["GB_JIT"] & "' gesetzt!")
[69]
[70] End

If you have set the environment variable GB_JIT (button at the bottom right) and then display the overview of environment variables again, you will find as the last entry in the list, for example: 40: GB_JIT = y.

Download

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.
k20/k20.11/k20.11.1/start.txt · Last modified: by 127.0.0.1