AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GUI Picture and Add Button

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
ILL.1



Joined: 29 Sep 2004
Posts: 84

PostPosted: Wed Sep 29, 2004 3:44 pm    Post subject: GUI Picture and Add Button Reply with quote

I found a problem with sending mouse clicks in a GUI.
I created a simple gui with the following:

Code:
MyPic = PATH TO PICTURE

GUI, Add, Picture, xm ym, %MyPic%
GUI, Add, Button, gOK xm ym, OK
GUI, Add, Button, gCancel xm ym+20, Cancel
GUI, Show, , Background Test
Return

Cancel:
GuiClose:
ExitApp

OK:
GUI, submit
MsgBox, OK Clicked
ExitApp


When the buttons are over top of the picture, mouse clicks do not work. Keyboard input does work. Is there something that I am missing, or is this how the GUI is suppose to work?
_________________
===============
----------ILL.1-----------
===============
Back to top
View user's profile Send private message
Nemroth



Joined: 07 Sep 2004
Posts: 262
Location: France

PostPosted: Wed Sep 29, 2004 5:58 pm    Post subject: Reply with quote

The AHK Help file says :
Quote:
Options for Assigning Actions and Variables

G: Gosub. To launch a subroutine in response to the press of a button, changing of a checkbox/radio, selection of a new choice, or the clicking of a picture or text control: include the letter G followed immediately by the name of the label to execute....

So try :
Code:
MyPic = PATH TO PICTURE

GUI, Add, Picture, xm ym gPicProc, %MyPic%
GUI, Add, Button, gOK xm ym, OK
GUI, Add, Button, gCancel xm ym+20, Cancel
GUI, Show, , Background Test
Return

Cancel:
GuiClose:
ExitApp

OK:
GUI, submit
MsgBox, OK Clicked
ExitApp

PicProc:
;here your procedure
return

May be I'm wrong...
Back to top
View user's profile Send private message
ILL.1



Joined: 29 Sep 2004
Posts: 84

PostPosted: Wed Sep 29, 2004 6:22 pm    Post subject: Reply with quote

My understanding of that command leads me to believe that if I wanted an action to occur if I pressed the picture it would assign a label like you did. So, after adding the code like you suggested I did a little trouble shooting. It seems that the picture is considered to be in front, even though the buttons are on top. Do you know of a way to keep the buttons in front of the picture? Or is there a way to make the button clicks pass throguh the picture but not the GUI?
_________________
===============
----------ILL.1-----------
===============
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Wed Sep 29, 2004 7:33 pm    Post subject: Reply with quote

ur script works fine for me... make sure u've the latest download.
_________________
Back to top
View user's profile Send private message
Nemroth



Joined: 07 Sep 2004
Posts: 262
Location: France

PostPosted: Wed Sep 29, 2004 7:36 pm    Post subject: Reply with quote

Well I must say I don't know why, when you click on one of the buttons, this is the action of the click on the picture wich is fired.
May be as the buttons are in the aera of the picture they are considered as part of the picture ???
Is it a bug or a normal behaviour ?
Please Chris, help !!!
But perhaps is it a good idea to implement, if it's possible, the equivalent of the HTML image maps in the AHK's GUI ?
Please Chris, do you think you can do that ?
Back to top
View user's profile Send private message
Nemroth



Joined: 07 Sep 2004
Posts: 262
Location: France

PostPosted: Wed Sep 29, 2004 7:38 pm    Post subject: Reply with quote

to Rajat :
I have Win 98SE and the last version of AHK and the script works for me like I said.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Wed Sep 29, 2004 7:44 pm    Post subject: Reply with quote

Rajat's right: The issue with pictures "stealing clicks" was recently fixed. It sounds like your version is slightly too old to have that fix.

To take advantage of the fix, your picture mustn't have an associated g-label in its options.

Although already present in the installer, this fix will be announced in the changelog for version 1.0.20, which is due out tomorrow hopefully.
Back to top
View user's profile Send private message Send e-mail
Nemroth



Joined: 07 Sep 2004
Posts: 262
Location: France

PostPosted: Wed Sep 29, 2004 7:49 pm    Post subject: Reply with quote

Nemroth wrote:
But perhaps is it a good idea to implement, if it's possible, the equivalent of the HTML image maps in the AHK's GUI ?
Please Chris, do you think you can do that ?

What do you think about that, Chris ?
Do you think it's a good idea ? Is it possible to do ?
Back to top
View user's profile Send private message
Nemroth



Joined: 07 Sep 2004
Posts: 262
Location: France

PostPosted: Wed Sep 29, 2004 7:54 pm    Post subject: Reply with quote

About the subject of this post :
I have the last version of AHK, with the last modifications.
I tried with and without the "G" parameter
With : the 2 buttons and the pict give the G Pict procedure as result.
Without : nothing happens for me clicing on the pict or the buttons.
I have Win 98SE
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Wed Sep 29, 2004 7:54 pm    Post subject: Reply with quote

I'll make a note of it, but you may already know you could do it using something like the following:
Code:
Gui, Add, Pic, gMyPicClick, MyPic.jpg
...
return

MyPicClick:
MouseGetPos, ClickX, ClickY
ControlGetPos, PicX, PicY, PicW, PicH, Static4, A
... now compare the above coordinates and dimensions to figure out where in the picture the user clicked ...
return


Last edited by Chris on Wed Sep 29, 2004 7:58 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
ILL.1



Joined: 29 Sep 2004
Posts: 84

PostPosted: Wed Sep 29, 2004 7:55 pm    Post subject: Reply with quote

I'll download the new version once I get the chance.
_________________
===============
----------ILL.1-----------
===============
Back to top
View user's profile Send private message
Nemroth



Joined: 07 Sep 2004
Posts: 262
Location: France

PostPosted: Wed Sep 29, 2004 8:02 pm    Post subject: Reply with quote

Thanks Chris for your interesting code.

For me the equivalent of the HTML image maps is just a suggestion as I have personally no use of sutch a feature. But perhaps it ca be usefull for some guys.
Back to top
View user's profile Send private message
ILL.1



Joined: 29 Sep 2004
Posts: 84

PostPosted: Thu Sep 30, 2004 12:52 pm    Post subject: Reply with quote

Downloaded the latest version and all is fixed. I was going to use the MouseGetPos, but I wanted to see if there was a fix for this first. I did a bit of a search before I posted and didn't see any answers to a fix. From now on I'll make sure that I have the lastest download. Thanks for all your help.
_________________
===============
----------ILL.1-----------
===============
Back to top
View user's profile Send private message
Guest






PostPosted: Fri Oct 01, 2004 10:27 am    Post subject: Reply with quote

Appologies. I tried once again with 1.0.20 version and it's OK under W98 SE
For me too it was a version problem and I was sure th had install the last 1.0.19 one...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group