Jump to content

Trying to put browser controls in tabs


 Share

Recommended Posts

This is my first time using tabs in autoit. I'm using the basic tabs example code and im trying to add browser controls in my tabs so that each tab has its own control but its only working for the first tab I create. Here is my code:

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


_IEErrorHandlerRegister ()
$ie = _IECreateEmbedded ()
$ie2 = _IECreateEmbedded ()

$hGUI = GUICreate("Built-In Tab Example", 1000, 800)


$hTab = GUICtrlCreateTab(10, 10, 480, 480)
; Create tabitems

GUICtrlCreateTabItem("Tab " & 0)
GUICtrlCreateButton("Button " & 0, 20 + (0 * 100), 40 + (0 * 50), 80, 30)
$GUIActiveX = GUICtrlCreateObj($ie, 100, 50, 310, 350)

GUICtrlCreateTabItem("Tab " & 1)
GUICtrlCreateButton("Button " & 1, 20 + (1 * 100), 40 + (1 * 50), 80, 30)
$GUIActiveX = GUICtrlCreateObj($ie2, 100, 50, 310, 350)

; Close Tab definiton
GUICtrlCreateTabItem("")

GUISetState()
_IENavigate ($ie, "http://google.com")
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Edited by drego
Link to comment
Share on other sites

i took this straight out of the helpfile, and modified it a bit...you can take out what you need to make yours work:

#include <GUIConstantsEx.au3>
#include <IE.au3>
Example()
Func Example()
Local $tab
Local $msg
GUICreate("My GUI Tab", 550, 550); will create a dialog box that when displayed is centered
GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)
$tab = GUICtrlCreateTab(10, 10, 500, 500)
GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
GUICtrlCreateButton("OK0", 20, 50, 50, 20)
GUICtrlCreateInput("default", 80, 50, 70, 20)
$ie = _IECreateEmbedded ()
$GUIActiveX = GUICtrlCreateObj($ie, 50, 200, 210, 250)
_IENavigate ( $ie, "[url="http://www.google.com"]www.google.com[/url]" )

GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
GUICtrlCreateCombo("", 20, 50, 60, 120)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon
GUICtrlCreateButton("OK1", 80, 50, 50, 20)
$ie2 = _IECreateEmbedded ()
$GUIActiveX2 = GUICtrlCreateObj($ie2, 50, 200, 210, 250)
_IENavigate ( $ie2, "[url="http://www.msn.com"]www.msn.com[/url]" )
GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW); will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
GUICtrlCreateButton("OK2", 140, 50, 50)
$ie3 = _IECreateEmbedded ()
$GUIActiveX3 = GUICtrlCreateObj($ie3, 50, 200, 210, 250)
_IENavigate ( $ie3, "[url="http://www.w3schools.com"]www.w3schools.com[/url]" )
GUICtrlCreateTabItem(""); end tabitem definition
;GUICtrlCreateLabel("Click on tab and see the title", 20, 130, 250, 20)
GUISetState()
; Run the GUI until the dialog is closed
While 1
     $msg = GUIGetMsg()
     If $msg = $GUI_EVENT_CLOSE Then ExitLoop
     If $msg = $tab Then
         ; display the clicked tab
         WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($tab))
     EndIf
WEnd
EndFunc ;==>Example
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

oh, well yours is working, you just need to navigate...it's showing a blank page, with no border, so it 'looks' like it's not there:

_IENavigate ($ie, "[url="http://google.com"]http://google.com[/url]")
_IENavigate ($ie2, "[url="http://msn.com"]http://msn.com[/url]")

edit:

your button isn't appearing, because of your coords, it puts it smack behind the embedded browser

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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...