Re: DropDownList
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 16, 2001
- 424 views
Hi George, > Your program snipit looks like it would work fine if the dropdownlist field > width could be larger than the coded field width. Can't see how to do this.. > The code in the field would be like 'n30' or 'n60' , so the editText field > only should be 3-6 chars but the descriptive text for this could be much > larger (usually about 15). The short code would be used in the DB and on > internal reports, the long on invoices, statements, etc. Maybe I'm missing something, but are you trying to display the short field on the screen too? If so, why as it is only used in the DB and not on any user interface (screen or paper). I can't see why you can't display the long dropdown field and not botther showing the short data. If there is only a fixed number of possible valid entries for this field, there is no need for an edittext field, just a single dropdown will do. Is there a good reason to display the short field to the user? If there is, why can't you have both fields being displayed - the edittext being read-only of course. Here is an example of what I am saying... --------------- include win32lib.ew constant win = create(Window, "test", 0, 0, 0, 400, 300 ,0), MsgArea = create(StatusBar, "", win, 0, 0, 0, 0, 0), ef = create(EditText, "" , win, 5, 5, 48, 20, ES_READONLY), dd = create(Combo, "", win, 5, 28, 150, 140, 0) -------------- sequence ddKeys, ddCodes ddKeys = {"2% 10 Net 30", "3% 10 Net 60", "5% 15 Net 90" } ddCodes= { "N3" , "N6" , "N9" } procedure Init_myDropDown() eraseItems(dd) addItem(dd, ddKeys) end procedure procedure myDropDown_Click() sequence pick integer what pick = getItem(dd, 0) if length(pick) != 0 then what = find(pick, ddKeys) if what != 0 then setText(ef, ddCodes[what]) else setText(MsgArea, "Unknown discount selected") end if else setText(MsgArea, "No discount selected") end if end procedure onChange[dd] = routine_id("myDropDown_Click") setWindowBackColor(ef, rgb(192,192,192)) Init_myDropDown() WinMain(win, 0) -------------- Derek