Has any information changed on the form

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Has any information changed on the form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:10 pm

by JADE News Administrator >> Thu, 29 Oct 1998 4:24:30 GMT

I have a form which consists of multiple textboxes; tables; and comboboxes. I need to test to see if anything has changed. Does anyone know of a way of doing this other than coding the Change method; or Concatenating the fields. Any suggestions would be appreciated.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Has any information changed on the form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:10 pm

by JADE News Administrator >> Thu, 29 Oct 1998 4:25:01 GMT

On our project, we found the simplest way was to concatenate the
contents of textboxes and list/table/combo items (including any oids), and storing the resultant value in a string after the form has loaded.

When the User does an undo or tries to close the form, we again concatenate the control contents, compare it against the previously stored string and handle the result accordingly. We've had no performance problems at all, and some of our forms a pretty complex.

I first tried iterating thru all of the controls on the form and concatenating the contents accordingly (based upon the type of control), but the time it took was quite noticeable, so we simply have a method on each form which directly references the desired controls.
--
Darrell Duniam
dduniam@cardinal.co.nz
www.cardinal.co.nz

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Has any information changed on the form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:10 pm

by Craig Shearer >> Thu, 5 Nov 1998 22:40:15 GMT

I think a worthwhile improvement to JADE would be for it to have a "formDirty" attribute which is immediately set to true when something on a form is changed. You could then have an event based on this, (or even a mapping method) which would allow you to detect changes.

Craig.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Has any information changed on the form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:10 pm

by Allistar Melville >> Sun, 22 Nov 1998 10:05:55 GMT
I think a worthwhile improvement to JADE would be for it to have a "formDirty" attribute which is immediately set to true when something on a form is changed. You could then have an event based on this, (or even a mapping method) which would allow you to detect changes.

One problem with this is that not all controls on the form should
cause the form to become dirty. E.g. option buttons which are used
solely for choosing how data is displayed in a table for instance - changing the value of these option buttons shouldn't make the form
dirty.

The way we have gotten around it is to subclass ALL editable controls, and use them on the form instead. This lets us code something on the sppropriate event on the control (e.g "change" for a textbox) which
then tells the form (which is also a superclass form that all forms
are subclassed from) that it has become "dirty". This can do whatever
you like, like enabling a save button/menu item on the form. This
works very well and means that once this structure is set up, no extra coding need be done per form.

Also subclassing controls/forms like this means that a lot of common
code can be placed on the superclass to save even more time with the individual instances of the control/form.

Allistar.

------------------------------------------------------------------
Allistar Melville (BSc) Home: allistar@ihug.co.nz \_
Software Developer Work: allistar@focussoft.co.nz </'
Auckland, NEW ZEALAND /)
Web: http://homepages.ihug.co.nz/~allistar/ (/`
`
"A wise man proportions his belief to the evidence." David Hume ------------------------------------------------------------------

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Has any information changed on the form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:10 pm

by Wilfred Verkley >> Thu, 11 Feb 1999 2:53:09 GMT

The problem with using sub-classes controls and forms that depend on each other, is that its difficult to re-use or adapt them for other projects.

Another way of doing it is to make a common method for the "change" event and link it to all the different controls on the form ie

create();begin

textBox1.setEventMapping ('change', 'textBox_change');
textBox2.setEventMapping ('change', 'textBox_change');
end;

textBox_change (textbox: TextBox input) updating;begin

global.beep;
end;

The beauty of this technique is that there is no tight coupling between the control and the form.

Of course, It would be much easier if you could specify event mappings in the form designer/painter. Maybe in Jade 5.0.....

...-->

Wilfred Verkley
Software Developer
Software Development
Wang NZ Ltd
DDI 9-3087788
Fax 9-3064600
Email wxv@wang.co.nz

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Has any information changed on the form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:10 pm

by BeeJay >> Tue, 23 Feb 1999 23:28:46 GMT
Of course, It would be much easier if you could specify event mappings in the form designer/painter. Maybe in Jade 5.0.....


You can specify event mappings in the properties dialog in the painter.

1) Open your form in painter.
2) Choose the textbox you want to set the event mapping on.
3) Display the properties dialog for this textbox.
4) Select the "Events" tab in the dialog box.
5) Type the name of the event method you want associated with "change".

If the event method does not exists currently you will get a dialog box asking if you want to create the method.

Cheers,
BeeJay.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Has any information changed on the form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:10 pm

by Paul Mathews >> Wed, 2 Dec 1998 8:07:43 GMT

In the CMSchema downloadable free from our WebSite
cmsystemsgroup.com.au we added the method somethingChangedInForm() to
the Form Class.

somethingChangedInForm() updating;

/* Dummy Method so that CMFCheckBox, CMFComboBox, CMFTable and
CMFTextBox when they use this method will always Compile.
However when these controls are used on a descendant of CMForm,
they use it's implementation of this method
which determines whether a table or formfields have been modified
when in Add or Change mode.
*/

In CMForm
somethingChangedInForm() updating;
somethingChanged := somethingChanged + 1;
end;

In CMFCheckBox::change(checkbox : CheckBox input) updating;
begin

// If we don't have this YOUR Local change event will be ignored !!
// Your local change event DOES NOT have inheritMethod(checkbox) !! inheritMethod(checkbox);
self.form.somethingChangedInForm();
end;

voila , Paul Mathews


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 12 guests