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

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.
k19/k19.1/start.txt · Last modified: by 127.0.0.1