zuk Posted May 9, 2006 Posted May 9, 2006 Hello, As you may understand, I'm a dumb in programming... But I'm trying ! :"> I'm starting to understand some few things, but some still are complicated to me ! At first, these commands: ControlClick / ControlCommand / MouseClick I never succeed to use them, I think it's coming from the controlID... Example: I create a button with an icon, What is the easier & faster way to implement a command on that button, so that, for example, a msgbox appears when clicking on it ?? See -> GUICtrlCreateButton ("my picture button", 10,10,40,40, $BS_ICON) GUICtrlSetImage (-1, "shell32.dll",22) ->?click?<- msgbox(0,"title","text") Ok it's may be easy for you... So please teach me Thx per advance !
Moderators SmOke_N Posted May 9, 2006 Moderators Posted May 9, 2006 Hello,As you may understand, I'm a dumb in programming...But I'm trying ! :"> I'm starting to understand some few things, but some still are complicated to me !At first, these commands:ControlClick / ControlCommand / MouseClickI never succeed to use them, I think it's coming from the controlID...Example:I create a button with an icon,What is the easier & faster way to implement a command on that button, so that, for example, a msgbox appears when clicking on it ?? See ->GUICtrlCreateButton ("my picture button", 10,10,40,40, $BS_ICON)GUICtrlSetImage (-1, "shell32.dll",22)->?click?<- msgbox(0,"title","text")Ok it's may be easy for you... So please teach me Thx per advance !If you want to graduate, I'd suggest starting here first: http://www.autoitscript.com/forum/index.php?showtopic=21048 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.
jpam Posted May 9, 2006 Posted May 9, 2006 $btn1 = GUICtrlCreateButton ("my picture button", 10,10,40,40, $BS_ICON) GUICtrlSetImage (-1, "shell32.dll",22) Guictrlsetonevent($btn1,"your_function") func your_function() msgbox(64,"hello",this is a msgbox") endfunc
zuk Posted May 9, 2006 Author Posted May 9, 2006 Thx for your answers ! I'm learning with the little tool you provide, I also tried the script, ipam, but... Nothing happens... Here's my prog: #include <GUIConstants.au3> GUICreate ("Application X",300,300,-1,-1) $MYINFOS = GUICtrlCreateButton ("picture", 10,10,40,40,$BS_ICON) GUICtrlSetImage (-1, "shell32.dll",22) GuiCtrlSetOnEvent($MYINFOS, "MYINFOS_Func") GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func MYINFOS_Func() msgbox(0,"title","text blabla") EndFunc -> Nothing when I click on the button/icon...
Moderators SmOke_N Posted May 9, 2006 Moderators Posted May 9, 2006 (edited) Thx for your answers ! I'm learning with the little tool you provide, I also tried the script, ipam, but... Nothing happens... Here's my prog: #include <GUIConstants.au3> GUICreate ("Application X",300,300,-1,-1) $MYINFOS = GUICtrlCreateButton ("picture", 10,10,40,40,$BS_ICON) GUICtrlSetImage (-1, "shell32.dll",22) GuiCtrlSetOnEvent($MYINFOS, "MYINFOS_Func") GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func MYINFOS_Func() msgbox(0,"title","text blabla") EndFunc -> Nothing when I click on the button/icon... Wouldn't it stand to reason, that you have to tell it to do something when you click the button? I mean, how are you figuring it would get to that function?#include <GUIConstants.au3> GUICreate ("Application X",300,300,-1,-1) $MYINFOS = GUICtrlCreateButton ("picture", 10,10,40,40,$BS_ICON) GUICtrlSetImage (-1, "shell32.dll",22) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $MYINFOS MYINFOS_Func() EndSelect WEnd Func MYINFOS_Func() msgbox(0,"title","text blabla") EndFunc Edit: Let me also say this... You can't use GUIOnEventMode (GUICtrlSetOnEvent() is what I'm talking about) with GUIGetMsg(), that you probably didn't know. And you can't use GUIOnEventMode without using Opt('GUIOnEventMode', 1) Edited May 9, 2006 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now