Re: Win32Lib; Control; Dropdown; Index and data?
- Posted by ZNorQ <znorq at holhaug.com> Mar 21, 2007
- 474 views
don cole wrote: > > Derek Parnell wrote: > > > > ZNorQ wrote: > > > > > > I've got database table content that I want to be presented in a dropdown > > > control. I'm not gonna put inn all the field values in the control, but I > > > need the unique index and the readable information. > > > > Does this sort of thing help? > > > > }}} <eucode> > > --------- > > include win32lib.ew > > without warning > > integer vWin > > integer vList > > sequence theDataBase > > theDataBase = > > { > > { 17, "Olsen", "Elvis"}, > > {201, "Jensen", "Thor"}, > > { 39, "Jordan", "Jens"}, > > {411, "Jordan", "Jens"} -- Duplicate name test > > } > > procedure AddKey(integer id, object item) > > sequence lKeys > > > > lKeys = getUserProperty(id, "Key") > > if length(lKeys) != 0 then > > lKeys = lKeys[1] > > end if > > > > lKeys &= item > > > > setUserProperty(id, "Key", lKeys) > > end procedure > > > > procedure Change_List(integer self, integer event, sequence parms) > > sequence lKeys > > > > lKeys = getUserProperty(self, "Key") > > if length(lKeys) = 0 then > > return -- No keys defined. > > end if > > > > setText(vWin, sprintf("Key is %d", lKeys[1][parms[2]])) > > end procedure > > > > procedure load_database() > > for i = 1 to length(theDataBase) do > > addItem(vList, sprintf("%s, %s", > > { theDataBase[i][2], theDataBase[i][3]} > > ) > > ) > > AddKey(vList, theDataBase[i][1]) > > end for > > end procedure > > > > procedure main() > > vWin = create(Window, "Drop Down Indexing", 0, 0, 0, 400, 400, 0) > > vList = create(DropDownList, "", vWin, 10, 10, 300, 300, 0) > > load_database() > > setHandler(vList, w32HChange, routine_id("Change_List")) > > WinMain(vWin, Normal) > > end procedure > > main() > > </eucode> {{{ > > > > -- > > Derek Parnell > > Melbourne, Australia > > Skype name: derek.j.parnell > > Hello Derek, > > Well to tell the truth I didn't even know that there was a control named > DropDownList. It just goes to show you that there is something to be learned > everyday reading this list. > > You must admit though that > }}} <eucode> > setHandler(vList, w32HChange, routine_id("Change_List")) > </eucode> {{{ > is very similar to > }}} <eucode> > setHandler(ListView3,w32HChange,routine_id("select1")) > > Don Cole Hey Don & Derek, I've been, and still are quite busy, but I test the code as soon as possible. I must say I'm impressed by the length you both are willing to go to help out a poor sap like me. How the hell do you find the time?? Anyway, I really appreciate it. I'll get back to you with some results as soon as I can. Again, thanks guys. Kenneth / ZNorQ PS, Derek, I was sure you where gonna leave the Eu community, but I must say it's cool that you're still replying to win32lib issues that appears on the forum..