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 

Scrolling with PostMessage won't work in a function

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
DeathByNukes



Joined: 25 Mar 2007
Posts: 14
Location: Mabase

PostPosted: Sun Apr 08, 2007 10:59 am    Post subject: Scrolling with PostMessage won't work in a function Reply with quote

I made a function to add text to an edit box and scroll it to the bottom but for some reason it doesn't scroll.
Code:
echo( text )
{
   GuiControlGet, ConText,, Console
   GuiControl,, Console, %ConText%%text%
   PostMessage, 0x115, 7,,, ahk_id %ConsoleHWND% ; WM_VSCROLL = 0x115 , SB_BOTTOM = 7
}

If I copy the PostMessage and place it after calling the function then it works. Is this a bug or did I miss something about functions?
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
PhiLho



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

PostPosted: Sun Apr 08, 2007 12:49 pm    Post subject: Reply with quote

Your variables seems to be global.
Either pass them as parameters, or use the global keyboard on start of the function body.
_________________
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
DeathByNukes



Joined: 25 Mar 2007
Posts: 14
Location: Mabase

PostPosted: Sun Apr 08, 2007 6:35 pm    Post subject: doh! Reply with quote

Heh, I didn't know functions couldn't normally get global variables. Thanks!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help 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