MFC text box (within dialog box) handling own messages

MFC text box (within dialog box) handling own messages

Post by InfoSystem Use » Wed, 26 Feb 1997 04:00:00



Hi there,

I've got e.g. a text box on a dialog (lucky me)

CWnd *pTextBox = GetDlgItem(blah);

Would somebody mind telling me how can I get a class encapsulating the
text box to handle directly a double click (for ex) on the text box,
without
getting the parent dialog to do it for me? (I've got an idea I may have
to use some reflection stuff but I don't know how to do it).

Cheers
-shaun

 
 
 

MFC text box (within dialog box) handling own messages

Post by Harley Jackso » Wed, 26 Feb 1997 04:00:00


Message reflection works only for some messages. I'm too lazy to look but I
don't think double-clicking is one of them.

The generic answer is to derive your own class from CEdit and handle
whatever you want within this class. Then, in the ClassWizard, map your
edit control to CONTROL not VARIABLE, and specify your derived class.



Quote:> Hi there,

> I've got e.g. a text box on a dialog (lucky me)

> CWnd *pTextBox = GetDlgItem(blah);

> Would somebody mind telling me how can I get a class encapsulating the
> text box to handle directly a double click (for ex) on the text box,
> without
> getting the parent dialog to do it for me? (I've got an idea I may have
> to use some reflection stuff but I don't know how to do it).

> Cheers
> -shaun


 
 
 

1. -->> MFC : Getting Dialog Box Handle to Call MFC functions from my own function

Hello,
I am using Visual C++ with MFC. From "control notification handler code"

(inside member functions of my MFC Class), I can interact with my Dialog
Box
with :

GetDlgItemText(IDC_EDIT1, Var);
SetDlgItemText(IDC_EDIT2, "--a-string--");
m_vardisplay.AddString("----a-text-----------");
....

It works fine.

But when I want to call this last functions (GetDlgItemText(),...) from
my own
function it does'nt work :

int Myfunction ()
{
...
GetDlgItemText(.....);
...

In the other hand, when I want to use the SDK APIs, I must have the
handle of my
Dialog Box, so How can I get it (inside my MFC Class) ?

Is there any other ways to solve this problem ?

Many thanks,

--Bachir

2. Task List under 3.51 & New Shell

3. Subclass of edit box from within combo box in MFC

4. Startup Programs

5. Resizing dialog Box or Elastic control tool for Dialog Boxes.

6. Enable cache for FAT

7. separate colours for window text and message box text

8. WMP9 can't play Audio Cd,s

9. Access 2002 List Box Wizard(1st dialog box) 3rd Option missing

10. dialog box confirmation box

11. Windows Dialog Boxes Lost Characters, Check boxes, etc.

12. Getting client coordinates for a CListCtrl box in a dialog box

13. Help: Dialog Box -- Picture Box Problem