Keypad Entry Problem

 From:  Michael Gibson
7012.2 In reply to 7012.1 
Hi Brian, yeah that's set up fairly differently than how regular MoI command scripts run. The usual method is to read values out of the input controls only once a UI event has been triggered, that's in the .js file where you have an event loop that does:

code:
	while ( 1 )
	{
		if ( !dialog.waitForEvent() )
                ....




You asked:

> Is there some way to let the keypad finish up, before the keys are grabbed?

Yeah it should be possible by waiting for the UI event for the input control to be triggered, and when that is received set a flag for the continuously updating loop to recalculate.

That would look something like this:

code:
		if ( dialog.event == 'done' ) break; // "Done" pushed.

		if ( dialog.event == 'U' )
		{
			// The input with id="U" has finished receiving input, characters have been typed and Enter
			// pushed or OK on the popup keypad has been pushed, now let an update happen.
                
			moi.ui.commandUI.SomeFlagForDoUpdate = true;
		}


Then on the .htm side make it look for the "SomeFlagForUpdate" variable and only let it go forward with processing things if that is set to true.


This kind of a thing with a constantly going script on a timer can be problematic with it trying to access the UI (with getting sort of "in between" values like this), if it's triggered more in response to UI events then that should probably help.

- Michael