I'm can't seem to control the ZOrder properly. Is there a way to move to a particular control using ZOrder and then continuing seqentially from there? I have several text boxes that are being populated programmatically, but I need a way to continue in the dialog from the point where the program leaves off in order to populate the remaining boxes.
Thank you,
J Leavitt
You can use (dcl_Control_SetFocus control) to set the focus to the text box following the last one that was filled programmatically. The ZOrder will control the sequence from that point.
If I'm not mistaken, I can't use SetFocus within an Initialize event. Has that restriction been removed?
Thank you,
J Leavitt
You are completely right. So it is not as easy as I had hoped. But manipulating the ZOrder does work. However, if you do not also change the ZOrder of the controls before the first text box, the result will be confusing if the user wants to cycle through the form again.
(defun c:TextBoxTest ( / c:TextBoxTest_Form1_OnInitialize stringList)
(defun c:TextBoxTest_Form1_OnInitialize ()
(foreach
control
(list ; Controls before first TextBox.
TextBoxTest_Form1_TextButton0
TextBoxTest_Form1_TextButton1
)
(dcl_Control_ZOrder control 0)
)
(mapcar
'(lambda (index string / control)
(setq control (eval (read (strcat "TextBoxTest_Form1_TextBox" (itoa index)))))
(dcl_Control_SetText control string)
(dcl_Control_ZOrder control 0)
)
'(0 1 2 3 4 5)
stringList
)
)
(setvar 'cmdecho 0)
(command "OPENDCL")
(setvar 'cmdecho 1)
(setq stringList '("A" "B" "C"))
(dcl_Project_Load "TextBoxTest" T)
(dcl_Form_Show TextBoxTest_Form1)
)
Another idea is to disable the ones you want to skip.
@ Owen:
Just wondering: is there a way to retrieve the ZOrder of a form?
Quote from: roy_043 on January 30, 2013, 05:27:12 AM
Just wondering: is there a way to retrieve the ZOrder of a form?
I don't believe so, unless there's some way to do it using standar Windows functionality via COM.
Thank you both!
I managed to adapt the sample code that roy_043 posted and it works fine, although it would be ever so much easier to be able to specify the order programatically.