Advertisement

MFC Dialog Exits

Started by September 26, 2000 11:54 AM
6 comments, last by Yanroy 24 years, 3 months ago
I set up my rich edit control to send the NM_RETURN message, which is when the user presses return. The app exits every time return is pressed! I can''t figure out why. The function to handle NM_RETURN never gets called. Plz help. --------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming

You are unique. Just like everybody else.

Yanroy@usa.com

Visit the ROAD Programming Website for more programming help.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

Few questions:

Is it multi-line? If so, have you clicked "Multiline" in properties under Styles?

Is "Want return" clicked under Styles in the properties?

Did you add the NM_RETURN using class wizard? If not, did you make sure to override the function properly and put the proper message call in the windows message handler area?

-fel

~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
Advertisement
It is the dialog that I was talking about in my last thread about MFC. There are two rich edit controls, one read only, want return, multiline and the other want return. I added the message handler with the classwizard. The one the cursor is in is the non-read only one I type my message, but when I press enter the app exits.

--------------------


You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming


You are unique. Just like everybody else.

Yanroy@usa.com

Visit the ROAD Programming Website for more programming help.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

Okie, more questions:

What are your rich edit controls called? (ID''s)

What are the ID numbers for your rich edit controls?
To get ID numbers, go into your resource.h and take a look. Sometimes MSVC screws up and maps controls on top of each other, which can lead to truly bizarre behaviour.

What exactly are you doing in your NM_RETURN?

I''m probably going to have to see the code on this.

-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
You need to override the CDialog::OnOK function
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Hmmm... due to the school''s comp lab being closed all day and a load of homework, I didn''t get a chance to reply yesterday. Almost had my thread buried! Anyway, the ENTIRE DIALOG consists of two rich edit controls, the first (see prev post) is IDC_OUTPUT and the other is IDC_COMMAND. Since I don''t have the code in front of me, I can''t tell you the actual numbers. There is nothing else on the dialog (or at least there isn''t supposed to be... I added a button just to test if my code works, and when I click it, it does what pressing enter is supposed to do... and it works. It will be removed later), not even an OK or Cancel button. I do have a menu across the top though. I have assiged Exit under the File menu the APP_ID_EXIT (I think) ID so that when I click it, the app exits, but the rest of them don''t have message handlers (they do have IDs). This has really got me stumped... one more thing I tried was turning off want return on the large rich edit control which didn''t do anything. What did get a response was checking multiline on the small edit control. It sorta works, because it doesn''t exit anymore, but I now have multiple lines I don''t like that solution. Any more help would be great.

PS - How do I add a handler for the rest of my menu IDs?

--------------------


You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming


You are unique. Just like everybody else.

Yanroy@usa.com

Visit the ROAD Programming Website for more programming help.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

Advertisement
Since replies don''t seem to be forthcoming, I need to bump this thread back to the top of the list. This is a question that I really need an answer to.

--------------------


You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming


You are unique. Just like everybody else.

Yanroy@usa.com

Visit the ROAD Programming Website for more programming help.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

It closes when you hit enter right?

Override the CDialog::OnOK() method, I had the exact same problem.

By deafult, where the button exist or not, OnOK gets called whe nthe user hits enter, and CDialog::OnOK() gets called and that terminates the dialog and returns ID_OK!
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement