| Newsgroups |
gmane.comp.windows.power-pro |
| Message-ID |
<[email protected]> |
I had a quick look at the code and I understand the issue. It's actually a problem with the script.
The AddCtrlListItem requires that the combobox already exist and this does not happen until the bar is shown. So you need to show the bar before sending this change to the combo box. (Reason: internally, the addctrllistitem is implemented by SendMessage to the combobox window).
Here is a working script. I was impressed by your first script, but I did make a few changes to show other syntax possibilities in case you are not familiar with them . Of course, it may be that you are and just don't like that syntax!
static TB = cl.create("TestBar", 1)
local Width = 100
local Quote = ?+"+ //To declare and set variable in one statement instead of needing local then setstring
TB.Insert(0)
TB.SetLabel(0, ?%*control combobox dropdown "first|second|third"%) //Use ?%...% for string with "s
TB.SetWidth(0, Width)
TB.SetId(0, "Combo")
local hOK = TB.Insert(0) // handle directly to button (warning: depends on button number so!!)
hOK.SetLabel( "OK")
hOK.SetWidth(Width)
hOK.AddLeft(cb("@GetInfo"))
TB.SetProperties("Format=barsize position: leftcaption vertical")
TB.Show // instead of *bar show or bar.show
TB.Hide
cl.AddCtrlListItem("TestBar", "combo", "forth", -1) //doesn't work
TB.AddCtrlListItem("combo", "fifth") //doesn't work
cl.AddCtrlListItem("TestBar", "combo", Quote ++ "sixth" ++ Quote, -1) //doesn't work
TB.AddCtrlListItem("combo", Quote ++ "seventh" ++ Quote, -1) //doesn't work
cl.AddCtrlListItem("TestBar", "combo", Quote ++ "eighth" ++ Quote) //doesn't work
//TB.ClearCtrlList(0) //not tested
TB.Show
quit
Function GetInfo
win.debug(TB.GetId("Combo"), ": ", TB.GetCtrlValue("Combo"))
TB.close
quit