intime69 Posted January 6, 2011 Share Posted January 6, 2011 (edited) I wasn't able to find an answer for this specific problem so here goes...I have and embedded IE object with a Floating URL Box that appears on demand. The URL box is a child window of the main GUI. When called without first interacting with the embedded IE object, the URL Floating Box works fine. However, if I click a link or enter a search field within the embedded IE object and then call the URL box, using the 'Backspace' for example will no longer delete the URL within the floating box. The 'Right' and 'Left' arrow keys, 'Home' key, 'End' key and other control keys also don't work. I can only type in the URL box. Nothing more - even though the main GUI is disabled!Please note that all other functions work while the Floating URL Box is active. Only the input field is affected and although it has focus, certain keys like the 'Backspace' don't work.Here's a stripped-down example using one of those 'Simple Browser' examples. Click on the URL button to show the floating URL box:expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> $GUI = GUICreate("Simple Web Browser", 800, 450) $object = ObjCreate("Shell.Explorer.2") $object_ctrl = GUICtrlCreateObj($object, 16, 10, 780, 400) $url_button = GUICtrlCreateButton("URL", 166, 410, 400, 25, 0) $back_button = GUICtrlCreateButton("Back", 16, 410, 50, 25, 0) ; Creats Back GUI $forward_button = GUICtrlCreateButton("Forward", 66, 410, 50, 25, 0) ; Creates Forward GUI $refresh_button = GUICtrlCreateButton("Refresh", 116, 410, 50, 25, 0) ; Creates Refresh GUI $progressbar1 = GUICtrlCreateProgress ( 570, 415, 200, 20, 0) ; Creates Progress bar _IENavigate($object, "http://www.autoitscript.com/forum/") GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $url_button GUISetState(@SW_DISABLE) $pos = MouseGetPos() $NavBar = GUICreate("Enter URL", 527, 57, $pos[0], $pos[1], $WS_SYSMENU, BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE), $GUI) Local $URL = GUICtrlCreateInput("http://www.autoitscript.com/forum/", 8, 6, 505, 21) GUICtrlSetState(-1, $GUI_FOCUS) GUISetState(@SW_SHOW, $NavBar) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete ($NavBar) ExitLoop EndSwitch WEnd GUISetState(@SW_ENABLE, $GUI) GUISetState(@SW_SHOW, $GUI) ;_IENavigate($Object, $URL) ;Set_progress() ; Function Case $msg = $back_button ; Send browser to previous page $Object.GoBack Set_progress() ; Function Case $msg = $forward_button ; Send browser forward $Object.GoForward Set_progress() ; Function Case $msg = $refresh_button ; Refreshes browser page $Object.Refresh Set_progress() ; Function Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func Set_progress() ; Creates Progress bar For $pg = 0 To 100 Step 5 GUICtrlSetData($progressbar1, $pg) Sleep(2) Next EndFuncIf anybody can figure this one out, it would be so greatly appreciated. I am hoping that it's something simple that I have overlooked.Thanks!Ian Edited January 6, 2011 by intime69 Developer and Co-OwnerInTime Applicaitons Inc. Link to comment Share on other sites More sharing options...
intime69 Posted January 8, 2011 Author Share Posted January 8, 2011 YES!!! Got it working! A fairly easy workaround. If anybody interested, I can post the required coding... Ian Developer and Co-OwnerInTime Applicaitons Inc. Link to comment Share on other sites More sharing options...
tito Posted January 11, 2011 Share Posted January 11, 2011 YES!!! Got it working! A fairly easy workaround. If anybody interested, I can post the required coding...Ianpls post your solution Link to comment Share on other sites More sharing options...
intime69 Posted January 17, 2011 Author Share Posted January 17, 2011 (edited) Sure Only 2 lines of code need to be added. Essentially, you need to create a dummy control (Button Controls seem to work the best) and send focus to the dummy control just before showing the NavBar (or any other secondary GUI such as a custom dialog). This will remove focus from the Embedded IE Control. You can hide the dummy control by positioning it off screen and making it 1x1 pixels. Here's the revised code: expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> $GUI = GUICreate("Simple Web Browser", 800, 450) $object = ObjCreate("Shell.Explorer.2") $object_ctrl = GUICtrlCreateObj($object, 16, 10, 780, 400) $url_button = GUICtrlCreateButton("URL", 166, 410, 400, 25, 0) $back_button = GUICtrlCreateButton("Back", 16, 410, 50, 25, 0) ; Creats Back GUI $forward_button = GUICtrlCreateButton("Forward", 66, 410, 50, 25, 0) ; Creates Forward GUI $refresh_button = GUICtrlCreateButton("Refresh", 116, 410, 50, 25, 0) ; Creates Refresh GUI $progressbar1 = GUICtrlCreateProgress ( 570, 415, 200, 20, 0) ; Creates Progress bar $dummy = GUICtrlCreateButton("", -2, -2, 1, 1) ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< _IENavigate($object, "http://www.autoitscript.com/forum/") GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $url_button GUISetState(@SW_DISABLE) $pos = MouseGetPos() $NavBar = GUICreate("Enter URL", 527, 57, $pos[0], $pos[1], $WS_SYSMENU, BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE), $GUI) Local $URL = GUICtrlCreateInput("http://www.autoitscript.com/forum/", 8, 6, 505, 21) GUICtrlSetState($dummy, $GUI_FOCUS) ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSetState(-1, $GUI_FOCUS) GUISetState(@SW_SHOW, $NavBar) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete ($NavBar) ExitLoop EndSwitch WEnd GUISetState(@SW_ENABLE, $GUI) GUISetState(@SW_SHOW, $GUI) ;_IENavigate($Object, $URL) ;Set_progress() ; Function Case $msg = $back_button ; Send browser to previous page $Object.GoBack Set_progress() ; Function Case $msg = $forward_button ; Send browser forward $Object.GoForward Set_progress() ; Function Case $msg = $refresh_button ; Refreshes browser page $Object.Refresh Set_progress() ; Function Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func Set_progress() ; Creates Progress bar For $pg = 0 To 100 Step 5 GUICtrlSetData($progressbar1, $pg) Sleep(2) Next EndFunc It's a simple yet effective work around! Let me know if you get it working at your end... Ian Edited January 17, 2011 by intime69 Developer and Co-OwnerInTime Applicaitons Inc. Link to comment Share on other sites More sharing options...
matwachich Posted December 29, 2011 Share Posted December 29, 2011 GREAT THANKS!!!!!!!!!! Link to comment Share on other sites More sharing options...
bdr529 Posted January 24, 2019 Share Posted January 24, 2019 you are my superhero To community goes all my regards and thanks 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