How to send a wxID_OK click event to a wxDialog Topic is solved

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
james.chengguangwang
Knows some wx things
Knows some wx things
Posts: 38
Joined: Wed Aug 02, 2006 4:59 am

How to send a wxID_OK click event to a wxDialog

Post by james.chengguangwang » Wed Sep 06, 2006 5:42 am

Hi All,

If a button ID is wxID_OK, and when the user clicks it, the dialog will be hided and destroyed, my questions is that how can I send a wxID_OK click event to close the dialog? thanks very much!

thanks
James

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Wed Sep 06, 2006 8:18 am

If your dialog is modal, in the "OnOK" event handling function, call "EndModal(wxID_OK)".

Otherwise, use "SetReturnCode(wxID_OK)", and the function creating the dialog will destroy it.

james.chengguangwang
Knows some wx things
Knows some wx things
Posts: 38
Joined: Wed Aug 02, 2006 4:59 am

Post by james.chengguangwang » Wed Sep 06, 2006 8:21 am

Thanks, get it!

Post Reply