If we create a window with three controls we can cycle focus in circle between them by pressing Tab key.
But if we add a graphic box, the graphic box will trap the focus and there is no way to cycle it to other controls.
Therefor I have to add a little code to discover the Tab key press while the focus on it then change focus to first control, in this way I can recycle focus movement.
But when I do that I discovered that I was received two press of Tab key instead of one!!!!
Caused to execute print line and beep two times !!!!
I said the first execute caused by my press.
The second execute caused by the press which sent by OS (as I supposed).
Therefor I add two lines of code to block the second Tab press which is sent by OS (according to my suppose).
In the cod below, if you comment the lines which I indicate to you got two beeps and two print of No 1 on main win.
The timer is only to color the graphic box when it got focus.
WindowWidth = 571 : WindowHeight = 446
UpperLeftX = INT((DisplayWidth-WindowWidth)/2)
UpperLeftY = INT((DisplayHeight-WindowHeight)/2)
graphicbox #main.graphicbox1, 190, 250, 200, 25
textbox #main.textbox1, 185, 50, 205, 25
combobox #main.combo1,Combo1$(), combo1Click, 185, 100, 205, 300
button #main.button1, "Button 1", button1Click, UL, 185, 165, 205, 30
Open "Window Title" for Window as #main
#main "trapclose [quit]"
print #main.graphicbox1," when characterInput [inpt]"
Timer 300, [events]
CallDLL #user32, "GetFocus", handle As long
if handle= hgrBx then
#main.graphicbox1 "down; fill yellow; flush"
if handle<> hgrBx then
#main.graphicbox1 "down; fill white; flush"
keyValue = asc(right$(key$,1))
if BB=1 then BB=0: wait' <<<<<<<<<
BB= BB+1 '<<<<<<<<<<<<<<<<<<<<
IF keyValue= _VK_TAB then'
calldll #kernel32, "Beep", 2000 As Long, 50 As Long, r As Long
close #main : END