Hello everybody
When my dialog box opens I'd want to get the cursor actived in a TextBox, just after the default value (instead of focus wich highlight it)..
Do you think it's possible ??
If your question is about plain DCL, you should ask it here:
http://www.theswamp.org/index.php?board=38.0 (http://www.theswamp.org/index.php?board=38.0)
sorry it was for a standart .dcl..
But can you do that with a TextBox, when a Modal Dialog opens ?
Yes, I believe you can do that with an OpenDCL TextBox by using (dcl_TextBox_SetSel) and a zero-length selection range.
Thanks, I tried but I didn't find..
(defun c:TRY_MBox_OnInitialize (/)
;;; (dcl_Control_ZOrder TRY_MBox_TextButton1 1)
(dcl_Control_SetProperty TRY_MBox_TextBox1 "Text" "default")
(dcl_TextBox_SetSel TRY_MBox_TextBox1 7 7)
)
The content of the TextBox is still highlighted, even with other start/end values for dcl_TextBox_SetSel (like -1), in fact the cursor stays in the end of the TextBox even without dcl_TextBox_SetSel.
And if another control is MovedToTop the TextBox loose the cursor..
You'll need to do that later in the startup sequence. After OnInitialize returns and the dialog is displayed, input focus is moved to the first control in the tab order, causing any of your attempts in OnInitialize to be ignored. You might try it from the OnSetFocus event of the text box, or simply change your tab order so the text box is not at the top.
Ok, it works when dcl_TextBox_SetSel is called by the OnSetFocus event of another control (the first in the tab order). It don't works when called by himself (by the TextBox OnSetFocus).
In fact I added a control because I don't know how to change the tab order...
How do you do ? dcl_Control_SetFocus ?
You should change the tab order at design time in OpenDCL Studio (see the Tab/Z Order pane):
http://www.opendcl.com/HelpFiles/index.php?page=Usage/Studio.htm (http://www.opendcl.com/HelpFiles/index.php?page=Usage/Studio.htm)
Yes.. sorry I read too fast and what I was looking for was right under my nose.
Finally, to do what I want, I need a control (must be visible) that support a SetFocus event and that call dcl_TextBox_SetSel ?
May be there is not simpler solution ?
otherwise thank a lot.. nice tool anyway
I don't see any good solution. Perhaps you could put a PictureBox on the form, then call the SetSel from its OnPaint event handler. You would need to set a flag to make sure that SetSel is only called once.
Yes it works too ! And picture can be not visible with the same background color
Thank you very much