ComboBox Very simple answer I'm sure

Just starting out? Need help? Post your questions and find answers here.
Andrew Lindsay
User
User
Posts: 24
Joined: Mon May 30, 2011 12:17 pm

ComboBox Very simple answer I'm sure

Post 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
Andrew Lindsay
-----------------------------------------
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: ComboBox Very simple answer I'm sure

Post 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:
Post Reply