GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 18-Aug-2006, 01:10
neo79 neo79 is offline
New Member
 
Join Date: Aug 2006
Posts: 1
neo79 is on a distinguished road

combox close on enter in vc++ dialog


Hello everyone,

I am new here and also new to vc++.

I am making a dialog application using vc++. in one dialog, i have removed the "OK" and "CANCEL" button, only left the "red cross" at the right upper corner of the dialog. because i only want to use it to close the dialog.

now i add a combo box into the dialog. each time when i select the combo box and press the "enter", the whole dialog close !!!

does anyone know how to disable this feature? i only want to close the dialog by click the "red cross".

Thanks a lot.
neo.
  #2  
Old 18-Aug-2006, 09:06
TurboPT's Avatar
TurboPT TurboPT is offline
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 966
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: combox close on enter in vc++ dialog


Not sure what you are trying to accomplish... [some will say this diverges from standard GUI design(s), unless this is for a special purpose, custom app.]

Pressing 'Enter' is the same as the default action for the 'Ok' button, as mentioned here in the Microsoft info:
Quote:
The Default button is selected when the user presses ENTER. Only one command button on a form can have its Default property set to True. Pressing the ENTER key invokes the Click event for the default command button. This feature works in conjunction with an edit control, such as a text box. For example, the user can type data in a text box and then press ENTER to generate a Click event instead of choosing an OK button.
(which is also why that, after you made a combobox choice and hit enter, the dialog box closed)

However, you can prevent that behavior by overriding the dialog's OnOk() as an empty function call.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
 
 

Recent GIDBlogPython ebook by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing values from a different dialog steph MS Visual C++ / MFC Forum 11 21-Jul-2006 18:55
getting data from dialog before close custo MS Visual C++ / MFC Forum 6 23-Mar-2006 23:58
Help! Some basal questions about MFC xutingnjupt MS Visual C++ / MFC Forum 1 05-Dec-2004 03:38
Anyone can write a program code for this??? chriskan76 C Programming Language 1 19-Oct-2004 20:25
Array..... chriskan76 C Programming Language 4 18-Oct-2004 14:19

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:29.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.