Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not closing a modal dialog after <Enter> pressed

Status
Not open for further replies.

firelex

Programmer
Jan 10, 2002
118
DE
Hello, all!
Ther question is:
How can I get a modal dialog not to close after the <Enter>-Key is pressed over it?
There is probably such a feature of the dialog but I cannot find out what it is.
 
Select the &quot;Ok&quot; button and look in properties. There should be some property like &quot;Default&quot; or &quot;Defaule Button&quot; or something like that. Set this property to false or if there is a check box(on older versions) untick that.

Ion Filipski
1c.bmp
 
Thanks IonFilipski!

BUT the point is: I have a modal dialog, that has some tabs. Each tab is a separate dialog (I mean like PropertySheet, but the VC++ variant)
And being in any of the tabs I need to get rid of that &quot;Default Button&quot;-feature (it's style name is
Code:
BS_DEFPUSHBUTTON
).

I can get to the parent Window and then to the button, all OK. In the OnInitDialog function I check if &quot;OK&quot;-button has the style
Code:
BS_DEFPUSHBUTTON
and get rid of it. If I now get the style of the button - it has no
Code:
BS_DEFPUSHBUTTON
. All OK. But if the window is redrawn (e.g. it is covered by another window and then aktivated again) the
Code:
BS_DEFPUSHBUTTON
style will be set again! Where does it come from?
 
You sure have done some unusual things. I had ho problems with that. Maybe when you reactivate window, the button take the focus and when you press enter it is executed. In this case you should set tabstob to false. But you should see in your application what is up. Also see testing situations
look at the difference between
if(isDefault == false)
and
if(isDefault = false)

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top