Quote from PaulJonestindall on December 18, 2020, 6:17 pmHow do I make a ComboBox (drop down menu) display a default item in the list without having to click on it?
For example: I want the PUB to read a file, or more specifically read a database field ([MyDB,MyTbl.Field1), on StartUp, get a variable that is in the ComboBox list and have the ComboBox object display that list item.
I want the ComboBox to display an item in its list at startup. Normally it will not do that.
I've tried FindItem, GetItem:
ListBoxFindItem "ComboBox5" "[MatEx.MatList.Site]" "[GetSite]"
ListBoxGetItem "ComboBox5" "[GetSite]" "[GotSite]"I can't get it to show an item programmaticly.
How do I make a ComboBox (drop down menu) display a default item in the list without having to click on it?
For example: I want the PUB to read a file, or more specifically read a database field ([MyDB,MyTbl.Field1), on StartUp, get a variable that is in the ComboBox list and have the ComboBox object display that list item.
I want the ComboBox to display an item in its list at startup. Normally it will not do that.
I've tried FindItem, GetItem:
ListBoxFindItem "ComboBox5" "[MatEx.MatList.Site]" "[GetSite]"
ListBoxGetItem "ComboBox5" "[GetSite]" "[GotSite]"
I can't get it to show an item programmaticly.

Quote from Vadim on December 18, 2020, 6:22 pm@pauljonestindall
Just paste the variable into the "List of Items" field. Lines in this variable will be displayed as list items.
Just paste the variable into the "List of Items" field. Lines in this variable will be displayed as list items.
Quote from PaulJonestindall on December 21, 2020, 8:15 amI already have items in the list. I want to programmatically select one of those items and it be shown in the combo box.
Think of it this way: I have a DB, someone selects a record with a field variable containing one of the items in the list. I now want that list item to show in the combo box just as if someone clicked on the list itself.
I already have items in the list. I want to programmatically select one of those items and it be shown in the combo box.
Think of it this way: I have a DB, someone selects a record with a field variable containing one of the items in the list. I now want that list item to show in the combo box just as if someone clicked on the list itself.

Quote from Vadim on December 21, 2020, 9:57 am@pauljonestindall
To select an item programmatically, you must assign the value of that item to the variable listbox. Suppose you have three items in your list:
first item
second item
third itemAnd you need to programmatically select the second item.
Then the code would look like this:
SetVar "[ListBox1]" "second item"
To select an item programmatically, you must assign the value of that item to the variable listbox. Suppose you have three items in your list:
first item
second item
third item
And you need to programmatically select the second item.
Then the code would look like this:
SetVar "[ListBox1]" "second item"
Quote from PaulJonestindall on December 23, 2020, 9:04 am@vadim
Thanks for the reply. I think I've got it figured out now. It just seems very quirky. When the program starts, what I wanted was the listbox item to be filled with matching info in the first record of a database.
Here's what I had to do to actually make it look and work properly:
If "[MatEx.MatList.Site]" "<>" ""
ListBoxFindItem "ComboBox5" "[MatEx.MatList.Site]" "[GetSite]"
ListBoxGetItem "ComboBox5" "[GetSite]" "[GotSite]"Otherwise, at startup, the field would be blank until I clicked on at least one other record in the DB.
Thanks for the reply. I think I've got it figured out now. It just seems very quirky. When the program starts, what I wanted was the listbox item to be filled with matching info in the first record of a database.
Here's what I had to do to actually make it look and work properly:
If "[MatEx.MatList.Site]" "<>" ""
ListBoxFindItem "ComboBox5" "[MatEx.MatList.Site]" "[GetSite]"
ListBoxGetItem "ComboBox5" "[GetSite]" "[GotSite]"
Otherwise, at startup, the field would be blank until I clicked on at least one other record in the DB.