Sign in to follow this  
Followers 0
zuk

Noob-need-help

6 posts in this topic

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 !

Share this post


Link to post
Share on other sites



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 !

If you want to graduate, I'd suggest starting here first: http://www.autoitscript.com/forum/index.php?showtopic=21048

[center]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.[/center]

Share this post


Link to post
Share on other sites

$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

Share this post


Link to post
Share on other sites

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...

:(

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

Thx for the tips :)

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