AutoHotkey Community

It is currently May 24th, 2012, 2:01 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: October 21st, 2008, 8:47 pm 
Offline

Joined: February 17th, 2008, 8:52 pm
Posts: 309
So I have this edit control that contains some default text.
Code:
Gui, Add, Edit, r3 vEditText y+10 w140, Add some extra notes.


What I would like to do is when someone clicks in the edit control the default text is cleared. I could not find a built in option in the help system.

This GUI I am creating will eventually take the input from all controls and put them in the clipboard to be pasted in helpdesk tickets. I don't want the "add some extra notes" in every ticket.

Any ideas?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2008, 8:56 pm 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
You can use OnMessage to catch clicks in the Edit control:

Code:
Gui, Add, Edit, r3 vEditText HwndEdit y+10 w140, Add some extra notes.
Gui, Show
OnMessage(0x201, "WM_LBUTTONDOWN")
Return

WM_LBUTTONDOWN(wParam, lParam, Msg, hWnd)
{
   Global Edit
   If (hWnd = Edit)
      GuiControl,, Edit1
}

_________________
"Anything worth doing is worth doing slowly." - Mae West
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2008, 11:48 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
http://www.autohotkey.com/forum/viewtopic.php?t=33554


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 22nd, 2008, 6:00 pm 
Offline

Joined: February 17th, 2008, 8:52 pm
Posts: 309
Serenity I tried you suggestion and it clears the edit field but for some reason no matter what contol I click on it minimizes or hides the GUI.

I really don't understand the WM_LButtonDown parameters. This is the first time I have every used this type of code. From what I can see the hWnd is passed and it compares it to Edit. But for some reason it is making the comparison no matter what GUI control I click on.

Code:
WM_LBUTTONDOWN(wParam, lParam, Msg, hWnd)
{
   Global Edit
   Edit
   If (hWnd = Edit)
   {
      GuiControl,,Edit1
   }
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 23rd, 2008, 5:09 pm 
Offline

Joined: February 17th, 2008, 8:52 pm
Posts: 309
SKAN thanks for the link. The Timer approach worked perfectly.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Albireo, batto, fragman, jyloup, KenC, Pulover, Yahoo [Bot] and 23 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group