I've been asked to look into a project with a TcxMaskEdit component that's throwing some problems. The main one is this:

The user is expected to hit tab to move between fields. The TcxMaskEdit in question is the last field, and it is suspected that the user will hit enter at this point to enter the record. It is possible for this field to be left blank, so in the OnExit event, if the field is empty a popup dialogue is given, asking whether or not this was intended. (Might have been done accidentally.) If the dialogue is answered with 'no', then the focus is supposed to be set back to the TcxMaskEdit field. Otherwise, focus is set to the submit button.

On leaving the TcxMaskEdit field with a Tab, the field remains enabled, and the SetFocus call works nicely. On leaving the field with an Enter, the field becomes disabled, causing the SetFocus call to throw an error. (Can't set focus to an invisible or disabled object.) Anyone have any clue why this difference occurs, or what needs to be done to stop it? I've cludged in an automatic component.enabled event right before the SetFocus call, but I'd prefer to find some way of not having to use that if possible.

Any suggestions?

Edit: Just noticed another change. Hitting Tab to exit the box, then cancelling at the popup, will leave the data in the other fields. Hitting Exit then cancelling appears to clear them all out. Anybody got any good ideas of why this is so?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.