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 

GuiControlGet Pos overwrites the control's variable

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



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Mon Feb 26, 2007 12:01 pm    Post subject: GuiControlGet Pos overwrites the control's variable Reply with quote

I re-read the manual, and don't see this explained. So I post it as a bug, since it is an unpleasant and unexpected side effect, even if the workaround is simple.

The problem is that when I use GuiControlGet Pos after a Gui Submit (for example), the content of the variable of the control is overwritten with an empty string.
Code:
Gui Add, Edit, ve, Sample Text
Gui Add, Button, gL1, Test 1
Gui Add, Button, gL2, Test 2
GuiControl Focus, Button1
Gui Show, w300, GuiControlGet Bug
Return

L1:
   Gui Submit, NoHide
   MsgBox %e%
   GuiControlGet e, Pos
   MsgBox %e%`n%eX% %eY% %eW% %eH%
Return

L2:
   GuiControlGet e, Pos
   Gui Submit, NoHide
   MsgBox %e%`n%eX% %eY% %eW% %eH%
Return
If this is hard to correct in code (usage in functions?), I would be happy with a simple warning in the manual. The fact that we cannot specify a specific variable name for this operation (I expected the syntax to be GuiControlGet outputVar, Pos, ControlID) doesn't help! (could be a wish... if ControlID is omitted, behavior remains the same, compatibility isn't broken).
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Feb 27, 2007 2:24 am    Post subject: Re: GuiControlGet Pos overwrites the control's variable Reply with quote

PhiLho wrote:
GuiControlGet Pos after a Gui Submit (for example), the content of the variable of the control is overwritten with an empty string.
Good catch. That will be fixed in the next update.

Quote:
we cannot specify a specific variable name for this operation (I expected the syntax to be GuiControlGet outputVar, Pos, ControlID) doesn't help! (could be a wish... if ControlID is omitted, behavior remains the same, compatibility isn't broken).
Can you double-check that; it seems to work for me. For example:

GuiControlGet, CustomOutputVar, Pos, VarNameOfControl

Thanks.
Back to top
View user's profile Send private message Send e-mail
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Tue Feb 27, 2007 11:05 am    Post subject: Re: GuiControlGet Pos overwrites the control's variable Reply with quote

Chris wrote:
Quote:
we cannot specify a specific variable name for this operation (I expected the syntax to be GuiControlGet outputVar, Pos, ControlID) doesn't help! (could be a wish... if ControlID is omitted, behavior remains the same, compatibility isn't broken).
Can you double-check that; it seems to work for me. For example:

GuiControlGet, CustomOutputVar, Pos, VarNameOfControl
My bad, I didn't even tried because it isn't clearly documented in the 'Pos' section, so I assumed there is only one syntax...
I know it is implicit from the generic syntax, but I suggest adding a line of explanation or of example to clarify this. Thanks.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
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