On Fri, Feb 21, 2014 at 8:10 AM, <amphitr...@ok.de> wrote:
>
> What do I have to change in following dialog to get
> i) the selected item displayed in a ComboBox
>
scombo = self~newComboBox(IDC_SESCA)
do s over .constDir[GLV_SCLAR]
scombo~add(s) -- set allowed scaling factors
end
s = ' ' || .constDir[GLV_DISCL] -- current scale factor
if s > 9 then s = s + 0 -- remove leading blanks
scombo~select(s)
The select() method will select the first item in the combo box that
exactly matches s.
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.
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.
However, you logic looks suspect to me. 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.
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.
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.
> 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:
::method defineDialog unguarded
self~createComboBoxInput(IDC_SESCA, 5, 20, , 28, , '1/', 'LIST
PARTIAL VSCROLL', , )
self~createOkCancelRightTop
--
Mark Miesfeld
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users