Вот так работает и с помощью клавиатуры и с помощью колеса мыши. Переключение между гаджетами по клавише TAB или SHIFT+TAB
Код
#Include "window9.bi"
Dim As Integer event
Dim As hwnd hwnd
Dim As Integer font = CInt(LoadFont("Arial",22))
Dim As Integer TabStop(1 To 2) = {1,2}, iNumberSelect = 1
SetGadgetFont(,font)
hwnd = OpenWindow("1",300,10,250,200)
AddKeyboardShortcut(hwnd,FVIRTKEY,VK_TAB,1001)
AddKeyboardShortcut(hwnd,FSHIFT,VK_TAB,1002)
SpinGadget(1,10,10,200,40,100,0,50,UDS_ARROWKEYS Or UDS_SETBUDDYINT Or UDS_ALIGNRIGHT)
SpinGadget(2,10,60,200,40,100,0,50,UDS_ARROWKEYS Or UDS_SETBUDDYINT Or UDS_ALIGNLEFT)
SetGadgetColor(1,50000,0,1)
SetGadgetColor(2,&hff,0,1)
SetFocus(GadgetID(TabStop(iNumberSelect)))
Do
event=WaitEvent()
If event=EventClose Then End
If event=EventMenu Then
Select Case EventNumber
Case 1001
iNumberSelect = iNumberSelect + 1
If iNumberSelect>UBound(TabStop) Then iNumberSelect = 1
SetFocus(GadgetID(TabStop(iNumberSelect)))
Case 1002
iNumberSelect = iNumberSelect - 1
If iNumberSelect<LBound(TabStop) Then iNumberSelect = UBound(TabStop)
SetFocus(GadgetID(TabStop(iNumberSelect)))
End Select
EndIf
Loop