PDA

View Full Version : Best way to report errors in forms.



gbumgard
April 11th, 2006, 10:42 PM
I want to notify the user when invalid data is entered into a form. What is the best way to do this?

I'm currently using Win32 MessageBox.

-g.b.

Promixis
April 11th, 2006, 11:37 PM
I want to notify the user when invalid data is entered into a form. What is the best way to do this?

I'm currently using Win32 MessageBox.

-g.b.

not great :(

what kind of forms? how are they entering the data?

gbumgard
April 12th, 2006, 02:39 AM
I've got a ListBox (3 actually) containing a list of user-defined identifiers.
The identifiers are added to the ListBox by entering the identifier text in an EditBox and pressing a Button to add the identifier to the list. These identifiers are assocated with dynamically allocated objects maintained by the plugin.

The user cannot be allowed to add a duplicate name or a blank name. I'm using a MessageBox to display an error should the user attempt to do either of these.

I figure the message box is probably not the way to do this in girder (I was displaying them in completely separate threads when I was working on a girder3 plugin). However, the box does display, and girder continues on, but the message box window gets pushed behind girder shortly after it is displayed.

Promixis
April 12th, 2006, 06:17 AM
I've got a ListBox (3 actually) containing a list of user-defined identifiers.
The identifiers are added to the ListBox by entering the identifier text in an EditBox and pressing a Button to add the identifier to the list. These identifiers are assocated with dynamically allocated objects maintained by the plugin.

The user cannot be allowed to add a duplicate name or a blank name. I'm using a MessageBox to display an error should the user attempt to do either of these.

I figure the message box is probably not the way to do this in girder (I was displaying them in completely separate threads when I was working on a girder3 plugin). However, the box does display, and girder continues on, but the message box window gets pushed behind girder shortly after it is displayed.

The way I have done this (this is from lua using the treescript plugin) is too create a group which I can show or hide as needed with various buttons..

gbumgard
April 12th, 2006, 03:19 PM
Thanks for the quick response. Your approach makes sense.

I probably don't even need to use the tree script plugin. I can create the group in the form editor and use the C DUI calls to set the Visible attribute on the group. I'm going to try that first.

-g.b.

gbumgard
April 12th, 2006, 05:00 PM
OK, tried my approach and it seems to work fine.

I used the form editor to add the message box as a group that overlays the form. I had to place all of the controls on the form into a group to prevent some of the controls from being displayed over the message box (the static labels were doing that). I added an image, label, and button to the group.

I set the Visible attribute on the message box group to FALSE in the duOnOpen code.

I set the message label text and message box Visible attribute to TRUE when I need to display the message box. This only happens from within my duOnEvent code.

I set the Visible attribute to FALSE every time the duOnEvent is received. This hides the message box if any form interaction occurs. This means that the OK button does not have to be pressed to dismiss the box. This allows me to keep the underlying form visible without having to disable all of the event producing controls.