Post by tsh73 on Jan 12, 2020 16:39:31 GMT -5
really, metro's code in thread
Default Button reply from Jan 5, 2020 at 4:24pm with
is shorter
But he codes control order by hand
This program uses Windows tab order
Default Button reply from Jan 5, 2020 at 4:24pm with
for the input of numeric data I do prefer to be able to press enter
you can have both options...
you can have both options...
is shorter
But he codes control order by hand
This program uses Windows tab order
'Default buttom moves to next tabControl demo
'tsh73, Jum 2020
[setup.main.Window]
'-----Begin code for #main
nomainwin
WindowWidth = 550
WindowHeight = 660
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
'-----Begin GUI objects code
TexteditorColor$ = "white"
texteditor #main.textedit12, 5, 212, 520, 395
TextboxColor$ = "white"
textbox #main.textbox1, 5, 5, 100, 25
textbox #main.textbox2, 5, 42, 100, 25
textbox #main.textbox3, 5, 72, 100, 25
textbox #main.textbox4, 120, 7, 100, 25
textbox #main.textbox5, 120, 42, 100, 25
textbox #main.textbox6, 120, 72, 100, 25
button #main.default,"default button",[button7Click], UL, 5, 107, 128, 25
stylebits #main.default, _BS_DEFPUSHBUTTON, 0, 0, 0
button #main.button8,"gather data",[button8Click], UL, 145, 107, 128, 25
open "Default buttom moves to next tabControl" for window as #main
print #main, "font ms_sans_serif 10"
print #main, "trapclose [quit.main]"
#main.textbox1, "!setfocus"
hmain = hWnd(#main) 'main window handle, will need later
validHandles4tab$=" "
for i = 1 to 6
handle$="#main.textbox";i
validHandles4tab$=validHandles4tab$;hWnd(#handle$);" "
next
#main.textedit12, validHandles4tab$
[main.inputLoop] 'wait here for input event
timer 50, [time]
wait
[time]
CallDLL #user32, "GetFocus", handle As long
lastHndl = handle
wait
[button7Click] 'Perform action for the button named 'button7'
'what is current control (before activating default button that is)
'does it valid textbox we want to handle (tab to next control on Enter)
if instr(validHandles4tab$, " ";lastHndl;" ")<>0 then
'get next tab order control
CallDLL #user32, "GetNextDlgTabItem", _
hmain As long, _
lastHndl As long, _
0 As long, _
retHndl As long
'switch to it
CallDLL #user32, "SetFocus", retHndl As long, ret as long
'some reporting
'from control
#main.textedit12, time$();"."; right$("";time$("ms"),3);" from ";Str$(lastHndl); _
'to control
#main.textedit12, " to ";Str$(retHndl)
'set it to last control
lastHndl = retHndl
end if
wait
[button8Click] 'Perform action for the button named 'button8'
#main.textedit12, "data entered:"
for i = 1 to 6
handle$="#main.textbox";i
#handle$, "!contents? value$"
#main.textedit12, handle$;" ";value$
next
#main.textedit12, "----------------"
wait
[quit.main] 'End the program
close #main
end