Sign in to follow this  
Followers 0
Donald8282

Pic over buttons

7 posts in this topic

Hello, I have a picture as a background in my GUI. I have the picture disabled to be behind everything but I also have it so you can change the backgound picture. When you change it the GUICtrlCreatePic goes over everything else in the GUI and you have to run the mouse over them to make them appear again. Is there any way to make it so it doesn't go over everything else? Thanks in adv. -Donald8282

Share this post


Link to post
Share on other sites



call GUICtrlCreatePic before creating any control should do what you want.

Share this post


Link to post
Share on other sites

call GUICtrlCreatePic before creating any control should do what you want.

I do have it like that.

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

$E_Browser = _IECreateEmbedded()
$Home = "www.Google.com"
$Main = "C:\Users\Owner\Pictures\Logitech Webcam\Picture 28.jpg"

$Window = GUICreate("Web Browser", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
GUISetState()
GUISetState(@SW_MAXIMIZE)

$Height_Width = WinGetPos($Window)

$Background = GUICtrlCreatePic($main, 0, 0, $Height_Width[2], $Height_Width[3])
GUICtrlSetState($Background, $GUI_DISABLE)

$Browser = GUICtrlCreateObj($E_Browser, 10, 40, $Height_Width[2] - 40, $Height_Width[3] - 100)
_IENavigate($E_Browser, $Home)
$I_URL = GUICtrlCreateInput($Home, 250, 10, 200, 20)
$B_Refresh = GUICtrlCreateButton("Refresh", 540, 10, 70, 20)
$B_Go = GUICtrlCreateButton("Go", 460, 10, 70, 20, $BS_DEFPUSHBUTTON)
$B_Forward = GUICtrlCreateButton("Forward", 170, 10, 70, 20)
$B_Back = GUICtrlCreateButton ("Back", 90, 10, 70, 20)
$B_Home = GUICtrlCreateButton ("Home", 10, 10, 70, 20)
$B_Background = GUICtrlCreateButton ("Background", 630, 10, 70, 20)
GUICtrlSetResizing($Browser, 1)
GUICtrlSetResizing($Background, 1)




While 1
    Sleep(10)
    
    HotKeySet("{F5}", "_Refresh")
    
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $GUI_EVENT_MAXIMIZE
        GUICtrlSetResizing($Browser, 1)
        GUICtrlSetResizing($Background, 1)
    Case $msg = $B_Go
        $URL = GUICtrlRead($I_URL)
        _IENavigate($E_Browser, $URL)
    Case $msg = $B_Home
        _IENavigate($E_Browser, $Home)
    Case $msg = $B_Refresh
        _IEAction($E_Browser, "Refresh")
    Case $msg = $B_Back
        _IEAction($E_Browser, "Back")
    Case $msg = $B_Forward
        _IEAction($E_Browser, "Forward")
    Case $msg = $B_Background
        $Picture = FileOpenDialog("Select a picture...", "C:\Users\Owner\Pictures\Logitech Webcam", "Images (*.jpg;*.bmp)", 1)
        If $Picture <> "" Then
            GUICtrlSetImage($Background, $picture)
        Else
        EndIf
    EndSelect
WEnd


Func _Refresh()
    _IEAction($E_Browser, "Refresh")
EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I took out $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN and it's mostly working now. The browser is still going white. Not the whole window just the browser showing google.

Edited by Donald8282

Share this post


Link to post
Share on other sites

= =" I got everything working but the browser going blank.

Share this post


Link to post
Share on other sites

an Ugly workaround.... (hide and show)

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

$E_Browser = _IECreateEmbedded()
$Home = "www.Google.com"
$Main = "C:\Users\Owner\Pictures\Logitech Webcam\Picture 28.jpg"

$Window = GUICreate("Web Browser", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, $GUI_SS_DEFAULT_GUI + $WS_MAXIMIZEBOX)
GUISetState()
GUISetState(@SW_MAXIMIZE)

$Height_Width = WinGetPos($Window)

$Background = GUICtrlCreatePic($main, 0, 0, $Height_Width[2], $Height_Width[3], 0, $GUI_WS_EX_PARENTDRAG)
;~ GUICtrlSetState($Background, $GUI_DISABLE)

$Browser = GUICtrlCreateObj($E_Browser, 10, 40, $Height_Width[2] - 40, $Height_Width[3] - 100)
_IENavigate($E_Browser, $Home)
$I_URL = GUICtrlCreateInput($Home, 250, 10, 200, 20)
$B_Refresh = GUICtrlCreateButton("Refresh", 540, 10, 70, 20)
$B_Go = GUICtrlCreateButton("Go", 460, 10, 70, 20, $BS_DEFPUSHBUTTON)
$B_Forward = GUICtrlCreateButton("Forward", 170, 10, 70, 20)
$B_Back = GUICtrlCreateButton ("Back", 90, 10, 70, 20)
$B_Home = GUICtrlCreateButton ("Home", 10, 10, 70, 20)
$B_Background = GUICtrlCreateButton ("Background", 630, 10, 70, 20)
GUICtrlSetResizing($Browser, 1)
GUICtrlSetResizing($Background, 1)




While 1
    Sleep(10)

    HotKeySet("{F5}", "_Refresh")

    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $GUI_EVENT_MAXIMIZE
        GUICtrlSetResizing($Browser, 1)
        GUICtrlSetResizing($Background, 1)
    Case $msg = $B_Go
        $URL = GUICtrlRead($I_URL)
        _IENavigate($E_Browser, $URL)
    Case $msg = $B_Home
        _IENavigate($E_Browser, $Home)
    Case $msg = $B_Refresh
        _IEAction($E_Browser, "Refresh")
    Case $msg = $B_Back
        _IEAction($E_Browser, "Back")
    Case $msg = $B_Forward
        _IEAction($E_Browser, "Forward")
    Case $msg = $B_Background
        $Picture = FileOpenDialog("Select a picture...", "C:\Users\Owner\Pictures\Logitech Webcam", "Images (*.jpg;*.bmp)", 1)
        If $Picture <> "" Then
            GUICtrlSetImage($Background, $picture)
            GUICtrlSetState($Browser, $GUI_HIDE)
            GUICtrlSetState($Browser, $GUI_SHOW)
        Else
        EndIf
    EndSelect
WEnd


Func _Refresh()
    _IEAction($E_Browser, "Refresh")
EndFunc

Share this post


Link to post
Share on other sites

Thanks =D works perfect now.

Share this post


Link to post
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
Sign in to follow this  
Followers 0