Sign in to follow this  
Followers 0
Achilles

Question about labels

6 posts in this topic

#include <GUIConstants.au3>
GUICreate("Weird", 120, 120) 
$that = GUICtrlCreateLabel ("That", 10, 10, 100, 100, $SS_CENTER, $WS_EX_STATICEDGE)         
$this = GUICtrlCreateLabel("This", 40, 40, 40, 40, $SS_CENTER, $WS_EX_STATICEDGE)

GUISetState ()

While 1
    $msg = GUIGetMsg()
    If $msg = $this then Msgbox(0, '', 'This') 
    If $msg = $that then Msgbox(0, '', 'That')
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

I want to be able to click on the 'This' label without having to disable the 'That' label... any ideas?


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites



This is one way you could do it:

#include <GUIConstants.au3>
Opt("MouseCoordMode",2);relative coords to the client area of the active window
GUICreate("Weird", 120, 120)
$that = GUICtrlCreateLabel ("That", 10, 10, 100, 100, $SS_CENTER, $WS_EX_STATICEDGE)         
$this = GUICtrlCreateLabel("This", 40, 40, 40, 40, $SS_CENTER, $WS_EX_STATICEDGE)

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $that then 
        $ai_MouseCord = MouseGetPos ()
        If $ai_MouseCord[0] >= 40 And $ai_MouseCord[1] >= 40 And $ai_MouseCord[0] <= 80 And  $ai_MouseCord[1] <= 80 Then
            Msgbox(0, '', 'This')
        Else
            Msgbox(0, '', 'That')
        EndIf
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Not exactly a fun way of doing it, but it gets the job done. ;-)

-The Kandie Man


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
GUICreate("Weird", 120, 120)
$that = GUICtrlCreateLabel("That", 10, 10, 100, 100, $SS_SUNKEN)
$this = GUICtrlCreateLabel("This", 40, 40, 40, 40, $SS_SUNKEN, $WS_EX_TRANSPARENT)
GUICtrlSetState(-1, $GUI_ONTOP)

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $this Then MsgBox(0, '', 'This')
    If $msg = $that Then MsgBox(0, '', 'That')
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
GUICreate("Weird", 120, 120) 
$that = GUICtrlCreateLabel ("That", 10, 10, 100, 100, $SS_CENTER, $WS_EX_STATICEDGE)         
$this = GUICtrlCreateLabel("This", 40, 40, 40, 40, $SS_CENTER, $WS_EX_STATICEDGE)

GUISetState ()

While 1
    $msg = GUIGetMsg()
    If $msg = $this then Msgbox(0, '', 'This') 
    If $msg = $that then Msgbox(0, '', 'That')
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

I want to be able to click on the 'This' label without having to disable the 'That' label... any ideas?

Change $SS_CENTER to BitOR($SS_CENTER,$SS_NOTIFY)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
GUICreate("Weird", 120, 120)
$that = GUICtrlCreateLabel("That", 10, 10, 100, 100, $SS_SUNKEN)
$this = GUICtrlCreateLabel("This", 40, 40, 40, 40, $SS_SUNKEN, $WS_EX_TRANSPARENT)
GUICtrlSetState(-1, $GUI_ONTOP)

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $this Then MsgBox(0, '', 'This')
    If $msg = $that Then MsgBox(0, '', 'That')
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
I knew there had to be an easier way. :shocked:

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
GUICreate("Weird", 120, 120)
$that = GUICtrlCreateLabel("That", 10, 10, 100, 100, $SS_SUNKEN)
$this = GUICtrlCreateLabel("This", 40, 40, 40, 40, $SS_SUNKEN, $WS_EX_TRANSPARENT)
GUICtrlSetState(-1, $GUI_ONTOP)

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $this Then MsgBox(0, '', 'This')
    If $msg = $that Then MsgBox(0, '', 'That')
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Thanks, that works perfectly!

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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