AutoHotkey Community

It is currently May 27th, 2012, 12:37 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Tab-key in Edit-controls
PostPosted: September 11th, 2005, 3:09 pm 
Offline

Joined: September 24th, 2004, 3:00 pm
Posts: 814
Location: Germany
Hi,

is it possible to add an option for edit-control like +WantReturn but for the Tab-key? (+LiteralTab ?)

I know that's possible to enter a tabulator with Ctrl+Tab, but sometimes it could better to have the normal behaviour.

_________________
Tekl


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2005, 4:10 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
This is a good suggestion and it's already on the to-do list.

Although I wasn't able to achieve it with WM_GETDLGCODE as expected, the following script seems to do the job:
Code:
OnMessage(0x100, "WM_KEYDOWN")
Gui, Add, Edit, vMyEdit w300 r10
Gui, Add, Button,, Sample Button
Gui, Show
return

WM_KEYDOWN(wParam)
{
   if (wParam = 9 AND A_GuiControl = "MyEdit") ; Tab was pressed in the edit control.
   {
      Send ^{Tab}  ; Insert a real tab character.
      return 0  ; Prevent the control from seeing this WM_KEYDOWN message.
   }
   ; Otherwise, do nothing to allow this message to be processed normally.
}

GuiClose:
ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2005, 5:33 pm 
Offline

Joined: September 24th, 2004, 3:00 pm
Posts: 814
Location: Germany
Hi Chris,

that's very a interesting code, based on this I now have rewritten a small notepad witch custom hotkey where a enabled/disabled Hotkeys if the windows is active or not.

Thanks

_________________
Tekl


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 8:29 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Doing the script above showed how it should be done in the program, so in v1.0.38.03 I've added a built in "WantTab" option for Edit controls.

But the built-in version doesn't send the Control-tab keystroke. Instead, it sends the EM_REPLACESEL message to the Edit control to insert a tab character.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 8:42 pm 
Offline

Joined: September 24th, 2004, 3:00 pm
Posts: 814
Location: Germany
Thanks Chris,

it's good, that you've implemented it, but your handmade suggestion before is so powerful that I now don't waste Hotkeys for some controls anymore. :-)

Regards, Tekl

_________________
Tekl


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: No registered users and 2 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