User Tools

Site Tools


k19:k19.1:start

19.1 Settings

For certain programmes it is desirable or even necessary to start the programme with tried and tested programme settings each time it is called. The settings mainly refer to

  • to the assignment of variables with default values at the start of the programme or
  • to values of component properties as well as
  • to the size and position of the programme window.

Gambas offers the possibility to store the configuration of a programme in so-called initialisation or configuration files *.conf and to read in and evaluate the contents of this text file at programme start, as an excerpt from a source code shows:

...
PUBLIC SUB SetConfigurationValues()
  cmbRS232PortName.Text = v24Settings["V24Konfiguration/Port-Name", "/dev/ttyS0"]
  cmbSpeed.Text = v24Settings["V24Konfiguration/Geschwindigkeit", "4800"]
  cmbParity.Text = v24Settings["V24Konfiguration/Parität", "NONE"]
  cmbDataBits.Text = v24Settings["V24Konfiguration/AnzahlDatenbits", "8"]
  cmbStopBits.Text = v24Settings["V24Konfiguration/AnzahlStopbits", "1"]
  cmbFlow.Text = v24Settings["V24Konfiguration/Datenflusskontrolle", "NONE"]
END
 
...
 
PUBLIC SUB Form_Close()
  IF RS232.Status = Net.Active THEN CLOSE RS232
  GetConfigurationValues()
  v24Settings["Expander/ExpanderHiddenStatus"] = expRX_TX.Hidden
' V24Settings.Save wird bei Form_Close automatisch ausgelöst
END

Download

Projects

Download

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k19/k19.1/start.txt · Last modified: 13.10.2023 by emma

Page Tools