Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Double Click Edit Box

114 views
Skip to first unread message

Roy Whitehead

unread,
Aug 7, 2000, 3:00:00 AM8/7/00
to
How can I detect a double click within an Edit Box which is held in a Dialog
Box, I don't want to use the SetFocus() event ?

Roy

Jeff Partch

unread,
Aug 7, 2000, 3:00:00 AM8/7/00
to

Roy!

The simple answer is to derive a class from CEdit using ClassWizard, add a handler for the
WM_LBUTTONDBLCLK message, and then use this class to represent your edit box in the dialog. I don't
know what it is you want to do in your handler, so if you usurp it outright it may or may not be
contradictory to the normal operation of the edit control which, "...Clears the current selection
and selects the word under the cursor. If the SHIFT key is depressed, extends the selection to the
word under the cursor.", in response to the WM_LBUTTONDBLCLK message. This may be what you want, or
if all you need is the notification, then continue passing the event on to the original
CEdit::OnLButtonDblClk handler.

Jeff...

--
Please post all follow-ups to the newsgroup only.

Roy Whitehead wrote in message <8mmqir$2cap$1...@news5.isdnet.net>...

Roy Whitehead

unread,
Aug 8, 2000, 3:00:00 AM8/8/00
to
Jeff,
I didn't consider the Normal actions of the double click, (shit), anyway
the application is as follows. I am writing a program that uses a Touch
Screen instead of a keyboard, I wanted to be able to allow the user to bring
up a Virtual Keyboard by double clicking ( touching) the edit box. The
user will then virtually type the text for the edit box which I will
recuperate and enter into the edit box (normally a new file name).
The other problem ( If a can call it a problem is that any controls
using your method must therefore be created dynamically at run time- correct
me if I am wrong ).

Thanks Roy


Jeff Partch <airb...@airmail.net> a écrit dans le message :
OJx8QjLAAHA.79@cppssbbsa05...

Jeff Partch

unread,
Aug 8, 2000, 3:00:00 AM8/8/00
to

Roy Whitehead wrote in message <8mo91h$9d0$1...@news4.isdnet.net>...
>Jeff,


> The other problem ( If a can call it a problem is that any controls
>using your method must therefore be created dynamically at run time- correct
>me if I am wrong ).
>
> Thanks Roy
>


Roy!

No, just use a member variable of your derived class as the member variable in your CDialog class.
If you create the derived class (using ClassWizard I think) before using using CW to add the member
variable, then your derived class should be available in the "variable type" combobox along with the
usual CEdit. If you have it already set up to use a CEdit, the just go to the header for your
CDialog derived class and change the "CEdit m_edit" line to "CMyEdit m_edit". The dialog control is
still a window's EDIT control and created just like any dialog control. It is usually subclassed by
MFC using a standard CEdit class which gets a chance at the messages before the HWND it represents,
but by using your own derived CEdit class, you get first crack at the messages. Usually in a dialog,
it's all about subclassing (this is what the DDX_Control function does) existing controls and not
creating (although you can do that too) them.

Jeff...


Roy Whitehead

unread,
Aug 9, 2000, 3:00:00 AM8/9/00
to
It took me a little while but at last I understood the principle.
I have a couple of books on VC++, its a shame none of them have shown how
easy it is too subclass in this manner.


Cheers Roy


0 new messages