- // if we do have a default button, do press it
- btn->MSWCommand(BN_CLICKED, 0 /* unused */);
+ wxButton *btn = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
+ if ( btn && btn->IsEnabled() )
+ {
+ // if we do have a default button, do press it
+ btn->MSWCommand(BN_CLICKED, 0 /* unused */);