Print Page | Close Window

Data validation and error handling

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=21806
Printed Date: 23 November 2024 at 7:17pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Data validation and error handling
Posted By: Mirek
Subject: Data validation and error handling
Date Posted: 21 July 2013 at 11:39am
Hi Oleg,
 
When validating a grid-item with an incorrect value, I want to make two steps:
Step A/ - Display an error message explaining the error
Step B/ - Return the focus on the grid item with incorrect value (CXTPPropertyGridInplaceEdit window)
While Step A is quite easy (overriding the CXTPPropertyGridItem::OnValidateEdit() or CXTPPropertyGridItem::OnAfterEdit()), I cannot find any mechanism for implementing Step B. The problem is that CXTPPropertyGridItem::OnValidateEdit() is usually called on CXTPPropertyGridInplaceEdit::OnEnKillfocus(), which can be invoked by a number of various actions (messages, commands, ...), and I do not know how to interrupt/cancel such actions after displaying an error message. For example, I have two MDI child-frames, using the same property grid. If I enter a wrong value into the grid and click on the second child frame, the program displays an error message correctly but, after that, it continues and activates the second frame, which is bad. The frame-activation should be canceled so that the user could fix the incorrect value in the grid. I would be able to solve it for this action type (MDI frame activation) but it does not make any sense because there are hundreds of other actions causing the same problem. I believe that there should be a standard mechanism in your Property Grid, solving this problem on a general level. Please let me know if you know a solution or if there is a XTP-example in which I could find a solution.   
Thank you
M.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net