Title: Re: dcl-TextBox-SetSel looks like it doesn't work
Post by: domenicomaria on June 10, 2022, 01:42:20 PM
dgs-prj is the variabile that contains the name of the odcl project while dgs-frm is the variabile that contains the name of the form and "textbox" is the name of the textbox control
Title: Re: dcl-TextBox-SetSel looks like it doesn't work
Post by: owenwengerd on June 10, 2022, 05:25:42 PM
Ah, I see, you use strings instead of symbols to refer to the control. In that case, maybe the failure is related to the context in which the function is called. Does it work in a button clicked event?
Title: Re: dcl-TextBox-SetSel looks like it doesn't work
Post by: domenicomaria on June 11, 2022, 01:47:32 AM
It is called at ON-INITIALIZE event
Title: Re: dcl-TextBox-SetSel looks like it doesn't work
Post by: domenicomaria on June 11, 2022, 02:15:30 AM
(setq mc (dcl-getmousecoords) left (nth0 mc) top (nth1 mc)
r (:DCL-GETSTRING"... NEW SUB-MENU NAME ..."" enter the new sub menu name, below :""[ M E N U 0 1 ]"(list left top))
)
r
)
Title: Re: dcl-TextBox-SetSel looks like it doesn't work
Post by: domenicomaria on June 11, 2022, 10:26:03 AM
It depends from the control tab order ...
if I put the textbox control in the first position, everything works well !
Title: Re: dcl-TextBox-SetSel looks like it doesn't work
Post by: owenwengerd on June 11, 2022, 10:32:36 AM
I see you discovered a solution while I was composing a reply. Posting anyway in case it is useful in the future.
-- snip -- I suppose your call happens too early, and either gets undone by following initialization by the form itself, or the control just doesn't process selection methods before it is visible. You might try delaying the call by setting a timer and doing it from the timer event; or make this the first control in the form's tab order so the dialog does the work for you when it sets initial focus to the textbox.
Title: Re: dcl-TextBox-SetSel looks like it doesn't work
Post by: domenicomaria on June 11, 2022, 10:43:09 AM
"or make this the first control in the form's tab order"