Set focus on text edit boxHello
I try to check for an entry in a database with a barcode scanner.
It will enter the number and gives an enter at the end whitch triggers the script of the "text edit box".
What doesn't work is to reset the focus back on the box to enter the next number.
Names Default To Here( 1 );
dt = current data table();
try(win1<<CLOSE window=""></CLOSE>
Re: Set focus on text edit boxmy current workaround with the help of https://community.jmp.com/t5/Discussions/JSL-to-input-an-Enter-keystroke/td-p/5872
Its basicly the following: put a mouse box around the text edit box. Set focus on the mouse box and press TAB witch sets the focus on the text edit box.
Names Default To Here( 1 );
clear log();
if(1==1,
VK_TAB = Hex to Number( "00000009" ); //&H9
KEYEVENTF_EXTENDEDKEY = Hex to Number( "00000001" ); //&H1
KEYEVENTTF_KEYDOWN = 0;
KEYEVENTF_KEYUP = Hex to Number( "00000002" ); //&H2
kernel32 = Load Dll( "kernel32" );
kernel32 << DeclareFunction( "Sleep", Convention( STDCALL ), Alias( "Sleep" ),
Arg( Int32, "dwMilliseconds" ),Returns( Void ) );
user32 = Load Dll( "User32" );
user32 << DeclareFunction( "FindWindowA", Convention( STDCALL ), Alias( "FindWindow2" ),
Arg( UInt32, input, "lpClassName" ),Arg( AnsiString( 200 ), input, "lpCaption" ),Returns( UIntPtr ) );
user32 << DeclareFunction( "SetForegroundWindow", Convention( STDCALL ), Alias( "SetForegroundWindow" ),
Arg( UIntPtr, "hWnd" ),Returns( UInt32 ));
user32 << DeclareFunction( "keybd_event", Convention( STDCALL ), Alias( "keybd_event" ),
Arg( UInt8, "bVk" ),Arg( UInt8, "bScan" ),Arg( UInt32, "dwFlags" ),Arg( UIntPtr, "dwExtraInfo" ),Returns( Void ));
user32 << DeclareFunction( "GetKeyState", Convention( STDCALL ), Alias( "GetKeyState" ),
Arg( Int32, "nVirtKey" ),Returns( Int32 ) );
shell32 = Load Dll( "shell32" );
shell32 << DeclareFunction( "ShellExecuteA", Convention( STDCALL ), Alias( "ShellExecute" ),
Arg( UIntPtr, input, "hWnd" ),Arg( AnsiString( 20 ), "lpOperation" ),Arg( AnsiString( 256 ), "lpFile" ),
Arg( AnsiString( 256 ), "lpParameters" ), /* Arg( UInt32, "lpParameters" ), */Arg( UInt32, "lpDirectory" ),
Arg( UInt32, "nShowCmd" ),Returns( UInt32 ));
key = function( { l_key },
user32 << keybd_event( l_key, 0, 0, 0 ); // press key
user32 << keybd_event( l_key, 0, KEYEVENTF_KEYUP, 0 ); // release key
);
); // Setup the win key command code from the JMP community: https://community.jmp.com/t5/Discussions/JSL-to-input-an-Enter-keystroke/td-p/5872
reset_focus = expr(
wait(0.1);
mb<<SETFOCUS></SETFOCUS>
Edit: The bb1 = Button Box( "Check",reset_focus;) seems to mess with the focus (sets it back to its self then to the next item).
Re: Set focus on text edit boxTank you for your reply and sorry for the unclear request.
I want to reset the focus on a TextEditBox.
I don't know if there is a "hidden" function, I couldn't find a solution on the community pages so a work-around would be a solution.
Wish List entry done --> https://community.jmp.com/t5/JMP-Wish-List/Set-next-focus-on-TextEditBox/idi-p/214995#M633Re: Set focus on text edit boxIf you know about the omission, then what is your point?
Do you want a work-around? If so, then someone might be able to help you in this discussion.
Do you want new functionality? If so, then go to the Wish List part of the JMP Community. Check to see if someone has already requested something like this need. If not, please add it for consideration.
It is not clear what you want from this discussion.
Re: Set focus on text edit boxTHX, I know, but that functionality is still missing.
I can use MouseBox and the SetKey function to at least reduce it to press TAB once to focus on the TextEditBox.
Names Default To Here( 1 );
dt = current data table();
try(win1<<CLOSE window=""></CLOSE>
It would be nice to set in the parameter of TextEditBox(...,...,...,next object when press TAB or ENTER).
In my case:
pnr = text edit box("example",set width(160),set nlines(1),<<SETSCRIPT></SETSCRIPT>
Re: Set focus on text edit boxIt appears that the << Set Focus and << Restore Focus After Click messages are not part of the protocol for a text edit box.
You can check for yourself by selecting Help > Scripting Index. Change the list to Display Box and then select the TextEditBox item. You won't find this message in the second list that shows the entire protocol.
You can search for this message, for example, enter 'search' in the filter box. You won't find another object with this message.
You can also ask a display box object directly for its protocol:
Show Properties( Text Edit Box( "test" ) );