Page 1 of 1

ComboBox Very simple answer I'm sure

Posted: Wed Sep 06, 2017 11:18 am
by Andrew Lindsay
firstly, I'm using a Mac and the form designer.

I can add a combobox, and add items to the combobox, but when I test the form, no default item is displayed. When I click on the dropdown, the two options are in the drop down list, and then when I select something it stays there, but I can't start the form with a default item displayed.

Also, where to I modify the code so changes are not wiped when the form designer runs each time?

Any assistance for a PureBasic N00b would be appreciated.

Best regards

Re: ComboBox Very simple answer I'm sure

Posted: Wed Sep 06, 2017 11:29 am
by Marc56us
Form designer only preview form.
To run it and set default option, you need to make a program that call it

1. Save your form
2. Open new file that call form file

Code: Select all

  ; Call your form file
  XIncludeFile "your_form.pbf"
  
  ; Call function to open main window 
  OpenWindow_0()
  
  ; Define line you want to display by default for your combobox (0 = first)
  SetGadgetState(#Combo_0, 0)
  
  ; Do a loop
  While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend
That's all
:wink: