Skip to main content
gamedev.net
🔒 Locked

question about CDialog

Started by thuned Dec 10, 2001 at 12:00 AM 3 replies 900+ views
Original Post
thuned
thuned
i have instances of cdialogs running; i select and i can press enter or escape and the dialog closes. how do i make it so it doesn''t close w/ enter or escape like a normal application? do i overwrite the virtual functions and do something in them or do i use another class like cpropertypage ?
life is unfair, take advantage of it.UNMB2 - if the link doesn't work, try clicking it :)
Zeke
Zeke
Handle the OnCommand message of the CDialog. I.e. go to class wizard and select the CDialog class and create a function for OnCommand. Then in the OnCommand function you need to find out if the WPARAM parameter specifies a key was pressed and which one and if its escape or return (or whatever) you return true, if it isnt then you return CDialog::OnCommand(wParam, lParam);

I dont have time right now to figure out how to test if the WPARAM parameter is escape key down etc but this should help you along. Ill have a look later and if you havent got it by then ill write more.

Hope ive helped
Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
JonStelly
JonStelly
There is a KB article about this: Q122489. Basically, rename the controls to something other than IDOK and IDCANCEL, then just call OnOK() and OnCancel() from your BN_CLICKED message handler.
thuned
thuned
cool thanks. learn something new everyday. sometimes these hidden "features" can be really annoying.
life is unfair, take advantage of it.UNMB2 - if the link doesn't work, try clicking it :)
Shannon Barber
Shannon Barber
To _prevent it from closing, override OnOK() (for enter) and OnCancel() (for esc) and _don''t call the CDialog::OnXXX functions.
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.