Setting Keyboard Focus on a TEdit Control
I basically have a InputQuery Box with a TEdit control. I obtain the handles(HWND) of both the Box & the Control.
My only issue is that when the InputBox is displayed the TEdit control isn't focused by default, I have to press a key to make it take keyboard focus.
Is there anyway (PostMessage?) through which I can give the focus to TEdit Control. Originally the Window has the control since if I press Down Arrow, the Move,Close Menu appears on the InputBox.
P.S. I've tried WM_ACTIVATE, SETFOCUS,WM_KEYDOWN('A'). None work however the KEYDOWN does print an 'A' in the TEdit control however the keyboard focus is still not belonging to it.
Regards,
Nisheeth Barthwal
Re: Setting Keyboard Focus on a TEdit Control
Quote:
Originally Posted by
nbaztec
I basically have a InputQuery Box with a TEdit control. [...]
Are they Visual C++ stuff?
Re: Setting Keyboard Focus on a TEdit Control
Yes. A Form control having a Edit Box & Button. Only VCL.
Re: Setting Keyboard Focus on a TEdit Control
The problem is that after calling SetFocus, the Edit Box is in a paused state but it has focus (the cursor is visible but not blinking). So I have to press a key to remove it's paused status. WM_KEYDOWN does *not* work.
Re: Setting Keyboard Focus on a TEdit Control
Quote:
Originally Posted by
nbaztec
Yes. A Form control having a Edit Box & Button. Only VCL.
- VCL (Visual Component Library)
Quote:
is a visual component-based object-oriented framework for developing Microsoft Windows applications. It was developed by Borland...
- Visual C++
Quote:
is a integrated development environment (IDE) product engineered by Microsoft for the C, C++, and C++/CLI programming languages.
Quite different, isn't it?
Here is a Visual C++ forum and not a VCL one.
Re: Setting Keyboard Focus on a TEdit Control
Well my query considered the Message I needed to Post to the control(Edit Control), hence it was posted here. I agree there are far many differences b/w VCL, MFC/ VC++ but I only needed to know the message I needed to post & I have found it: WM_LBUTTONDBLCLK
Thanks anyway.
PS: VC++ & VCL both implement the Message Queue using the WNDPROC
Re: Setting Keyboard Focus on a TEdit Control
Quote:
Originally Posted by
nbaztec
PS: VC++ & VCL both implement the Message Queue using the WNDPROC
Both wrap the same Windows API but in quite differnt concrete ways. Not any bad intention, just recommending a VCL forum to find better and quicker answers for VCL problems.
However, if a problem is a Windows API problem and does not imply specific library (MFC, ATL, VCL, whatever else) implementation, you can ask in C++ and WinAPI forum.
Re: Setting Keyboard Focus on a TEdit Control
Thank you. I'll see to it next time. However I wish to point that thought the general syntax may differ yet solution for one is solution for other as underneath the functionality is the same.
P.S. I thought of C++ & WinAPI forum earlier but the description: "This is a non-MFC forum" mis-leaded me since my original problem involves the Edit Controls - also native to MFC.
Re: Setting Keyboard Focus on a TEdit Control
Quote:
Originally Posted by
nbaztec
my original problem involves the Edit Controls - also native to MFC.
Nope. Your original problem involves
Quote:
Originally Posted by
nbaztec
A Form control having a Edit Box & Button.
Again: quite different stuff.
Re: Setting Keyboard Focus on a TEdit Control
Edit Box is a control on a Windows Form & so is the Button. Please elaborate how they don't belong to MFC. The only difference being - mine belongs to class TEdit & of MFC, to CEdit. As far as Message Queue is concerned both behave similarly to like messages.