Jump to content

Tabbed Browser - keyboard Control Problem


Recommended Posts

I am building an application that uses a tabbed browser interface. I have encountered a problem that the keyboard controls are only working in the last tab. I have provided sample code below that demonstrates this. The last two tabs are online spreadsheets where the cursor controls should move the current position around from cell to cell. The last tab works fine. The second tab doesn't. This code is just for demo purposes. I have two different examples of tabbed browsers and both exhibit the same behavior. The one that I used as the basis for my application actually uses the IE.au3 UDF.

I am running under Win7 with IE9. I get the same result under XP with IE8. I think that it probably has something to do with what tab / control is seen to be active (i.e. the last one created!?) but I don't know how to change it. Maybe the event loop needs to determine which tab was selected and then do something to make the keyboard controls active. Searched the forums but I couldn't find anything describing this specific problem.

; a tiny tabbed browser
; This version to demo problem with no keyboard controls except in the last tab

#include <GUIConstants.au3> 
#include <TabConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Simple Web Browser MINI Version", 1100, 700, 10, 10) 

$win_style = BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $GUI_SS_DEFAULT_TAB)
GuiCtrlCreateTab(10, 10, 930, 630, $win_style)

GuiCtrlCreateTabItem("Tab 1")
$oIEstart1 = ObjCreate("Shell.Explorer.2")
$GUIActiveXstart1 = GUICtrlCreateObj($oIEstart1, 12, 34, 1000, 650)
$oIEstart1.navigate("http://google.com")
GuiCtrlCreateTabItem("")

GuiCtrlCreateTabItem("Tab 2")
$oIEstart2 = ObjCreate("Shell.Explorer.2")
$GUIActiveXstart2 = GUICtrlCreateObj($oIEstart2, 12, 34, 1000, 650)
$oIEstart2.navigate("http://www.editgrid.com/explore/user/jorgehen/planilha_orcamento_familiar_modelo")
GuiCtrlCreateTabItem("")

GuiCtrlCreateTabItem("Tab 3")
$oIEstart3 = ObjCreate("Shell.Explorer.2")
$GUIActiveXstart3 = GUICtrlCreateObj($oIEstart3, 12, 34, 1000, 650)
$oIEstart3.navigate("http://www.editgrid.com/explore/user/altklausuren/P%C3%A4diatrie_AK")
GuiCtrlCreateTabItem("")

GUISetState(@SW_SHOW) ;Shows the GUI

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
        EndSwitch
    WEnd
Edited by chrshea
Link to comment
Share on other sites

Firstly, I could run this, and I dont have any version of internet explorer installed on my system... yay, go me...

Secondly, I have found that in second tab, if you use the cursors to move around, it still works in the third tab, and so I agree with your idea that it is the active tab. What I would suggest you do, is to get it to switch focus over to the current tab.

Link to comment
Share on other sites

Firstly, I could run this, and I dont have any version of internet explorer installed on my system... yay, go me...

Secondly, I have found that in second tab, if you use the cursors to move around, it still works in the third tab, and so I agree with your idea that it is the active tab. What I would suggest you do, is to get it to switch focus over to the current tab.

Good observation about the cursor still moving in the last tab. Now to figure out how to determine when there is a tab switch and do something to activate the right browser window. I tried previously but I couldn't find a way to recognize a tab change as an event.

With respect to your first comment, is that because the support for the IE functions are buried within Windows so it doesn't matter if you have IE actually installed or did you do something specific to make this possible?

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