// By default, pressing escape cancels the dialog
void wxDialog::OnCharHook(wxKeyEvent& event)
{
- if (GetHWND())
+ if (event.m_keyCode == WXK_ESCAPE)
{
- if (event.m_keyCode == WXK_ESCAPE)
- {
// Behaviour changed in 2.0: we'll send a Cancel message
// to the dialog instead of Close.
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
GetEventHandler()->ProcessEvent(cancelEvent);
return;
- }
}
// We didn't process this event.
event.Skip();
int x_offset,y_offset ;
int display_width, display_height;
int width, height, x, y;
- wxFrame *frame ;
- if (direction & wxCENTER_FRAME)
+ wxWindow *parent = GetParent();
+ if ((direction & wxCENTER_FRAME) && parent)
{
- frame = (wxFrame*)GetParent() ;
- if (frame)
- {
- frame->GetPosition(&x_offset,&y_offset) ;
- frame->GetSize(&display_width,&display_height) ;
- }
+ parent->GetPosition(&x_offset,&y_offset) ;
+ parent->GetSize(&display_width,&display_height) ;
}
else
- frame = NULL ;
-
- if (frame==NULL)
{
wxDisplaySize(&display_width, &display_height);
x_offset = 0 ;
Refresh();
}
+void wxDialog::Fit()
+{
+}