SetRange for CSpinButtonCtrl
-
Hi, I am a new to C++ MFC design so thanks in advance for the inputs. I am wondering if anyone can tell me where is the best place to put the SetRange(int, int) command for a spinner inside a modeless propertyPage. I understand the usual place is in OnInitDlg. However, I don't think there is a similar OnInit function for my property page/sheet. Thanks! ;)
-
Hi, I am a new to C++ MFC design so thanks in advance for the inputs. I am wondering if anyone can tell me where is the best place to put the SetRange(int, int) command for a spinner inside a modeless propertyPage. I understand the usual place is in OnInitDlg. However, I don't think there is a similar OnInit function for my property page/sheet. Thanks! ;)
OnInitDialog is OK, assuming that range remains the same during the lifetime of your object. Tomasz Sowinski -- http://www.shooltz.com.pl
-
OnInitDialog is OK, assuming that range remains the same during the lifetime of your object. Tomasz Sowinski -- http://www.shooltz.com.pl
Yes, I would put SetRange in OnInitDialog too in a heart beat, but CPropertySheet class does not have the OnInitDialog function for me to inherit like in CDialog... so I'm lost for ways there.
-
Yes, I would put SetRange in OnInitDialog too in a heart beat, but CPropertySheet class does not have the OnInitDialog function for me to inherit like in CDialog... so I'm lost for ways there.
Just use this:
BOOL CYourPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// your stuff here
return TRUE;
}Tomasz Sowinski -- http://www.shooltz.com.pl
-
Just use this:
BOOL CYourPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// your stuff here
return TRUE;
}Tomasz Sowinski -- http://www.shooltz.com.pl
Hmm.. there is no OnInitDialog() fcn in CPropertyPage or any of its parents. This exactly what I am stuck on. I know I can initialize my SetRange in OnInitDialog if I had a dialog, but I don't I have a CPropertyPage. btw, the tree for these classes is: . . . . . . . . . . . . . . . . . . . . . . . .-> CDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . / . . . . . . . . . . . CObject -> CCmdTarget -> CWnd -<. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . \ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-> CPropertySheet. . . So there's no OnInitDialog for CPropertySheet.
-
Hmm.. there is no OnInitDialog() fcn in CPropertyPage or any of its parents. This exactly what I am stuck on. I know I can initialize my SetRange in OnInitDialog if I had a dialog, but I don't I have a CPropertyPage. btw, the tree for these classes is: . . . . . . . . . . . . . . . . . . . . . . . .-> CDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . / . . . . . . . . . . . CObject -> CCmdTarget -> CWnd -<. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . \ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-> CPropertySheet. . . So there's no OnInitDialog for CPropertySheet.
CPropertyPage derives from CDialog - your tree is not based on facts :) . If you insert CPropertySheet::OnInitDialog() into CYourPage::OnInitDialog, the CDialog::OnInitDialog will be called. Anyway, if you don't want to use OnInitDialog, use OnSetActive or DoDataExchange instead. Tomasz Sowinski -- http://www.shooltz.com.pl
-
CPropertyPage derives from CDialog - your tree is not based on facts :) . If you insert CPropertySheet::OnInitDialog() into CYourPage::OnInitDialog, the CDialog::OnInitDialog will be called. Anyway, if you don't want to use OnInitDialog, use OnSetActive or DoDataExchange instead. Tomasz Sowinski -- http://www.shooltz.com.pl
Ah, yes you are correct! I was looking into the wrong place -- the CPropertySheet, instead of CPropertyPage. Thanks! My spinner works like a charm now :)