From: <Amp...@ok...> - 2014-02-24 16:15:40
|
Hello Mark! > [..] > The select() method will select the first item in the combo box that > exactly matches s. Select and show seems to be something different. It appears that the item I'd like to see _is_ selected but not shown. I send you an running excerpt from my application to you offlist. > In the above, you add the text s to the combo box. Then you make some > alteration to an s variable and try to select it in the combo box. If the > second s does not exactly match the s actually added to the combo box, > nothing will be selected. Don't worry, they do match. At first glance it may look confusing, but in the combo-box I offer some values from 1 to 32 and it just does not look nice when left justified. As such I prefix values < 10 with two blanks. That's all. > A better approach might be to determine the index of the item you want > selected and use the selectIndex() method to select the item by index. You are right. i) find() has an exact switch, alas when .false or omitted the search is for an item beginning with the text specified, and ii) with selectIndex() when a new item is selected, if necessary, the new item in the list is scrolled into view. And as such - if I understand this remark correctly - the item I'd like to see will be shown on the screen, according to the manual. > However, you logic looks suspect to me. LOL! Bad habits and godd practice when programming REXX, several weeks ago there was a discussion on the IBMVM mailing list about this. > There is only 1 value for > .constDir[GLV_DISCL] under normal conditions. Unless you set the > .constDir[GLV_DISCL] to an array, or some other collection, there is no > need to use a do over. Only 1 item will be added to the combo box. The Do Over is for .constDir[GLV_SCLAR] which contains an array, .constDir[GLV_DISCL] is the current value, which I desperately try to show in the combobox to give the user a hint what to select. > If you did set .constDir[GLV_DISCL] to an array, then I'd advise against > it. The .constDir is used internally to resolve a symbolic ID, in this > case GLV_DISCL, to a single numeric value. Although there is no law that > says you can't use it for your own, other, purpose, I'd worry that you will > run into some unintended consequence. You confirm that there is no law not to save an array in a .constDir item. Well, IIRC I read somewhere in the ooDialog manuals, that it could be used for more than symbolic IDs only. Alas I could not find it again. Anyway, I decided to use it similar to GLOBALV I know from VM (IBM host). > Say your scaling values are: 1, 2, 4, 8, 16, I'd do this: > > values = .array~of(1, 2, 4, 8, 16) > do s over values > scombo~add(s) -- set allowed scaling factors > end > > scombo~select(4) > > or whatever you wanted for the initial selected item. Thank you for this example :) I use .constDir because I need the array at different spots in my application. >> ii) set the focus on the ComboBox? >> (Currently the focus is on the OK button) >> > > The operating system's dialog manager sets the focus to the first dialog > control in the dialog template. So, in defineDialog() add the combo box > control to the template first: Mark! Thank you very much! Solved! Now right at the start of the dialog I may scroll with the mouse wheel through the list. :) Best, M. -------------------------------------------- Kostenlose E-Mail-Adresse mit unbegrenztem Speicherplatz für E-Mails, Free SMS und OK-Drive, der Online-Festplatte. Sicher Dir jetzt Deine Wunschadresse @ OK.de: www.ok.de |