How to validate data in property sheet.
-
Dear all, I am developing one application containing propertysheet. I want to validate the data that user enters in property pages. The problem I am facing is, when user enters wrong data, I validate this data in property page "OnOK" handler and corresponding message is shown to user. But when user clicks OK button on message box, message box as well as propertysheet get closed. I want this propertysheet remain open so that user can correct the wrong data entered. How to do this? Thanks in advance.
-
Dear all, I am developing one application containing propertysheet. I want to validate the data that user enters in property pages. The problem I am facing is, when user enters wrong data, I validate this data in property page "OnOK" handler and corresponding message is shown to user. But when user clicks OK button on message box, message box as well as propertysheet get closed. I want this propertysheet remain open so that user can correct the wrong data entered. How to do this? Thanks in advance.
Maybe you should do the validation in
OnKillActive
handler of property page. According to documentation, "override this member function to perform special data validation tasks". You have to display your error box here and then return FALSE if data are invalid. -
Dear all, I am developing one application containing propertysheet. I want to validate the data that user enters in property pages. The problem I am facing is, when user enters wrong data, I validate this data in property page "OnOK" handler and corresponding message is shown to user. But when user clicks OK button on message box, message box as well as propertysheet get closed. I want this propertysheet remain open so that user can correct the wrong data entered. How to do this? Thanks in advance.
If the validation fails, exit the OnOK and do NOT call the OnOK function in the Paerent class. There are better solutions for validation. Each time a field is updated, you should check wheter the information is valid. As long as not all information is valid, you can disable the OK button. Think of handlers like EN_CHANGE (EDIT field) or SELCHANGE (Listbox) etc. I normally add to each dialog a member function to do all validations. It is called each time the user changes anything.
-
Maybe you should do the validation in
OnKillActive
handler of property page. According to documentation, "override this member function to perform special data validation tasks". You have to display your error box here and then return FALSE if data are invalid.