Sign in to follow this  
Followers 0
jennico

overlapping labels - how to z-order them ?

8 posts in this topic

two labels are behind two top labels. when you click the overlapping region, the underlying label responses. is there any way to get the right label respond ?

$Form1 = GUICreate("AForm1", 420, 182, -1, -1)
$BackLeft = GUICtrlCreateLabel("BackLeft", 48, 56, 100, 100)
GUICtrlSetBkColor(-1, 0x800000)
$BackRight = GUICtrlCreateLabel("BackRight", 224, 56, 100, 100)
GUICtrlSetBkColor(-1, 0x0000FF)
$FrontRight = GUICtrlCreateLabel("FrontRight", 280, 24, 100, 100)
GUICtrlSetBkColor(-1, 0xA6CAF0)
$FrontLeft = GUICtrlCreateLabel("FrontLeft", 96, 25, 100, 100)
GUICtrlSetBkColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
            Exit
        Case $BackLeft
            MsgBox(0,"","Back Left")
        Case $BackRight
            MsgBox(0,"","Back Right")
        Case $FrontLeft
            MsgBox(0,"","Front Left")
        Case $FrontRight
            MsgBox(0,"","Front Right")
    EndSwitch
WEnd

(example taken from an older thread)

any help will be appreciated.

j.


Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites



two labels are behind two top labels. when you click the overlapping region, the underlying label responses. is there any way to get the right label respond ?

$Form1 = GUICreate("AForm1", 420, 182, -1, -1)
$BackLeft = GUICtrlCreateLabel("BackLeft", 48, 56, 100, 100)
GUICtrlSetBkColor(-1, 0x800000)
$BackRight = GUICtrlCreateLabel("BackRight", 224, 56, 100, 100)
GUICtrlSetBkColor(-1, 0x0000FF)
$FrontRight = GUICtrlCreateLabel("FrontRight", 280, 24, 100, 100)
GUICtrlSetBkColor(-1, 0xA6CAF0)
$FrontLeft = GUICtrlCreateLabel("FrontLeft", 96, 25, 100, 100)
GUICtrlSetBkColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
            Exit
        Case $BackLeft
            MsgBox(0,"","Back Left")
        Case $BackRight
            MsgBox(0,"","Back Right")
        Case $FrontLeft
            MsgBox(0,"","Front Left")
        Case $FrontRight
            MsgBox(0,"","Front Right")
    EndSwitch
