Sign in to follow this  
Followers 0
seres

Label not ontop after event

3 posts in this topic

im having trouble with the labael staying ontop:

1. when i double click on button one

2.after i click button 1 and click button 2 label goes to the bottom 

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

$Form1 = GUICreate("Form1", 615, 470, 192, 124)
$Label1 = GUICtrlCreateLabel("", 16, 392, 588, 60)
GUICtrlSetBkColor(-1, 0xA6CAF0)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("Button1", 96, 160, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 96, 240, 75, 25)
$Button3 = GUICtrlCreateButton("Button3", 48, 408, 75, 25)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
;~          GUICtrlSetData($Label1,"Label is on top ")
            $Pic1 = GUICtrlCreatePic("C:\Users\a2mO5dd_460s.jpg", 344, 40, 212, 404)

;~     GUICtrlSetData($Label1,"Label is on top ")
;~     GUICtrlSetData($Label1,"Label is on top ")
;~     GUICtrlSetData($Label1,"Label is on top ")
        Case $Button2
            GUICtrlSetData($Label1,"Label is on top ")
            GUICtrlSetData($Label1,"Label is on top ")

    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites



Create the pic control first, otherwise you'll have to change the z ordering of your controls that should be above the picture. (Which is a lot more work than just moving the picture control)

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

$Form1 = GUICreate("Form1", 615, 470, 192, 124)
$Pic1 = GUICtrlCreatePic("C:\Users\a2mO5dd_460s.jpg", 1000, 0, 212, 404)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label1 = GUICtrlCreateLabel("", 16, 392, 588, 60)
GUICtrlSetBkColor(-1, 0xA6CAF0)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("Button1", 96, 160, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 96, 240, 75, 25)
$Button3 = GUICtrlCreateButton("Button3", 48, 408, 75, 25)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
;~          GUICtrlSetData($Label1,"Label is on top ")
            GUICtrlSetPos($Pic1, 344, 40)

;~     GUICtrlSetData($Label1,"Label is on top ")
;~     GUICtrlSetData($Label1,"Label is on top ")
;~     GUICtrlSetData($Label1,"Label is on top ")
        Case $Button2
            GUICtrlSetData($Label1,"Label is on top ")
            GUICtrlSetData($Label1,"Label is on top ")

    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites
3 hours ago, InunoTaishou said:

Create the pic control first, otherwise you'll have to change the z ordering of your controls that should be above the picture. (Which is a lot more work than just moving the picture control)

 

hello, thanks for your answer it worked at first but then i realize i have to load more pictures and i cannot declare all of them at the beginning, i tried to to find a way with the code you gave me but nothing, i found in another post that melba suggested a child Gui, i was wondering if is this the best way to do this or is the a way to change the ordering of the controls??

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



$Form1 = GUICreate("Form1", 615, 470, 192, 124)
$Pic1 = GUICtrlCreatePic("C:\Users\luis\Desktop\a2mO5dd_460s.jpg", 1000, 0, 212, 404)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label1 = GUICtrlCreateLabel("", 16, 392, 588, 60)
GUICtrlSetBkColor(-1, 0xA6CAF0)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("Button1", 96, 160, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 96, 240, 75, 25)
$Button3 = GUICtrlCreateButton("Button3", 48, 408, 75, 25)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ConsoleWrite($Pic1)
                GUICtrlSetPos($Pic1, 344, 40)

        Case $Button2
            GUICtrlSetData($Label1,"Label is on top ")
            GUICtrlDelete($Pic1)

        Case $Button3
            $Pic1 =GUICtrlCreatePic("C:\Users\luis\Desktop\aOVj4e6_460s_v1.jpg", 1000, 0, 212, 404)
            GUICtrlSetPos($Pic1, 300, 40)

    EndSwitch
WEnd

 

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