Sign in to follow this  
Followers 0
VixinG

Event on label click (click on label)

3 posts in this topic

#1 ·  Posted (edited)

Hey,

Here's the code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include "Icons.au3"
$GUI = GUICreate("Station Changer",480,25,0,0,$WS_POPUP+$WS_VISIBLE)
$rainwave = GUICtrlCreatePic('',1,1,0,0)
$all = GUICtrlCreatePic('',110,1,0,0)
$game = GUICtrlCreatePic('',154,1,0,0)
$chiptune = GUICtrlCreatePic('',214,1,0,0)
$covers = GUICtrlCreatePic('',310,1,0,0)
$ocremix = GUICtrlCreatePic('',390,1,0,0)
$rainwave_png = "rainwave.png"
$all_png = "all.png"
$game_png = "game.png"
$chiptune_png = "chiptune.png"
$covers_png = "covers.png"
$ocremix_png = "ocremix.png"
$all_png2 = "all2.png"
$game_png2 = "game2.png"
$chiptune_png2 = "chiptune2.png"
$covers_png2 = "covers2.png"
$ocremix_png2 = "ocremix2.png"
_SetImage($rainwave, $rainwave_png)
_SetImage($all, $all_png)
_SetImage($game, $game_png)
_SetImage($chiptune, $chiptune_png)
_SetImage($covers, $covers_png)
_SetImage($ocremix, $ocremix_png)
$all = GUICtrlCreatePic('',110,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$game = GUICtrlCreatePic('',154,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$chiptune = GUICtrlCreatePic('',214,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$covers = GUICtrlCreatePic('',310,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$ocremix = GUICtrlCreatePic('',390,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$all_label = GUICtrlCreateLabel('',110,1,44,23)
$game_label = GUICtrlCreateLabel('',154,1,60,23)
$chiptune_label = GUICtrlCreateLabel('',214,1,96,23)
$covers_label = GUICtrlCreateLabel('',309,1,81,23)
$ocremix_label = GUICtrlCreateLabel('',390,1,89,23)
GUICtrlSetBkColor($all_label,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($game_label,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($chiptune_label,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($covers_label,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($ocremix_label,$GUI_BKCOLOR_TRANSPARENT)
GUISetState()
Global $vlc = '"'&InputBox("VLC Path","Please type full path to the VLC.exe: ","C:\Program Files\VideoLAN\VLC\vlc.exe","",300,120)&'"'
$all_UnderCursor = False
$game_UnderCursor = False
$chiptune_UnderCursor = False
$covers_UnderCursor = False
$ocremix_UnderCursor = False
While 1
    $msg = GUIGetMsg()
    $cursor = GUIGetCursorInfo()
    If Not @error Then
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $cursor[4] = $all_label And $all_UnderCursor = False
                _SetImage($all,$all_png2)
                $all_UnderCursor = True
            Case $cursor[4] = $game_label And $game_UnderCursor = False
                _SetImage($game,$game_png2)
                $game_UnderCursor = True
            Case $cursor[4] = $chiptune_label And $chiptune_UnderCursor = False
                _SetImage($chiptune,$chiptune_png2)
                $chiptune_UnderCursor = True
            Case $cursor[4] = $covers_label And $covers_UnderCursor = False
                _SetImage($covers,$covers_png2)
                $covers_UnderCursor = True
            Case $cursor[4] = $ocremix_label And $ocremix_UnderCursor = False
                _SetImage($ocremix,$ocremix_png2)
                $ocremix_UnderCursor = True
            Case $cursor[4] <> $all_label And $all_UnderCursor
                _SetImage($all,$all_png)
                $all_UnderCursor = False
            Case $cursor[4] <> $game_label And $game_UnderCursor
                _SetImage($game,$game_png)
                $game_UnderCursor = False
            Case $cursor[4] <> $chiptune_label And $chiptune_UnderCursor
                _SetImage($chiptune,$chiptune_png)
                $chiptune_UnderCursor = False
            Case $cursor[4] <> $covers_label And $covers_UnderCursor
                _SetImage($covers,$covers_png)
                $covers_UnderCursor = False
            Case $cursor[4] <> $ocremix_label And $ocremix_UnderCursor
                _SetImage($ocremix,$ocremix_png)
                $ocremix_UnderCursor = False
   Case $msg = $all_label
    MsgBox(0,"random","label clicked")
    #cs ShellExecute($vlc, FileGetShortName("omniwave.m3u"))
   Case $game_label
    ShellExecute($vlc, FileGetShortName("rainwave.m3u"))
   Case $chiptune_label
    ShellExecute($vlc, FileGetShortName("bitwave.m3u"))
   Case $covers_label
    ShellExecute($vlc, FileGetShortName("mixwave.m3u"))
   Case $ocremix_label
    ShellExecute($vlc, FileGetShortName("ocr_radio.m3u"))
   #ce
        EndSelect
    EndIf
WEnd
Exit

and this completely does not work:

Case $msg = $all_label
    MsgBox(0,"random","label clicked")

I tried also with:

Case $all_label
    MsgBox(0,"random","label clicked")

but after that the label is activating itself for infinite times...

After clicking on label there should appear the msgbox, but it isn't :/

What to do?

I don't know what causes the problem. I attached the stuff if you need.

Solved, thx.

Edited by VixinG

[indent=3][/indent]

Share this post


Link to post
Share on other sites



VixinG,

You are creating the pic controls twice, but only disabling them once, so the label is overlapping with an enabled control. Overlapping active controls confuse AutoIt so you do not get a message. This corrected version works for me: :)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include "Icons.au3"

$GUI = GUICreate("Station Changer",480,25,0,0,$WS_POPUP+$WS_VISIBLE)

; Disable all these controls <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$rainwave = GUICtrlCreatePic('',1,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$all = GUICtrlCreatePic('',110,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$game = GUICtrlCreatePic('',154,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$chiptune = GUICtrlCreatePic('',214,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$covers = GUICtrlCreatePic('',310,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$ocremix = GUICtrlCreatePic('',390,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)

$rainwave_png = "rainwave.png"

$all_png = "all.png"
$game_png = "game.png"
$chiptune_png = "chiptune.png"
$covers_png = "covers.png"
$ocremix_png = "ocremix.png"

$all_png2 = "all2.png"
$game_png2 = "game2.png"
$chiptune_png2 = "chiptune2.png"
$covers_png2 = "covers2.png"
$ocremix_png2 = "ocremix2.png"

_SetImage($rainwave, $rainwave_png)

_SetImage($all, $all_png)
_SetImage($game, $game_png)
_SetImage($chiptune, $chiptune_png)
_SetImage($covers, $covers_png)
_SetImage($ocremix, $ocremix_png)

; And do not create these <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;$all = GUICtrlCreatePic('',110,1,0,0)
;GuiCtrlSetState(-1, $GUI_DISABLE)
;$game = GUICtrlCreatePic('',154,1,0,0)
;GuiCtrlSetState(-1, $GUI_DISABLE)
;$chiptune = GUICtrlCreatePic('',214,1,0,0)
;GuiCtrlSetState(-1, $GUI_DISABLE)
;$covers = GUICtrlCreatePic('',310,1,0,0)
;GuiCtrlSetState(-1, $GUI_DISABLE)
;$ocremix = GUICtrlCreatePic('',390,1,0,0)
;GuiCtrlSetState(-1, $GUI_DISABLE)

$all_label = GUICtrlCreateLabel('',110,1,44,23)
$game_label = GUICtrlCreateLabel('',154,1,60,23)
$chiptune_label = GUICtrlCreateLabel('',214,1,96,23)
$covers_label = GUICtrlCreateLabel('',309,1,81,23)
$ocremix_label = GUICtrlCreateLabel('',390,1,89,23)

GUICtrlSetBkColor($all_label, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($game_label,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($chiptune_label,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($covers_label,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($ocremix_label,$GUI_BKCOLOR_TRANSPARENT)

GUISetState()

Global $vlc = '"'&InputBox("VLC Path","Please type full path to the VLC.exe: ","C:Program FilesVideoLANVLCvlc.exe","",300,120)&'"'

$all_UnderCursor = False
$game_UnderCursor = False
$chiptune_UnderCursor = False
$covers_UnderCursor = False
$ocremix_UnderCursor = False

While 1
    $msg = GUIGetMsg()
    $cursor = GUIGetCursorInfo()
    If Not @error Then
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop

            Case $cursor[4] = $all_label And $all_UnderCursor = False
                _SetImage($all,$all_png2)
                $all_UnderCursor = True

            Case $cursor[4] = $game_label And $game_UnderCursor = False
                _SetImage($game,$game_png2)
                $game_UnderCursor = True

            Case $cursor[4] = $chiptune_label And $chiptune_UnderCursor = False
                _SetImage($chiptune,$chiptune_png2)
                $chiptune_UnderCursor = True

            Case $cursor[4] = $covers_label And $covers_UnderCursor = False
                _SetImage($covers,$covers_png2)
                $covers_UnderCursor = True

            Case $cursor[4] = $ocremix_label And $ocremix_UnderCursor = False
                _SetImage($ocremix,$ocremix_png2)
                $ocremix_UnderCursor = True

            Case $cursor[4] <> $all_label And $all_UnderCursor
                _SetImage($all,$all_png)
                $all_UnderCursor = False

            Case $cursor[4] <> $game_label And $game_UnderCursor
                _SetImage($game,$game_png)
                $game_UnderCursor = False

            Case $cursor[4] <> $chiptune_label And $chiptune_UnderCursor
                _SetImage($chiptune,$chiptune_png)
                $chiptune_UnderCursor = False

            Case $cursor[4] <> $covers_label And $covers_UnderCursor
                _SetImage($covers,$covers_png)
                $covers_UnderCursor = False

            Case $cursor[4] <> $ocremix_label And $ocremix_UnderCursor
                _SetImage($ocremix,$ocremix_png)
                $ocremix_UnderCursor = False

            Case $msg = $all_label
                MsgBox(0,"random","label clicked")

                #cs ShellExecute($vlc, FileGetShortName("omniwave.m3u"))

            Case $game_label
                ShellExecute($vlc, FileGetShortName("rainwave.m3u"))

            Case $chiptune_label
                ShellExecute($vlc, FileGetShortName("bitwave.m3u"))

            Case $covers_label
                ShellExecute($vlc, FileGetShortName("mixwave.m3u"))

            Case $ocremix_label
                ShellExecute($vlc, FileGetShortName("ocr_radio.m3u"))
            #ce
        EndSelect
    EndIf
WEnd

Exit

All clear? ;)

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

#3 ·  Posted (edited)

VixinG,

You are creating the pic controls twice, but only disabling them once, so the label is overlapping with an enabled control. Overlapping active controls confuse AutoIt so you do not get a message. This corrected version works for me: :)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include "Icons.au3"

$GUI = GUICreate("Station Changer",480,25,0,0,$WS_POPUP+$WS_VISIBLE)

; Disable all these controls <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$rainwave = GUICtrlCreatePic('',1,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$all = GUICtrlCreatePic('',110,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$game = GUICtrlCreatePic('',154,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$chiptune = GUICtrlCreatePic('',214,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$covers = GUICtrlCreatePic('',310,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)
$ocremix = GUICtrlCreatePic('',390,1,0,0)
GuiCtrlSetState(-1, $GUI_DISABLE)

$rainwave_png = "rainwave.png"

$all_png = "all.png"
$game_png = "game.png"
$chiptune_png = "chiptune.png"
$covers_png = "covers.png"
$ocremix_png = "ocremix.png"

$all_png2 = "all2.png"
$game_png2 = "game2.png"
$chiptune_png2 = "chiptune2.png"
$covers_png2 = "covers2.png"
$ocremix_png2 = "ocremix2.png"

_SetImage($rainwave, $rainwave_png)

_SetImage($all, $all_png)
_SetImage($game, $game_png)
_SetImage($chiptune, $chiptune_png)
_SetImage($covers, $covers_png)
_SetImage($ocremix, $ocremix_png)

; And do not create these <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;$all = GUICtrlCreatePic('',110,1,0,0)
;GuiCtrlSetState(-1, $GUI_DISABLE)
;$game = GUICtrlCreatePic('',154,1,0,0)
;GuiCtrlSetState(-1, $GUI_DISABLE)
;$chiptune = GUICtrlCreatePic('',214,1,0,0)
;GuiCtrlSetState(-1, $GUI_DISABLE)
;$covers = GUICtrlCreatePic('',310,1,0,0)
;GuiCtrlSetState(-1, $GUI_DISABLE)
;$ocremix = GUICtrlCreatePic('',390,1,0,0)
;GuiCtrlSetState(-1, $GUI_DISABLE)

$all_label = GUICtrlCreateLabel('',110,1,44,23)
$game_label = GUICtrlCreateLabel('',154,1,60,23)
$chiptune_label = GUICtrlCreateLabel('',214,1,96,23)
$covers_label = GUICtrlCreateLabel('',309,1,81,23)
$ocremix_label = GUICtrlCreateLabel('',390,1,89,23)

GUICtrlSetBkColor($all_label, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($game_label,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($chiptune_label,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($covers_label,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($ocremix_label,$GUI_BKCOLOR_TRANSPARENT)

GUISetState()

Global $vlc = '"'&InputBox("VLC Path","Please type full path to the VLC.exe: ","C:Program FilesVideoLANVLCvlc.exe","",300,120)&'"'

$all_UnderCursor = False
$game_UnderCursor = False
$chiptune_UnderCursor = False
$covers_UnderCursor = False
$ocremix_UnderCursor = False

While 1
    $msg = GUIGetMsg()
    $cursor = GUIGetCursorInfo()
    If Not @error Then
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop

            Case $cursor[4] = $all_label And $all_UnderCursor = False
                _SetImage($all,$all_png2)
                $all_UnderCursor = True

            Case $cursor[4] = $game_label And $game_UnderCursor = False
                _SetImage($game,$game_png2)
                $game_UnderCursor = True

            Case $cursor[4] = $chiptune_label And $chiptune_UnderCursor = False
                _SetImage($chiptune,$chiptune_png2)
                $chiptune_UnderCursor = True

            Case $cursor[4] = $covers_label And $covers_UnderCursor = False
                _SetImage($covers,$covers_png2)
                $covers_UnderCursor = True

            Case $cursor[4] = $ocremix_label And $ocremix_UnderCursor = False
                _SetImage($ocremix,$ocremix_png2)
                $ocremix_UnderCursor = True

            Case $cursor[4] <> $all_label And $all_UnderCursor
                _SetImage($all,$all_png)
                $all_UnderCursor = False

            Case $cursor[4] <> $game_label And $game_UnderCursor
                _SetImage($game,$game_png)
                $game_UnderCursor = False

            Case $cursor[4] <> $chiptune_label And $chiptune_UnderCursor
                _SetImage($chiptune,$chiptune_png)
                $chiptune_UnderCursor = False

            Case $cursor[4] <> $covers_label And $covers_UnderCursor
                _SetImage($covers,$covers_png)
                $covers_UnderCursor = False

            Case $cursor[4] <> $ocremix_label And $ocremix_UnderCursor
                _SetImage($ocremix,$ocremix_png)
                $ocremix_UnderCursor = False

            Case $msg = $all_label
                MsgBox(0,"random","label clicked")

                #cs ShellExecute($vlc, FileGetShortName("omniwave.m3u"))

            Case $game_label
                ShellExecute($vlc, FileGetShortName("rainwave.m3u"))

            Case $chiptune_label
                ShellExecute($vlc, FileGetShortName("bitwave.m3u"))

            Case $covers_label
                ShellExecute($vlc, FileGetShortName("mixwave.m3u"))

            Case $ocremix_label
                ShellExecute($vlc, FileGetShortName("ocr_radio.m3u"))
            #ce
        EndSelect
    EndIf
WEnd

Exit

All clear? ;)

M23

Oh yes, thank you Melba :D

I see where my problem was - I am 2 lazy to scroll up and down, so I copied these pic controls, just to see their names, and I forgot to delete them.

Thanks again,

VixinG

Edited by VixinG

[indent=3][/indent]

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