WEndoÝ÷ ÙìZ^µ©úè©è׫¶Þi֧ʥ§¥·¦Þr&­yØÿªê-x  ݶ¬Â䱫­¢+ØÀÌØí½É´ÄôU%
ÉÑ ÅÕ½Ðí½É´ÄÅÕ½Ðì°ÐÈÀ°ÄàÈ°´Ä°´Ä¤((ÀÌØíɽ¹Ñ1ÑôU%
Ñɱ
ÉÑ1° ÅÕ½Ðíɽ¹Ñ1ÐÅÕ½Ðì°äØ°ÈÔ°ÄÀÀ°ÄÀÀ¤ì ¡¥¹)U%
ÑɱMÑ   ­
½±½È ´Ä°ÁáÀÀÀÀ¤((ÀÌØí ­1ÐôU%
Ñɱ
ÉÑ1° ÅÕ½Ðí  ­1ÐÅÕ½Ðì°Ðà°ÔØ°ÄÀÀ°ÄÀÀ¤)U%
ÑɱMÑ   ­
½±½È ´Ä°ÁààÀÀÀÀÀ¤((ÀÌØíɽ¹ÑI¥¡ÑôU%
Ñɱ
ÉÑ1° ÅÕ½Ðíɽ¹ÑI¥¡ÐÅÕ½Ðì°ÈàÀ°ÈаÄÀÀ°ÄÀÀ¤ì   ¡¥¹)U%
ÑɱMÑ   ­
½±½È ´Ä°ÁáÙ
À¤((ÀÌØí  ­I¥¡ÐôU%
Ñɱ
ÉÑ1° ÅÕ½Ðí  ­I¥¡ÐÅÕ½Ðì°ÈÈаÔØ°ÄÀÀ°ÄÀÀ¤)U%
ÑɱMÑ   ­
½±½È ´Ä°ÁàÀÀÀÁ¤(ÀÌØíɽ¹ÑI¥¡ÐôU%
Ñɱ
ÉÑ1° ÅÕ½Ðíɽ¹ÑI¥¡ÐÅÕ½Ðì°ÈàÀ°ÈаÄÀÀ°ÄÀÀ¤)U%
ÑɱMÑ   ­
½±½È ´Ä°ÁáÙ
À¤(ÀÌØíɽ¹Ñ1ÐôU%
Ñɱ
ÉÑ1° ÅÕ½Ðíɽ¹Ñ1ÐÅÕ½Ðì°äØ°ÈÔ°ÄÀÀ°ÄÀÀ¤)U%
ÑɱMÑ   ­
½±½È ´Ä°ÁáÀÀÀÀ¤()U%MÑMÑÑ¡M]}M!=¤()]¡¥±Ä($ÀÌØí¹5ÍôU%Ñ5Í ¤(%MÝ¥Ñ ÀÌØí¹5Í($%
Í´Ì($$%á¥Ð($%
ÍÀÌØí  ­1Ð($$%5Í    ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí   ¬1ÐÅÕ½Ðì¤($%
ÍÀÌØí  ­I¥¡Ð($$%5Í    ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí   ¬I¥¡ÐÅÕ½Ðì¤($%
ÍÀÌØíɽ¹Ñ1аÀÌØíɽ¹Ñ1Ñ($$%5Í   ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðíɽ¹Ð1ÐÅÕ½Ðì¤($%
ÍÀÌØíɽ¹ÑI¥¡Ð°ÀÌØíɽ¹ÑI¥¡Ñ($$%5Í   ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðíɽ¹ÐI¥¡ÐÅÕ½Ðì¤(%¹MÝ¥Ñ )]¹

Share this post


Link to post
Share on other sites

jennico

Use a WS_CLIPSIBLINGS style:

#include <WindowsConstants.au3>

$Form1 = GUICreate("AForm1", 420, 182, -1, -1)

$FrontRight = GUICtrlCreateLabel("FrontRight", 280, 24, 100, 100)
GUICtrlSetBkColor(-1, 0xA6CAF0)

$FrontLeft = GUICtrlCreateLabel("FrontLeft", 96, 25, 100, 100)
GUICtrlSetBkColor(-1, 0xFF0000)

$BackLeft = GUICtrlCreateLabel("BackLeft", 48, 56, 100, 100, $WS_CLIPSIBLINGS)
GUICtrlSetBkColor(-1, 0x800000)

$BackRight = GUICtrlCreateLabel("BackRight", 224, 56, 100, 100, $WS_CLIPSIBLINGS)
GUICtrlSetBkColor(-1, 0x0000FF)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
            Exit
        Case $BackLeft
            MsgBox(0,"","Back Left")
        Case $BackRight
            MsgBox(0,"","Back Right")
        Case $FrontLeft
            MsgBox(0,"","Front Left")
        Case $FrontRight
            MsgBox(0,"","Front Right")
    EndSwitch
WEnd

:)

Share this post


Link to post
Share on other sites

I sure wish I knew about that when I created this keyboard in 2005

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

$Logo_icon = @HomeDrive & "\Temp\XPClean-Icon1.ico"
FileInstall("C:\XPClean-web\Settings\XPClean-pics\XPClean-Main-Pic-Icon1.ico", $Logo_icon)

$Logo1_icon = @TempDir & "\Toy-Icon1.ico"
FileInstall("C:\XPClean-web\Settings\XPClean-pics\Toy-box-Icon1.ico", $Logo1_icon)

$Ver = "1.0"
Dim $QT_web = "www.XPCleanMenu.HostRocket.com"



;~;--------------above is in *XPClean Menu* -----------------
Dim $Rad = "", $P_T = "Short", $P_T_1 = "200"

#Region --- GuiBuilder code Start --->>>>>>>>>>>>>>>>>>>>>>>>>>>   THANK YOU  GUI-BUILDER

$Organ = GUICreate("         Toy BOX   -  ORGANized                                                              Version " & $Ver, 897, 325, (@DesktopWidth - 897) / 2, (@DesktopHeight - 325) / 2);, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
GUISetBkColor("")
GUISetFont(9, 400, -1, "MS Sans Serif")

GUICtrlSetColor(-1, 0xff0000)
GUISetIcon($Logo1_icon)

; main radio buttons
GUIStartGroup()

$Label_M1 = GUICtrlCreateLabel("The Music Machine", 30, 20, 160, 20)
GUICtrlSetFont(-1, 12, 5000)
GUICtrlSetColor(-1, 0x8080ff)
$Button_P = GUICtrlCreateButton("Play Song", 10, 230, 70, 20)

; sound duration
$NotePlay = GUICtrlCreateCombo("Note Play", 5, 270, 90)
GUICtrlSetData(-1, "Short")
GUICtrlSetData(-2, "Medium")
GUICtrlSetData(-3, "Long")
$Label_S1 = GUICtrlCreateLabel("Duration", 20, 300, 80, 20)
GUICtrlSetFont(-1, 10, 10)
GUICtrlSetColor(-1, 0x8080ff)

;Upper buttons
$Button_1 = GUICtrlCreateLabel("Button26", 130, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetCursor(-1, 0)
$Button_2 = GUICtrlCreateLabel("Button27", 180, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetCursor(-1, 0)
$Button_3 = GUICtrlCreateLabel("Button28", 230, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetCursor(-1, 0)
$Button_4 = GUICtrlCreateLabel("Button29", 330, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetCursor(-1, 0)
$Button_5 = GUICtrlCreateLabel("Button30", 380, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetCursor(-1, 0)
$Button_6 = GUICtrlCreateLabel("Button31", 480, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetCursor(-1, 0)
$Button_7 = GUICtrlCreateLabel("Button32", 530, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetCursor(-1, 0)
$Button_8 = GUICtrlCreateLabel("Button33", 580, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetCursor(-1, 0)
$Button_9 = GUICtrlCreateLabel("Button34", 680, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetCursor(-1, 0)
$Button_10 = GUICtrlCreateLabel("Button35", 730, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetCursor(-1, 0)
; Lower buttons
$Button_11 = GUICtrlCreateLabel("Button11", 100, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_12 = GUICtrlCreateLabel("Button12", 150, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_13 = GUICtrlCreateLabel("Button13", 200, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_14 = GUICtrlCreateLabel("Button14", 250, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_15 = GUICtrlCreateLabel("Button15", 300, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_16 = GUICtrlCreateLabel("Button16", 350, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_17 = GUICtrlCreateLabel("Button17", 400, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_18 = GUICtrlCreateLabel("Button18", 450, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_19 = GUICtrlCreateLabel("Button19", 500, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_20 = GUICtrlCreateLabel("Button20", 550, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_21 = GUICtrlCreateLabel("Button21", 600, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_22 = GUICtrlCreateLabel("Button22", 650, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_23 = GUICtrlCreateLabel("Button23", 700, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
$Button_24 = GUICtrlCreateLabel("Button24", 750, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
GUICtrlSetCursor(-1, 0)
;Upper buttons
$utton_1 = GUICtrlCreateLabel("Button26", 130, 50, 40, 170, $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, "")
$utton_2 = GUICtrlCreateLabel("Button27", 180, 50, 40, 170, $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, "")
$utton_3 = GUICtrlCreateLabel("Button28", 230, 50, 40, 170, $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, "")
$utton_4 = GUICtrlCreateLabel("Button29", 330, 50, 40, 170, $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, "")
$utton_5 = GUICtrlCreateLabel("Button30", 380, 50, 40, 170, $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, "")
$utton_6 = GUICtrlCreateLabel("Button31", 480, 50, 40, 170, $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, "")
$utton_7 = GUICtrlCreateLabel("Button32", 530, 50, 40, 170, $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, "")
$utton_8 = GUICtrlCreateLabel("Button33", 580, 50, 40, 170, $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, "")
$utton_9 = GUICtrlCreateLabel("Button34", 680, 50, 40, 170, $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, "")
$utton_10 = GUICtrlCreateLabel("Button35", 730, 50, 40, 170, $SS_SUNKEN + $SS_CENTER, $WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, "")


$Button_A3 = GUICtrlCreateButton("Close Menu", 810, 190, 70, 20)
$Button_A5 = GUICtrlCreateButton("QT Appraisal", 810, 230, 70, 20)
$Button_QT = GUICtrlCreateButton("QT", 825, 265, 35, 35, $BS_ICON)
GUICtrlSetImage(-1, $Logo_icon)
GUICtrlSetTip(-1, "Check New Releases")

GUISetState()
GUISetBkColor("")
Call("Set_Music")

While 1
    $msg = GUIGetMsg()
    $P_timer = GUICtrlRead($NotePlay)
    If $P_timer <> $P_T Then
        $P_T = $P_timer
        If $P_T = "Short" Then $P_T_1 = "200"
        If $P_T = "Medium" Then $P_T_1 = "400"
        If $P_T = "Long" Then $P_T_1 = "600"
    EndIf
    If $msg = $GUI_EVENT_CLOSE Or $msg = $Button_A3 Then ExitLoop
    If $msg = $Button_A5 Then
        Call("Set_QT")
    EndIf
    If $msg = $Button_QT Then
        Call("Set_Update")
    EndIf
WEnd
Exit
#EndRegion --- GuiBuilder code Start --->>>>>>>>>>>>>>>>>>>>>>>>>>>   THANK YOU  GUI-BUILDER

;------------------------Functions -------------------
Func Set_Music()

    While 2
        $P_timer = GUICtrlRead($NotePlay)
        If $P_timer <> $P_T Then
            $P_T = $P_timer
            If $P_T = "Short" Then $P_T_1 = "200"
            If $P_T = "Medium" Then $P_T_1 = "400"
            If $P_T = "Long" Then $P_T_1 = "600"
        EndIf
        $M_ans = GUIGetMsg()
        Select
            Case $M_ans = $GUI_EVENT_CLOSE Or $M_ans = $Button_A3
                Exit
            Case $M_ans = $Button_A5
                Call("Set_QT")
            Case $M_ans = $Button_QT
                Call("Set_Update")
            Case $M_ans = $Button_P
                Call("Play_Joy")
            Case $M_ans = $Button_11
                GUICtrlSetImage($Button_11, "shell32.dll", 168)
                Beep(100, $P_T_1)
            Case $M_ans = $Button_12
                Beep(200, $P_T_1)
            Case $M_ans = $Button_13
                Beep(300, $P_T_1)
            Case $M_ans = $Button_14
                Beep(400, $P_T_1)
            Case $M_ans = $Button_15
                Beep(500, $P_T_1)
            Case $M_ans = $Button_16
                Beep(600, $P_T_1)
            Case $M_ans = $Button_17
                Beep(700, $P_T_1)
            Case $M_ans = $Button_18
                Beep(800, $P_T_1)
            Case $M_ans = $Button_19
                Beep(900, $P_T_1)
            Case $M_ans = $Button_20
                Beep(1000, $P_T_1)
            Case $M_ans = $Button_21
                Beep(1100, $P_T_1)
            Case $M_ans = $Button_22
                Beep(1200, $P_T_1)
            Case $M_ans = $Button_23
                Beep(1300, $P_T_1)
            Case $M_ans = $Button_24
                Beep(1400, $P_T_1)
            Case $M_ans = $Button_1
                Beep(150, $P_T_1)
            Case $M_ans = $Button_2
                Beep(250, $P_T_1)
            Case $M_ans = $Button_3
                Beep(350, $P_T_1)
            Case $M_ans = $Button_4
                Beep(550, $P_T_1)
            Case $M_ans = $Button_5
                Beep(650, $P_T_1)
            Case $M_ans = $Button_6
                Beep(850, $P_T_1)
            Case $M_ans = $Button_7
                Beep(950, $P_T_1)
            Case $M_ans = $Button_8
                Beep(1050, $P_T_1)
            Case $M_ans = $Button_9
                Beep(1250, $P_T_1)
            Case $M_ans = $Button_10
                Beep(1350, $P_T_1)
        EndSelect
        ;If BitAND(GUICtrlRead($Radio_L2), $GUI_CHECKED) = $GUI_CHECKED Then ExitLoop
    WEnd
EndFunc   ;==>Set_Music

Func Set_Menu()
    MsgBox(0, "Sorry", "This is a Test Only Program ")
    Sleep(2500)
EndFunc   ;==>Set_Menu

Func Play_Joy()
    ; PLease use this format inside a Func for your Music to be included (or improve-it) , Thanks
    Beep(1200, 700)
    Beep(1100, 400)
    Beep(1000, 300)
    Beep(900, 700)
    Sleep(50)
    Beep(800, 400)
    Beep(700, 700)
    Beep(600, 600)
    Beep(500, 700)
    Sleep(100)
    Beep(600, 600)
    Beep(700, 600)
    Sleep(80)
    Beep(800, 400)
    Beep(900, 700)
    Sleep(80)
    Beep(1000, 400)
    Beep(1130, 800)
EndFunc   ;==>Play_Joy

; ----------------- Below included in *XPClean Menu* -------------------------------

Func Set_QT()
    $iMsgBoxAnswer = MsgBox(32, "*XPClean Menu* ,  by   Q.T. APPRAISAL SERVICE", "WHO IS,  QT APPRAISAL SERVICE ?" & @CRLF & "" & @CRLF & "We are a Real Estate Appraisal Company based in Riverside, California. We spend hours upon hours researching various internet sites, sending and receiving e-mails, downloading and uploading large appraisal files, digital maps; photos; signatures and more. For this, our network of computers are connected to the internet at all times and are vulnerable to many types of attacks. Our computers are cluttered with files, cookies, downloads, temporary files, recently old files, digitally compulated files, e-mails, etc combined with virus attacks, attached adware creating pop-up ads and spyware tracking our usage. " & @CRLF & "" & @CRLF & "Thus, I have spent hours cleaning and tuning-up our computer system and have finally designed a menu system to manage these great clean-up and tune-up programs" & @CRLF & "" & @CRLF & "... I just thought you might appreciate and benefit from all of my efforts." & @CRLF & "" & @CRLF & "" & @CRLF & "" & @CRLF & "", 60)
    Select
        Case $iMsgBoxAnswer = -1;Timeout
    EndSelect
EndFunc   ;==>Set_QT

Func Set_Update()
    Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe " & $QT_web)
    Sleep(2000)
EndFunc   ;==>Set_Update

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Just for clarification(?) the control are created with the last ones being at the bottom.

$WS_CLIPSIBLING is just doing part of the job for the appeareance not for the clicking.

you need to use GUICtrlSetState(-1, $GUI_ONTOP)

see the following which work if you uncomment them.

#include <WindowsConstants.au3>
#include <GUIConstants.au3>

$Form1 = GUICreate("AForm1", 420, 182, -1, -1)

$BackLeft = GUICtrlCreateLabel("BackLeft", 48, 56, 100, 100, $WS_CLIPSIBLINGS)
GUICtrlSetBkColor(-1, 0x800000)

$BackRight = GUICtrlCreateLabel("BackRight", 224, 56, 100, 100, $WS_CLIPSIBLINGS)
GUICtrlSetBkColor(-1, 0x0000FF)

$FrontRight = GUICtrlCreateLabel("FrontRight", 280, 24, 100, 100)
;GUICtrlSetState(-1,$GUI_ONTOP)
GUICtrlSetBkColor(-1, 0xA6CAF0)

$FrontLeft = GUICtrlCreateLabel("FrontLeft", 96, 25, 100, 100)
;GUICtrlSetState(-1,$GUI_ONTOP)
GUICtrlSetBkColor(-1, 0xFF0000)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
            Exit
        Case $BackLeft
            MsgBox(0,"","Back Left")
        Case $BackRight
            MsgBox(0,"","Back Right")
        Case $FrontLeft
            MsgBox(0,"","Front Left")
        Case $FrontRight
            MsgBox(0,"","Front Right")
    EndSwitch
WEnd
Edited by jpm

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

thank you all for your very competent help !!! :):)

i tried clipsiblings and ontop before, but i never combined them. that makes the clue.

now the second, advanced part of my problem:

#include <WindowsConstants.au3>
#include <GUIConstants.au3>

$Form1 = GUICreate("AForm1", 420, 182, -1, -1)

$BackLeft = GUICtrlCreateLabel("BackLeft", 48, 56, 100, 100, $WS_CLIPSIBLINGS)
GUICtrlSetBkColor(-1, 0x800000)

$BackRight = GUICtrlCreateLabel("BackRight", 150, 56, 100, 100, $WS_CLIPSIBLINGS)
GUICtrlSetBkColor(-1, 0x0000FF)

$FrontRight = GUICtrlCreateLabel("FrontRight", 280, 24, 100, 100)
GUICtrlSetState(-1,$GUI_ONTOP)
GUICtrlSetBkColor(-1, 0xA6CAF0)

$FrontLeft = GUICtrlCreateLabel("FrontLeft", 96, 25, 100, 100)
GUICtrlSetState(-1,$GUI_ONTOP)
GUICtrlSetBkColor(-1, 0xFF0000)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    $info= GUIGetCursorInfo($form1)
    If not @error then WinSetTitle($form1,"",$info[4])
    Switch $nMsg
        Case -3
            Exit
        Case $BackLeft
            MsgBox(0,"","Back Left")
        Case $BackRight
            MsgBox(0,"","Back Right")
        Case $FrontLeft
            MsgBox(0,"","Front Left")
        Case $FrontRight
            MsgBox(0,"","Front Right")
    EndSwitch
WEnd
Edited by jennico

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Share this post


Link to post
Share on other sites

now the second, advanced part of my problem:

Hmm.. looks a bug. Try this:

#include <WindowsConstants.au3>
#include <GUIConstants.au3>

Global $TimerProcHandle = DllCallbackRegister("_TimerProc", "none", "hwnd;int;int;dword")
Global $hWnd_Last

$Form1 = GUICreate("AForm1", 420, 182, -1, -1)

$BackLeft = GUICtrlCreateLabel("BackLeft", 48, 56, 100, 100, $WS_CLIPSIBLINGS)
GUICtrlSetBkColor(-1, 0x800000)

$BackRight = GUICtrlCreateLabel("BackRight", 150, 56, 100, 100, $WS_CLIPSIBLINGS)
GUICtrlSetBkColor(-1, 0x0000FF)

$FrontRight = GUICtrlCreateLabel("FrontRight", 280, 24, 100, 100)
GUICtrlSetState(-1, $GUI_ONTOP)
GUICtrlSetBkColor(-1, 0xA6CAF0)

$FrontLeft = GUICtrlCreateLabel("FrontLeft", 96, 25, 100, 100)
GUICtrlSetState(-1, $GUI_ONTOP)
GUICtrlSetBkColor(-1, 0xFF0000)

GUISetState(@SW_SHOW)

Global $TimerCall = DllCall("user32.dll", "int", "SetTimer", "hwnd", 0, "int", 0, "int", 100, _
                            "ptr", DllCallbackGetPtr($TimerProcHandle))
$TimerCall = $TimerCall[0]

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case - 3
            Exit
        Case $BackLeft
            MsgBox(0, "", "Back Left")
        Case $BackRight
            MsgBox(0, "", "Back Right")
        Case $FrontLeft
            MsgBox(0, "", "Front Left")
        Case $FrontRight
            MsgBox(0, "", "Front Right")
    EndSwitch
WEnd

DllCallbackFree($TimerProcHandle)
DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "int", $TimerCall)

Func _TimerProc($hWnd, $Msg, $IdTimer, $dwTime)
    Local $hWnd_From = DllCall("user32.dll", "int", "WindowFromPoint", "int", MouseGetPos(0), "int", MouseGetPos(1))
    If ($hWnd_From[0] <> 0) And ($hWnd_From[0] <> $hWnd_Last) Then
        Local $ctlID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hWnd_From[0])
        If $ctlID[0] Then ConsoleWrite(GUICtrlRead($ctlID[0]) & @LF)
        $hWnd_Last = $hWnd_From[0]
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

thank you rasim. i can use GetDlgCtrlID as a workaround.

i'm not sure if there's a real bug in guigetcursorinfo. at least it doesn't make sense to return the non-top label.

any Dev around ?

j.


Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

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