Skip to main content
GameDev.net gamedev.net
🔒 Locked

Simple MFC question...

Started by Crocmort Oct 22, 2000 at 11:16 AM 5 replies 400+ views
Original Post
Crocmort
Crocmort
When you create a Dialog Based application with appwizard, how do you do to stop the application to end when you press the enter key!?!?! I know that''s simple, but when you don''t know... =)
xtrmntr
xtrmntr
the default buttons on your box should be ok & cancel. those are used to quit your program (or the x in the upper righthand corner of the DialogBox.

...I think i answered your question (?)

yesterday is history, tomorrow is a mystery, today is a gift... -TapRoot

AIM screen name: StarCraftIsEvil
3dModelMan
3dModelMan
If you place some more controls on the diaog window, one of them will have the focus, instead of the close-window button.

Try here for some good mfc tutorials.

Cheers

Matt



Crocmort
Crocmort
Hum no... =(

I deleted the 2 buttons ok and cancel. Even if I have the focus on something else like an edit box or something like that, when I press enter it close my program. I just want that when I press enter in my edit box, it erase everything in the edit box and print something in an other edit box.

The goal of my program is a console like windows... You right a command, my program parse it and write some message in an other edit box. I just want to be able to press enter to enter my command.

My other question is simple too... How do I insert a new line in a CString object? The ''\n'' don''t seem to work... =(

So I hope someone will be able to help me =)
3dModelMan
3dModelMan
To quickly answer your main q.

Edit the dialog and right-click it and select prperties from the pop-up menu. Under "more styles" check "system model".

Bye

Matt



Yorvik
Yorvik
overwrite CDialog::OnOK()

    
void CMyDlg::OnOK()
{
return;
}


that should do it.
Shannon Barber
Shannon Barber
Override CDialog::OnOK() :p
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.