Jump to content

Buttons don't respond to Tab/Enter key


Raja
 Share

Recommended Posts

Hi

Am hoping some one can help me with the problem as below.

Thanks!

Raja

The following GUICtrlCreateObj example is from AutoIt help, the buttons do not respond to Tab/Enter keys but they do respond to the mouse click.

I have used this example in my work a while ago and am not sure if I never experienced this problem before as I might have used mouse at that time. I prefer using keyboard, so am surprised how did I miss this one. Am keen to know if things have changed on my computer (MS updates) and it has stopped working now or this example does not respond to keyboard for any one.

Can anyone please confirm?

If works for you, then please advise with any other options where I can load a local html page into a GUI created bu AutoIt. Will have a couple of buttons, which must respond to keyboard and mouse.

If NOT, then what to look for that is not allowing it to work on my PC.

#include <GUIConstants.au3>
; Simple example: Embedding an Internet Explorer Object inside an AutoIt GUI
;
; See also: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp

$oIE = ObjCreate("Shell.Explorer.2")

; Create a simple GUI for our output
GUICreate ( "Embedded Web control Test", 640, 580,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2, BitOr($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
$GUIActiveX      = GUICtrlCreateObj   ( $oIE,     10, 40 , 600 , 360 )
$GUI_Button_Back    = GuiCtrlCreateButton   ("Back",     10, 420, 100,  30)
$GUI_Button_Forward = GuiCtrlCreateButton   ("Forward", 120, 420, 100,  30)
$GUI_Button_Home    = GuiCtrlCreateButton   ("Home",    230, 420, 100,  30)
$GUI_Button_Stop    = GuiCtrlCreateButton   ("Stop",    330, 420, 100,  30)

GUISetState ()    ;Show GUI

$oIE.navigate("http://www.autoitscript.com")

; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GUI_Button_Home
            $oIE.navigate("http://www.autoitscript.com")
        Case $msg = $GUI_Button_Back
            $oIE.GoBack
        Case $msg = $GUI_Button_Forward
            $oIE.GoForward
        Case $msg = $GUI_Button_Stop
            $oIE.Stop
    EndSelect
    
Wend

GUIDelete ()

Exit
Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

; Simple example: Embedding an Internet Explorer Object inside an AutoIt GUI
;
; See also: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp

_IEErrorHandlerRegister ()

$oIE = ObjCreate("Shell.Explorer.2")

; Create a simple GUI for our output
GUICreate ( "Embedded Web control Test", 640, 580,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2, BitOr($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))

$GUIActiveX         = GUICtrlCreateObj      ( $oIE,      10, 40 , 600 , 360 )
$GUI_Button_Back    = GuiCtrlCreateButton   ("Back",     10, 420, 100,  30)
$GUI_Button_Forward = GuiCtrlCreateButton   ("Forward", 120, 420, 100,  30)
$GUI_Button_Home    = GuiCtrlCreateButton   ("Home",    230, 420, 100,  30)
$GUI_Button_Stop    = GuiCtrlCreateButton   ("Stop",    330, 420, 100,  30)

GUISetState ()      ;Show GUI
GUICtrlSetState($GUI_Button_Back, $GUI_FOCUS)

$oIE.navigate("http://www.autoitscript.com")

; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
            Case $msg = $GUI_Button_Home
                _IENavigate($oIE, "http://www.autoitscript.com")
            Case $msg = $GUI_Button_Back
                _IEAction($oIE, "back")
      Case $msg = $GUI_Button_Forward
         _IEAction ($oIE, "forward")
      Case $msg = $GUI_Button_Stop
         _IEAction ($oIE, "stop")
    EndSelect
    
Wend

GUIDelete ()

Exit

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...