Sign in to follow this  
Followers 0
NELyon

bgimage on a gui?

11 posts in this topic

i got a backgroubd image onn my gui, but how do you make it so the buttons appear over the image? i couldnt find it on koda.

ps: soory for my bad spelling, i sprained my wrist skating :D

Share this post


Link to post
Share on other sites



All you have to do is make sure of two things: one, that the image control is created earlier in the script before all other controls that show up in the GUI, and two, that the image control is disabled using GuiCtrlSetState().


Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

k. thanks

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 779, 544, 183, 110, -1, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xC0DCC0)
$Button1 = GUICtrlCreateButton("AButton1", 16, 16, 41, 41)
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Owner\My Documents\My Pictures\Nicks\k06\k06ke.GIF", 16, 16, 41, 41)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button1
        Run("kexplorer.exe")
    EndSelect
WEnd
Exit

any idea why when i mouse-over the pic, the button comes over the pic? so i can't see it?

Share this post


Link to post
Share on other sites

bump

does anyone know why this is making the button go over the pic when i mouse over?

Share this post


Link to post
Share on other sites

Move the creat button line to after the pic line

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 779, 544, 183, 110, -1, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xC0DCC0)
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Owner\My Documents\My Pictures\Nicks\k06\k06ke.GIF", 16, 16, 41, 41)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("AButton1", 16, 16, 41, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button1
        Run("kexplorer.exe")
    EndSelect
WEnd
Exit


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

now the pic doesen't show up at all XD

Share this post


Link to post
Share on other sites

now the pic doesen't show up at all XD

That is because it is the same size and position of the button.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

I don't think it's easily possible to "hide" a button underneath a picture, if that's what you're trying to do. However, it's quite simple to make a button display a picture, which would accomplish essentially the same thing. See the $BS_BITMAP style and GUICtrlSetImage (might have to fiddle with a few other button styles to make it look right).

Share this post


Link to post
Share on other sites

Now i got this:

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("Koontz 06", @DESKTOPWIDTh - 5, @DesktopHeight - 55, 0, 0, -1, $WS_EX_TOOLWINDOW)
$pict = GUICtrlCreatePic("k06bg.bmp", 0, 0, @DEsktopWidth - 5, @Desktopheight - 55)
GUICtrlSetState($pict, @SW_DISABLE)
$Button1 = GUICtrlCreateButton("KE", 17, 17, 39, 39, $BS_BITMAP)
$Pic1 = GUICtrlSetImage($Button1, "C:\Documents and Settings\Owner\My Documents\My Pictures\Nicks\k06\k06ke.bmp")
$Button2 = GUICtrlCreateButton("Edit", 17, 59, 39, 39, $BS_BITMAP)
GUICtrlSetImage($Button2, "se.bmp")
GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button1
        Run("kexplorer.exe")
    Case $msg = $Button2
        Run("simpleEdit.exe")
    EndSelect
WEnd
Exit

But the buttons aren't clickable! I set it before the buttons, and disabled it but i can't click them!

ow, my wrist...

Share this post


Link to post
Share on other sites

codemyster, your first job in debugging this script is to find the lines that are most likely to be the cause of the problem. In the code below, I have predefined your variables, gotten rid of some control styles that might not be working right for the lack of a needed Include file perhaps, and formatted the code to make it a little easier for you to read, and used variables where they have worked better for me in the past than inline calculations. Also, I made the window pic to be smaller in order to account for the window frame and title bar (subtract about 30 px for the latter). See if this code works, or just zip all the image files and attach them to this post so we can see better what you are working with. And can't a copy of all those pics go in the same directory? Are the pix for the buttons, small enough? If the following code works, copy lines, one line at a time, right below the ones I've changed, comment the copies out one line at a time with ";" and undo my changes one at a time, testing your buttons in between each try. If you are using SciTe, remember, you can just hit Ctrl-F5 to launch the beta or Ctrl-F5 for the production version. :D

#include <GUIConstants.au3>
; == GUI generated with Koda ==
Global $Form1, $pict, $Button1, $Pic1, $Button2, $msg
Global $x_coord, $y_coord, $my_WorkDir
Global $my_Width, $my_Height

$my_Width = @DesktopWidth - 5
$my_Height = @DesktopHeight - 55
$Form1 = GUICreate("Koontz 06", $my_Width, $my_Height);, 0, 0, -1, $WS_EX_TOOLWINDOW)

$x_coord = @DesktopWidth - 11
$y_coord = @Desktopheight - 85
$pict = GUICtrlCreatePic("k06bg.bmp", 0, 0, $x_coord, $y_coord)
GUICtrlSetState($pict, @SW_DISABLE)

$Button1 = GUICtrlCreateButton("KE", 17, 17, 39, 39, BitOr($GUI_SS_DEFAULT_BUTTON, $BS_BITMAP))
;$Button1 = GUICtrlCreateButton("KE", 17, 17, 39, 39, $BS_BITMAP)
$my_WorkDir = @ScriptDir
FileChangeDir("C:\Documents and Settings\Owner\My Documents\My Pictures\Nicks\k06")
$Pic1 = GUICtrlSetImage($Button1, "k06ke.bmp")
FileChangeDir($my_WorkDir)

$Button2 = GUICtrlCreateButton("Edit", 17, 59, 39, 39, BitOr($GUI_SS_DEFAULT_BUTTON, $BS_BITMAP))
;$Button2 = GUICtrlCreateButton("Edit", 17, 59, 39, 39, $BS_BITMAP)
GUICtrlSetImage($Button2, "se.bmp")

Sleep(1800)
GUISetState(@SW_SHOW, $Form1)

While 1

    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
        
    Case $msg = $Button1
        Run("kexplorer.exe")
        
    Case $msg = $Button2
        Run("simpleEdit.exe")
        
    EndSelect
    Sleep(20)
    
WEnd

Exit

Das Häschen benutzt Radar

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