' Sorted listbox written in Rapid-Q (GTK version)
' You must: mv rapidqgtk.lib rapidq32.lib
' Make sure to backup rapidq32.lib of course!

DECLARE SUB ButtonClick (Sender AS QButton)

CONST False = 0
CONST True = 1

CREATE Form AS QForm
  Caption = "Sorted Listbox"
  Center
  CREATE ListBox AS QListBox
    Left = 10: Top = 10: Width = 300: Height = 180
    AddItems "Z","G","P","B"
    Sorted = True
  END CREATE
  CREATE Edit AS QEdit
    Left = 10: Top = 205
    Height = 25: Width = 220
  END CREATE
  CREATE Button AS QButton
    Left = 250: Top = 205
    Height = 25: Width = 60
    Caption = "Add"
    OnClick = ButtonClick
  END CREATE
  ShowModal
END CREATE


SUB ButtonClick (Sender AS QButton)
   ListBox.AddItems(Edit.Text)
END SUB
