Programmatically call edit box set action


Recommended Posts

Is it possible to call a function to trigger the "set" action on an edit box?

I have a touchscreen application, with a custom popup keyboard (due to screen size restrictions).

The popup may be called for any of the edit boxes, and when the user presses Enter I'd like to "set" the edit box value for the calling edit box. Before I figure out how to pass the calling edit box, is it possible to trigger the "set" action in code, rather than tie it to a specific button? (I don't want the popup Enter to set all of the edit boxes, only the active one)

Hope this is clear

Thanks in advance

Link to comment
Share on other sites

Sorry, I didn't explain clearly enough. What I want to do is load the strContents then trigger the "Set" action.

I want a general purpose popup keypad that doesn't need to know the variable it's editing. If I can just call the edit box Set action then the keypad doesn't need to know the variable, only the name of the edit box that called it.

I suppose I could do the same by getting the edit box "set to" variable and execute function but wanted to know if it's possible to call the edit box set action instead, as this would probably be faster and means I don't have to do the checking for valid entries manually.

Thanks

Link to comment
Share on other sites

No there isn't because you can do it as you described by simply getting the Set Channel and the contents and setting one to the other using execute().

In fact, you should just use execute() and evaluate() to achieve your global keypad. Just have a global string variable that holds which edit box its going to edit. Then use execute() to change the contents of the edit, and when they hit your button to submit, use execute() with the set to variable to actually set it.

Link to comment
Share on other sites

  • 3 months later...

Hi,

I have a similar problem to the one above. I have two Date Time Components that the user can specify a start time and end time for a certain program to run between. I am not using the date part of the component and do not have any arguments for it, so when the user sets this time, the channel linked to the component is set to the time/day (in 1970 format) on the current day. This is as I expected.

I would like the component to update the channel more regularly then only when the set button is pressed, as I need the two times to always represent the those times on the current day/date (the user might only set the times once every month or less). At the moment I have a regularly updating signal (heartbeat) and I am trying to call the DoOnSet component function to reset the signal everytime the heartbeat triggers but it doesnt seem to work. No errors in the execution, but the signal is not updating.

Is there another function I should be using? Any help would be appreciated.

Link to comment
Share on other sites

See Post #2 in this thread. You can access the current contents of a date/time control programmatically with the "contents" variable. Its "contents" for date/time, not "strContents", because the result is a number, namely the date/time of the currently displayed value. This value is updated whenever the control is changed, irrespective of any DoOnSet, etc. settings, so should achieve what you want. You can even just leave the Set Channel empty, give the component a name, and access the contents from script whenever you want it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.