 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
bitcloud
Joined: 30 Oct 2008 Posts: 27
|
Posted: Thu Feb 04, 2010 7:09 am Post subject: GUI - Barking up the wrong tree? |
|
|
Hi guys,
I'm trying to operate the AHK GUI, and it's got me a little baffled.
I don't really want a specific answer - i just want to know if the following is possible or whether I'm barking up the wrong tree trying to do it in AHK
Basically I want a consistent GUI that stays up, and updates as things occur...
Eg, lets say I click at 123,252, I want the GUI to show up that result (and maintain a history - this is just an example)
so, I want to do: (not real code)
loop(
mousepos .= getmousepos
GUI add, text, %mousepos%
GUI show
)
but I don't know if this will: A) keep making NEW gui windows... or B) keep stealing focus...
Is GUI barking up the wrong tree? is there another solution? I've been using tooltips, but they're starting to be unmanagable...
Cheers
BC |
|
| Back to top |
|
 |
Murx Guest
|
Posted: Thu Feb 04, 2010 7:42 am Post subject: |
|
|
| Code: | Gui, Add, Text, vMP,
Gui, Show, w100 h100, MP
SetTimer, 300, X
Return
X:
MouseGetPos, MousePos, X, Y
History .= MousePos
GuiControl,, MP, % History
Return | ? |
|
| Back to top |
|
 |
bitcloud
Joined: 30 Oct 2008 Posts: 27
|
Posted: Thu Feb 04, 2010 7:52 am Post subject: |
|
|
Thank you!
yes, that works a treat... I wasn't aware of the GUIControl Command (and I wondered why the GUI always boggled me)
For anyone else who happens to stumble on this thread, here's a working version of murx code:
| Code: | Gui, Add, Text, vMP, x126 y287 w340 h80
Gui, Show, x131 y91 h377 w477, MP
;SetTimer, 300, X
Return
x::
MouseGetPos, MousePos, X, Y
History := MousePos
GuiControl,, MP, % History
Return
|
(I'm not sure what the settimer part does, but it doesn't work, so I commented it out ) |
|
| Back to top |
|
 |
bitcloud
Joined: 30 Oct 2008 Posts: 27
|
Posted: Thu Feb 04, 2010 7:59 am Post subject: |
|
|
Sorry, can you just clarify for me the connection between the GUI labelled as MP, and the element labelled as vMP?
I don't understand the naming, or how it "knows" to update this element...
cheers |
|
| Back to top |
|
 |
flyingDman
Joined: 27 Feb 2009 Posts: 690 Location: Burbank, California
|
Posted: Thu Feb 04, 2010 8:16 am Post subject: |
|
|
I had this:
| Code: | #SingleInstance Force
CoordMode, mouse, Screen
Gui, Add, Text, w100 h700 vMP,
Gui, Show, , Mouse Position
SetTimer, sub, 1000
Return
sub:
MouseGetPos, X, Y
History = %history%`n%X%-%Y%
GuiControl,, MP, %History%
Return |
The settimer's parameters were wrong. Also the naming was confusing. In order for this to be a continious "ticker tape", the topmost item would need to be removed as a new coordinate is added. _________________ "Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom" but let's start to get the data... |
|
| Back to top |
|
 |
Murx Guest
|
Posted: Thu Feb 04, 2010 8:17 am Post subject: |
|
|
Gui, Show,, MP ; MP is here simply the title of the window, change it to your needs.
Gui, Add, Text, vMP, ; "v" = variable. Means here the text-control will get the variable "MP" assigned. That's what GuiControl triggers calling "MP" |
|
| Back to top |
|
 |
Murx Guest
|
Posted: Thu Feb 04, 2010 8:27 am Post subject: |
|
|
@ flyingDman
traditional: | Code: | | History = %history%`n%X%-%Y% |
expression: | Code: | | History .= X "-" Y "`n" |
|
|
| Back to top |
|
 |
flyingDman
Joined: 27 Feb 2009 Posts: 690 Location: Burbank, California
|
Posted: Thu Feb 04, 2010 8:32 am Post subject: |
|
|
| Quote: | | clarify for me the connection between the GUI labelled as MP, and the element labelled as vMP |
the text control's v-label is vMP and referred to as MP in the guicontrol line
see http://www.autohotkey.com/docs/commands/Gui.htm#Events _________________ "Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom" but let's start to get the data... |
|
| Back to top |
|
 |
flyingDman
Joined: 27 Feb 2009 Posts: 690 Location: Burbank, California
|
Posted: Thu Feb 04, 2010 8:57 am Post subject: |
|
|
Actually, to create the "ticker tape" effect, just use
| Code: | | History = %X%-%Y%`n%history% |
rather than
| Code: | | History = %history%`n%X%-%Y% |
@Murx
I appreciate the heads-up on expressions and was looking on how to write my changed line in expression fashion. Obviously it is not History =. X "-" Y "`n". Is it History := X "-" Y "`n" History or is there a ".=" shorthand version? _________________ "Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom" but let's start to get the data... |
|
| Back to top |
|
 |
bitcloud
Joined: 30 Oct 2008 Posts: 27
|
Posted: Thu Feb 04, 2010 10:39 am Post subject: |
|
|
ahh yes, that makes sense Dman,
thanks..
So, just to clarify for others reading this:
vMP and MP can be replaced with
vMyVariable and MyVariable (or any variable of your choice)
(thats how they're designated) |
|
| Back to top |
|
 |
bitcloud
Joined: 30 Oct 2008 Posts: 27
|
Posted: Thu Feb 04, 2010 11:31 am Post subject: |
|
|
argh.. sorry..
what am i doing wrong?
Gui, Add, Text, x36 y127 w410 h50, Default Text
this works
so i add the vVariable
Gui, Add, Text, x36 y127 w410 h50, vVariable , Default Text
It's the right size, but the default text is "vVariable , Default Text", and I can't target it with GUIControl
Gui, Add, Text, vVariable, x36 y127 w410 h50, Default Text
I can target it with GUIControl, but it's the wrong size, and the default text is "x36 y127 w410 h50, Default Text"
any ideas? |
|
| Back to top |
|
 |
Murx Guest
|
Posted: Thu Feb 04, 2010 11:51 am Post subject: |
|
|
Wrong: | Code: | | Gui, Add, Text, x36 y127 w410 h50, vVariable, Default Text | Correct: | Code: | | Gui, Add, Text, x36 y127 w410 h50 vVariable, Default Text |
Syntax! |
|
| Back to top |
|
 |
bitcloud
Joined: 30 Oct 2008 Posts: 27
|
Posted: Thu Feb 04, 2010 12:14 pm Post subject: |
|
|
brilliant!
awesome thanks a heap murx. (the GUI thing is starting to make a little more sense now, cheers ) |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|