Forcing ENTER with TextEditBox and ComboBoxIs there a way to force a "click" or the ENTER key on TextEditBox and ComboBox?
Re: Forcing ENTER with TextEditBox and ComboBoxIf you don't have to build the functions dynamically Then I would say that you just don't use anonymous funcitons (basically the same idea as peter).
Names Default to here(1);
f = function({self}, {},
print("stuff")
);
somebox << Set Function(f);
then just call f when f(somebox) when you want to run it.
Re: Forcing ENTER with TextEditBox and ComboBoxYes indeed. Get Function... I've had some trouble getting this to work consistently.
One troublesome Displaybox to hack is PopupBox. Doesn't seem there's away of indirectly triggering those menu scriptsRe: Forcing ENTER with TextEditBox and ComboBoxI sometimes do a.
click = nameexpr(obj << Get Function);
click()
the nameexpr is just a safety net because depending on the complexity there are sometimes issues with it.
Re: Forcing ENTER with TextEditBox and ComboBoxIf I have a complex expression for a particular object I'll put it into a named expression and call it by the name. If I want to perform the actions separately I just reference the expression.
my_expr = expr(
txt1 = teb1 << get text();
teb2 << set text("You entered: " || txt1);
);
nw = new window("Test",
teb1 = text edit box("", << set width(200),
<< set script(my_expr)
),
teb2 = text edit box("", << set width(200)),
bb = button box("OK",
nw << close window;
)
);Re: Forcing ENTER with TextEditBox and ComboBoxGood point. See my recent reply to @txnelson
The key factor is that I'd like to trigger the object's script WITHOUT user interaction. For instance, the case where a user doens't want to change anything (but we still need the underlying functions to be triggered).
Re: Forcing ENTER with TextEditBox and ComboBoxI should have mentioned... I'm trying to force the execution of the associated object functions. (i.e. set by: obj << setFunction(). Some objects like ButtonBox, you can do button << click(). Others like ComboBox, you can do: obj << set( 1, runScript(1) ). There doesn't seem to be an equivalent message for Text Edit Box and ListBox.Re: Forcing ENTER with TextEditBox and ComboBoxThis example might come a little closer. If you set focus on the first text edit box, and then tab or mouse out of it, the action will run populating the second text edit box.
nw = new window("Test",
teb1 = text edit box("", << set width(200),
<< set script(
txt1 = teb1 << get text();
teb2 << set text("You entered: " || txt1);)
),
teb2 = text edit box("", << set width(200)),
bb = button box("OK",
nw << close window;
)
);Re: Forcing ENTER with TextEditBox and ComboBoxI am not sure I completly understand your request. However, let me see if I can add some light on it, and if I am missing the target then you might be able to add some specifics.
Text Edit Box() does not have an action where you can do something based upon something changing in the box. (i.e. tebox << on change()). &amp;nbsp;A defined script or function for Text Edit Box() requires the user to press the Enter key for the script or function to run.&amp;lt;/P&amp;gt;
&amp;lt;P&amp;gt;&amp;nbsp;&amp;lt;/P&amp;gt;
&amp;lt;P&amp;gt;A combo box automatically runs a specified script or function, whenever a new selection is made. &amp;nbsp;If a text edit box() has been changed, but no Enter key has been specified, and then a a combo box is clicked on, it will run the text edit box().&amp;lt;/P&amp;gt;
&amp;lt;P&amp;gt;&amp;nbsp;&amp;lt;/P&amp;gt;
&amp;lt;P&amp;gt;Does this help?&amp;lt;/P&amp;gt;&amp;lt;/lingo-body&amp;gt;