Jump to content

Tabbing Through Controls


Recommended Posts

This is probably a silly question, but I can't seem to get the behaviour I desire.

I have multiple controls in a GUI I created. I want the <TAB> key to move to the next edit control or button in a specified order. To wit:

#include <GUIConstants.au3>
$Window = GUICreate("Tab Problem", 800, 550, -1, -1)
$filemenu = GUICtrlCreateMenu ("&File")
$helpmenu = GUICtrlCreateMenu ("Help")
$infoitem = GUICtrlCreateMenuitem ("Help",$helpmenu)
$exititem = GUICtrlCreateMenuitem ("Exit",$filemenu)
$separator1 = GUICtrlCreateMenuitem ("",$filemenu,2)


$SubjectInput = GUICtrlCreateEdit("", 55, 6, 409, 21,$ES_OEMCONVERT, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE,))
$MailInput = GUICtrlCreateEdit("", 55, 30, 709, 455, $ES_WANTRETURN+$ES_MULTILINE+$ES_AUTOVSCROLL+$WS_VSCROLL, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE,))
GUICtrlCreateLabel("Subject:", 1, 10, 43, 17)
GUICtrlCreateLabel("", 400, 176, 4, 4)
GUICtrlCreateLabel("Mail Body:", 1, 35, 53, 17)
$TestMailButton = GUICtrlCreateButton("Test Mode", 175, 490, 128, 31)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
GUICtrlSetColor(-1, 0x000080)
$SendMailButton = GUICtrlCreateButton("Send Mail", 350, 490, 129, 31)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$Exit = GUICtrlCreateButton("Exit", 525, 490, 129, 31)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem OR $msg = $Exit Then ExitLoop    
WEnd
GUIDelete()

This starts with focus on the Body for some reason.

I want the control focus to be on "Subject" initally, then tab to Body, Test Mode, Send Mail, Exit

edited: removed unecessary control...

Edited by LovinItAll
Link to comment
Share on other sites

#include <GUIConstants.au3>
$Window = GUICreate("Tab Problem", 800, 550, -1, -1)
$filemenu = GUICtrlCreateMenu("&File")
$helpmenu = GUICtrlCreateMenu("Help")
$infoitem = GUICtrlCreateMenuItem("Help", $helpmenu)
$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
$separator1 = GUICtrlCreateMenuItem("", $filemenu, 2)


$SubjectInput = GUICtrlCreateEdit("", 55, 6, 409, 21, $ES_OEMCONVERT, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
$MailInput = GUICtrlCreateEdit("", 55, 30, 709, 455, BitOR($ES_WANTRETURN, $ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
GUICtrlCreateLabel("Subject:", 1, 10, 43, 17)
GUICtrlCreateLabel("", 400, 176, 4, 4)
GUICtrlCreateLabel("Mail Body:", 1, 35, 53, 17)
$TestMailButton = GUICtrlCreateButton("Test Mode", 175, 490, 128, 31)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
GUICtrlSetColor(-1, 0x000080)
$SendMailButton = GUICtrlCreateButton("Send Mail", 350, 490, 129, 31)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$Exit = GUICtrlCreateButton("Exit", 525, 490, 129, 31)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
GUISetState(@SW_SHOW)
GUICtrlSetState($SubjectInput, $GUI_FOCUS)

While 1
   $msg = GUIGetMsg()
   If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Or $msg = $Exit Then ExitLoop
WEnd
GUIDelete()

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...