Objective Grid: Creating a CGXMaskControl-derived control

Article ID: 517
Last updated: 16 Apr, 2018
Article ID: 517
Last updated: 16 Apr, 2018
Revision: 3
Views: 1802
Posted: 12 Jan, 2001
by Meltreger B.
Updated: 16 Apr, 2018
by Meltreger B.

Problem


How can I create a new control that is derived from CGXMaskControl? I want to extend the mask character set and modify the behavior.


Cause



Action


Here are some steps how you can subclass CGXMaskControl:

  1. Derive class from CGXMaskData. Make sure to insert DECLARE_DYNCREATE in the class declaration.
  2. Override the IsCharValid() and IsMaskChar() member functions.
  3. When registering the mask control in OnInitialUpdate(), pass runtime class information for your CGXMaskData derivative to the CGXMaskControl constructor.

Example:

RegisterControl(GX_IDS_CTRL_MASKEDIT, new CGXMaskControl(this, GX_IDS_CTRL_MASKEDIT, RUNTIME_CLASS(CMyMaskData)));

The IsCharValid() is the method that let's you validate and adjust individual characters.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 517
Last updated: 16 Apr, 2018
Revision: 3
Views: 1802
Posted: 12 Jan, 2001 by Meltreger B.
Updated: 16 Apr, 2018 by Meltreger B.

Others in this category