chrshea Posted July 24, 2011 Share Posted July 24, 2011 (edited) 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. expandcollapse popup; 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 July 24, 2011 by chrshea Link to comment Share on other sites More sharing options...
Mikeman27294 Posted July 24, 2011 Share Posted July 24, 2011 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 More sharing options...
chrshea Posted July 24, 2011 Author Share Posted July 24, 2011 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 More sharing options...
Mikeman27294 Posted July 24, 2011 Share Posted July 24, 2011 No, I did nothing specific, I just ran it. As for the tab switch, I am unsire, but I believe that it might be able to be done by usinf the UDF tab, usng the function _GUICtrlTab_SetCurFocus. Link to comment Share on other sites More sharing options...
chrshea Posted July 25, 2011 Author Share Posted July 25, 2011 I can determine which tab is selected and I've tried different things in the event loop to set the focus (and similar things) but so far no luck. Any other ideas out there? Link to comment Share on other sites More sharing options...
Mikeman27294 Posted July 25, 2011 Share Posted July 25, 2011 Well in that case, I am outta ideas, but I will let you know if I think of anything... wait, possible brainwave. What if you set the focus to the browser element itself, instead of the tab? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now