Sign in to follow this  
Followers 0
Cha0sBG

how to know when pic is clicked

19 posts in this topic

title says it all ;)


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites



don't know what u just tryed to explain but ...


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites

The same way you know if any control is clicked. You give the control a variable name, then check the GUIGetMsg() variable to see if it's been clicked:

$i_pic = GUICtrlCreatePic()

Switch GUIGetMsg()

Case $i_pic

etc...


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

you mean something like this ?

#include <GUiconstantsex.au3>
#include <GUiconstantsex.au3>
#include <Windowsconstants.au3>

$GUI = GUICreate("Win Get Title", 301, 300, -1, -1, BitOR($WS_POPUP, $WS_BORDER))
$PIC = GUICtrlCreatePic("Header.jpg", 0, 0, 301, 20, -1, $GUI_WS_EX_PARENTDRAG)
$Close = GUICtrlCreateLabel("X", 288, 2, 12, 18, -1,$GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1,0xff0000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$min = GUICtrlCreateLabel("_", 275, 0, 12, 18, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1,0xff0000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW)

while 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
            Exit
    Case $min
        GUISetState (@SW_MINIMIZE)
    Case $Close
        Exit
EndSwitch
    WEnd

but kinda with a label and it dousnt respond ;)

in the start i got an idea how to do it but now i totaly messed it up

Edited by Cha0sBG

Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You have to disable the Pic first:

#include <GUiconstantsex.au3>
#include <GUiconstantsex.au3>
#include <Windowsconstants.au3>

$GUI = GUICreate("Win Get Title", 301, 300, -1, -1, BitOR($WS_POPUP, $WS_BORDER))
$PIC = GUICtrlCreatePic("Header.jpg", 0, 0, 301, 20, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetState($PIC, $GUI_DISABLE)
$Close = GUICtrlCreateLabel("X", 288, 2, 12, 20)
GUICtrlSetColor(-1,0xff0000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$min = GUICtrlCreateLabel("_", 275, 0, 12, 20)
GUICtrlSetColor(-1,0xff0000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW)

while 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
            Exit
    Case $min
        GUISetState(@SW_MINIMIZE, $GUI)
    Case $Close
        Exit
    EndSwitch
WEnd

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

but then i whount be able to move the gui ;)((((


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

you can also opt GuiOnEventMode, and just set an event on the control.

for example.

Opt("GUIOnEventMode", 1)
GuiCreate("click the pic", 400, 400, -1, -1)
GuiCtrlCreatePic("1.jpg", 0, 0, 10, 10)
GuiCtrlSetOnEvent(-1, "clickedpic")

While 1
sleep(10)
WEnd

Func ClickedPic()
MsgBox(0, "", "has been clicked")
exit
EndFunc
Edited by Tomb616

Share this post


Link to post
Share on other sites

tomb616 your example isn't working ....gives error ;)


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites

tomb616 your example isn't working ....gives error ;)

well ofcourse it doesnt.

its not the full code.

also needs this at the top.

#Include <GuiConstants.au3>
#Include <WindowsConstants.au3>

Share this post


Link to post
Share on other sites

If GUICtrlCreatePic can't locate "Header.jpg" your in trouble. Check the returned value.

#include <GUiconstantsex.au3>
#include <GUiconstantsex.au3>
#include <Windowsconstants.au3>

$GUI = GUICreate("Win Get Title", 301, 300, -1, -1, BitOR($WS_POPUP, $WS_BORDER))

$PIC = GUICtrlCreatePic("C:\Documents and Settings\Default User\My Documents\My Pictures\sample.jpg", 0, 0, 270, 20, -1, $GUI_WS_EX_PARENTDRAG)
ConsoleWrite("$PIC:=" & $PIC & @CRLF)

$Close = GUICtrlCreateLabel("X", 288, 2, 12, 18, -1,$GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1,0xff0000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$min = GUICtrlCreateLabel("_", 275, 0, 12, 18, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1,0xff0000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)



GUISetState(@SW_SHOW)

while 1
    Switch GUIGetMsg()
    case 0
    Case $GUI_EVENT_CLOSE
            Exit
    Case $min
        GUISetState (@SW_MINIMIZE)
    Case $PIC
        MSGBOX(48, ("CLICK", "$PIC:=" & $PIC)
    Case $Close
        Exit
EndSwitch
    WEnd

Share this post


Link to post
Share on other sites

Ulten when i use your code everything works but ....

the X and _ labels are not set to bkcolor transperant what can cause this ?


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites

Probably because I messed with it to figure out what could be wrong. Compare the settings to your original.

Share this post


Link to post
Share on other sites

the 2 labels are still not transperant ;)

and as u see i'v added the code :D so they can become transperant ;(


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Chasing your tail here.

1. You should be doing your homework dissecting xskin.au3 and seeing how to do these things.

2. Without disabling the pic you're pretty much SOL if you want to interact with the labels.

3. If you have to do this (only god knows why you are not using XSkin.au3 already done for you), then you'll have to look at GUIGetMsg() .. look at the parameter it takes, and mess with cursor position.

<snipped>

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

here is all the code only thing i need now is to make the labels transperant and i have added the code for that .

#include <GUIConstantsex.au3>
#include <Windowsconstants.au3>

$GUI = GUICreate("Win Get Title", 301, 300, -1, -1, BitOR($WS_POPUP, $WS_BORDER))
$PIC = GUICtrlCreatePic("Header.JPG", 0, 0, 270, 20, -1, $GUI_WS_EX_PARENTDRAG)
$Close = GUICtrlCreateLabel("X", 288, 2, 12, 18, -1,$GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1,0xff0000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$min = GUICtrlCreateLabel("_", 275, 0, 12, 18, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1,0xff0000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)



GUISetState(@SW_SHOW)

while 1
    Switch GUIGetMsg()
    case 0
    Case $GUI_EVENT_CLOSE
            Exit
    Case $min
        GUISetState (@SW_MINIMIZE)
    Case $PIC
        MSGBOX(0, "You Clicked The PiC", "CLICK ON PICK :D")
    Case $Close
        Exit
EndSwitch
    WEnd

Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites

here is all the code only thing i need now is to make the labels transperant and i have added the code for that .

#include <GUIConstantsex.au3>
#include <Windowsconstants.au3>

$GUI = GUICreate("Win Get Title", 301, 300, -1, -1, BitOR($WS_POPUP, $WS_BORDER))
$PIC = GUICtrlCreatePic("Header.JPG", 0, 0, 270, 20, -1, $GUI_WS_EX_PARENTDRAG)
$Close = GUICtrlCreateLabel("X", 288, 2, 12, 18, -1,$GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1,0xff0000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$min = GUICtrlCreateLabel("_", 275, 0, 12, 18, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1,0xff0000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)



GUISetState(@SW_SHOW)

while 1
    Switch GUIGetMsg()
    case 0
    Case $GUI_EVENT_CLOSE
            Exit
    Case $min
        GUISetState (@SW_MINIMIZE)
    Case $PIC
        MSGBOX(0, "You Clicked The PiC", "CLICK ON PICK :D")
    Case $Close
        Exit
EndSwitch
    WEnd
Guess I'm failing to see the difference with this an the first code?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

omg i'm sooooooo sry when Ulten edited the code i guess he changed the value of the pic's wight and set it to lower and it didn't cover the whole gui so there is no problem

i will say again soooooooooo sry ;)


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

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