Toetsencombinaties met control: Ctrl-s

Om te bewaren wordt in programma’s standaard toetsencombinatie Ctrl-s gebruikt, dat kan je ook in je Gambas programma’s.

Voorbeeldsituatie:

  • een scherm FMain met een paar tekstvelden “TextLabel1”, “TextLabel2″…
  • de toetsen worden opgevangen in het aktieve scherm “FMain”.

Dat kan in Gambas2 zo:

PUBLIC SUB _new()

END

PUBLIC SUB Form_Open()
  
END

PUBLIC SUB Form_KeyPress()

  IF Key.Control AND (Key.Code = Key["A"] OR Key.Code = Key["a"])
    TextLabel1.Text = "CTRL-"
    TextLabel2.Text = "Aa"
  ENDIF 

  IF Key.Control AND Key.Code = Key["z"]
    TextLabel1.Text = "CTRL-"
    TextLabel2.Text = "z"
  ENDIF 

END
This entry was posted in Gambas2, Hoe - in Gambas. Bookmark the permalink.