HHeelp
-
hello friends.. I am writing a Wizard application. now i want to change the default focus i.e if i press enter then the wizard automatically set the Next as default button and as this button gets press the app moves to the next Wizard page. But in between this i want to change the Default button to Cancel. that means when the user clicks the enter key then instead of the Next the Cancel key should be pressed. In short i want to change the Default button to Cancel instead of next.. Help Thanx TAKE CARE
-
hello friends.. I am writing a Wizard application. now i want to change the default focus i.e if i press enter then the wizard automatically set the Next as default button and as this button gets press the app moves to the next Wizard page. But in between this i want to change the Default button to Cancel. that means when the user clicks the enter key then instead of the Next the Cancel key should be pressed. In short i want to change the Default button to Cancel instead of next.. Help Thanx TAKE CARE
One solution is SendMessage(). if (pFromButtom->GetSafeHwnd() && pToButton->GetSafeHwnd()) { DWORD style = pToButton->GetStyle(); if ((style & BS_DEFPUSHBUTTON) != 1) { style = pFromButtom->GetStyle(); // Remove default push button style. style &= ~BS_DEFPUSHBUTTON; // Set the new style. ::SendMessage(pFromButtom->GetSafeHwnd(), BM_SETSTYLE, static_cast(style), static_cast(TRUE)); // Inform the dialog about the new default control ID. ::SendMessage(hWnd, DM_SETDEFID, pToButton->GetDlgCtrlID(), 0); // Get the style. style = pToButton->GetStyle(); // Add the default push button style. style |= BS_DEFPUSHBUTTON; // Set the new style. ::SendMessage(pToButton->GetSafeHwnd(), BM_SETSTYLE, static_cast(style), static_cast(TRUE)); } } Kuphryn
-
hello friends.. I am writing a Wizard application. now i want to change the default focus i.e if i press enter then the wizard automatically set the Next as default button and as this button gets press the app moves to the next Wizard page. But in between this i want to change the Default button to Cancel. that means when the user clicks the enter key then instead of the Next the Cancel key should be pressed. In short i want to change the Default button to Cancel instead of next.. Help Thanx TAKE CARE
I'm not sure, but I think SetDefID(IDCANCEL) would work.
-
I'm not sure, but I think SetDefID(IDCANCEL) would work.
sorry friend Philnessosity this doesnt Work !!!! Thanx TAKE CARE
-
One solution is SendMessage(). if (pFromButtom->GetSafeHwnd() && pToButton->GetSafeHwnd()) { DWORD style = pToButton->GetStyle(); if ((style & BS_DEFPUSHBUTTON) != 1) { style = pFromButtom->GetStyle(); // Remove default push button style. style &= ~BS_DEFPUSHBUTTON; // Set the new style. ::SendMessage(pFromButtom->GetSafeHwnd(), BM_SETSTYLE, static_cast(style), static_cast(TRUE)); // Inform the dialog about the new default control ID. ::SendMessage(hWnd, DM_SETDEFID, pToButton->GetDlgCtrlID(), 0); // Get the style. style = pToButton->GetStyle(); // Add the default push button style. style |= BS_DEFPUSHBUTTON; // Set the new style. ::SendMessage(pToButton->GetSafeHwnd(), BM_SETSTYLE, static_cast(style), static_cast(TRUE)); } } Kuphryn
Hi kuphryn Where this code should be written i mean in Initdialog or in PreCreate window ?? Thanx TAKE CARE
-
Hi kuphryn Where this code should be written i mean in Initdialog or in PreCreate window ?? Thanx TAKE CARE