Re: Win32Lib; Control; Dropdown; Index and data?
- Posted by ZNorQ <znorq at holhaug.com> Mar 20, 2007
- 474 views
don cole 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. > > > > Example; Databasetable "TBL_PERSON" content; > > ------------------------------------------- > > KEY SURNAME FIRST NAME > > ------------------------------------------- > > 0001 Olsen Elvis > > 0002 Jensen Thor > > 0003 Jordan Jens > > ------------------------------------------- > > > > I want this data to be presented in a dropdown control, with the > > index hidden, and the full name shown with "SURENAME, FIRST NAME". > > When the user makes a selection, it is the KEY that is returned, not > > the name itself. > > > > Is this possible? This principle was taken from the dropdown control in > > MS Access, and I was kinda hoping it would have the same function in > > Win32Lib. > > > > Regards > > Kenneth / ZNorQ > > Hello ZNorQ, > > If you mean a menu drop down that should be pretty simple. > > Untested. > }}} <eucode> > constant Menu_Item_0001=createEx(MenuItem,"0001 Olson > Elvis",Menu_Main,0,0,0,0,0) > > function doIt(integer s,intrgedr e,sequence p) > return "0001" > end function > SetHandler(Menu_Item_0001,routine_id("doIt") > > Don Cole Hey Don, Hehe, no not exactly. I was thinking of a combo drop-down. The point is that when someone selects a name in the combo, the key index is returned, and not the name itself. While the index (key) is unique, the name can be ambigious which would cause a problem when I want to make a look-up in the database table based on the selected value in the combo. The index doesn't tell the user much, so I need the readable information (ie. the name) to be visible, and the index to be invisible. When a user selects "Jensen, Thor" - the index 0002 will be returned, and the code can look up every record that have the key index = "0002" (which should in this case be just one). Kenneth / ZNorQ