Sign in to follow this  
Followers 0
Brentp

Button doesnt work over image

3 posts in this topic

Hi all,

I have some code which is just a box that has a background image and has some buttons on it, when it runs the buttons are under the background image.

If you hover over where the buttons should be they then appear.

I have tried moving the line $Pic1 = GUICtrlCreatePic("BACKGROUND.BMP", 0, 0, 401, 265)

up the top,

When you run it the buttons are on top of the background, but they are not clickable.

any ideas?

Thanks

$Form1_1 = GUICreate("Selector", 402, 273, 205, 142)
GUISetBkColor(0xFFFFFF)
$Button1 = GUICtrlCreateButton("Button 1", 95, 112, 97, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Button2 = GUICtrlCreateButton("Button 2", 95, 148, 97, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Button3 = GUICtrlCreateButton("Button 3", 95, 183, 97, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Button4 = GUICtrlCreateButton("Button 4", 300, 142, 67, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Pic1 = GUICtrlCreatePic("BACKGROUND.BMP", 0, 0, 401, 265)
GUISetState(@SW_SHOW)

Share this post


Link to post
Share on other sites



Brentp,

If I had a pound for every time I have answered this I would be considerably richer! :rip:

From the Help file:

"If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control [...]: GuiCtrlSetState(-1,$GUI_DISABLE)."

Now you should find it all works as you want: :oops:

#include <GUIConstantsEx.au3>

$Form1_1 = GUICreate("Selector", 402, 273, 205, 142)

$Pic1 = GUICtrlCreatePic("BACKGROUND.BMP", 0, 0, 401, 265)
GUICtrlSetState(-1, $GUI_DISABLE)

$Button1 = GUICtrlCreateButton("Button 1", 95, 112, 97, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Button2 = GUICtrlCreateButton("Button 2", 95, 148, 97, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Button3 = GUICtrlCreateButton("Button 3", 95, 183, 97, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Button4 = GUICtrlCreateButton("Button 4", 300, 142, 67, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")

GUISetState(@SW_SHOW)

While 1
    If GUIGetMsg() = -3 Then Exit
WEnd

All clear? :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thanks M23, Thats what I was after

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