Jump to content
Sign in to follow this  
demandnothing

This is confusing.

Recommended Posts

demandnothing

I want to have my script download an image off the internet, and set it to its background image. I've done this successfully by using GUICtrlCreatePic() that filled the entire GUI.. i put some buttons and input boxes on it just as a test GUI, but when it successfully gets the image and sets the picture, it covers up all of the buttons until your mouse hovers over them. im using $GUI_ONTOP for everything but the picture, but it doesnt change anything.

How would i download an image, and set it to be the Interface Background, without messing up the controls like that?

Share this post


Link to post
Share on other sites
Authenticity

Try something like:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Local $hGUI
Local $Pic, $Btn

$hGUI = GUICreate("Title", 640, 480)
$Pic = GUICtrlCreatePic(@ScriptDir & "\image.bmp", 0, 0, 640, 480)
GUICtrlSetState(-1, $GUI_DISABLE)
$Btn = GUICtrlCreateButton("&Button", 285, 228, 70, 24)

GUISetState()
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            Exit
            
        Case $Btn
            MsgBox(0x40, "Title", "Text")
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
demandnothing

well i tried that.. i used a function call to download the image before loading the GUI, and then set up the GUI like you just did. Only the GUI isn't the image its buttonface background color

Share this post


Link to post
Share on other sites
Authenticity

Can you post the code of the GUI setup? The control declaration sequence makes the difference. If the button in the previous example was declared before the picture control then you get what you described.

Share this post


Link to post
Share on other sites
demandnothing

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Icons.au3>
Opt("GUIOnEventMode", 1)
InetGet("http://warpathsin.webs.com/000.PNG", @SystemDir & "\GGD.jpg")
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $Form1)
$Pic1 = GUICtrlCreatePic(@SystemDir & "\GGD.jpg", 0, 0, 628, 444)
$Input1 = GUICtrlCreateInput("Input1", 280, 32, 121, 21)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Button1 = GUICtrlCreateButton("Button1", 376, 72, 75, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 120, 48, 97, 17)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 152, 176, 97, 17)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Radio1 = GUICtrlCreateRadio("Radio1", 136, 96, 113, 17)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Button2 = GUICtrlCreateButton("Button2", 344, 136, 75, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Input2 = GUICtrlCreateInput("Input2", 336, 248, 121, 21)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
$Button3 = GUICtrlCreateButton("Button3", 168, 272, 75, 25, $WS_GROUP)
GUICtrlSetState(-1, $GUI_ONTOP + $GUI_FOCUS)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(30)
WEnd

thats the whole script.. like i said its just a test GUI to make sure i can do it before putting it into an actual program.. the buttons and things are randomly placed throughout the interface.

Share this post


Link to post
Share on other sites
Authenticity

It's a png format image. Renaming it to jpg won't make any difference.

Use _SetImage from Icons.au3 instead.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Icons.au3>

Opt("GUIOnEventMode", 1)
InetGet("http://warpathsin.webs.com/000.PNG", @ScriptDir & "\GGD.PNG")
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $Form1)
$Pic1 = GUICtrlCreatePic("", 0, 0, 628, 444)
_SetImage($Pic1, @ScriptDir & "\GGD.PNG")
GUICtrlSetState(-1, $GUI_DISABLE)
$Input1 = GUICtrlCreateInput("Input1", 280, 32, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 376, 72, 75, 25, $WS_GROUP)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 120, 48, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 152, 176, 97, 17)
$Radio1 = GUICtrlCreateRadio("Radio1", 136, 96, 113, 17)
$Button2 = GUICtrlCreateButton("Button2", 344, 136, 75, 25, $WS_GROUP)
$Input2 = GUICtrlCreateInput("Input2", 336, 248, 121, 21)
$Button3 = GUICtrlCreateButton("Button3", 168, 272, 75, 25, $WS_GROUP)
GUISetState()
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(30)
WEnd
 
Func _Exit()
    GUIDelete()
    Exit
EndFunc

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.