.. or
in form initialization you make a loop trough all fields of the table and
get the data field object (dataSource.object(fieldnum)) and set it to
allowEdit = false, if it should not be editet or to allowEdit = true, if it
should be editable.
This is easy to implement and all controls inherit from the dataObject (even
controls which are added by user or created at runtime). And you don't have
to create edit methods and you can leave the design as it is defined yet.
I would disadvice to modify properties direct on the controls, since this
works not for runtime created controls and not in every case of form
modification by user (and even it's best practice violation too :).
Regards
Patrick
Post by unknown1) Disable all the controls. You can save doing it one by one by disabling
Groups. This will still require alot of work.
2) AllowEdit false on your datasource when field X is changed. And use an
edit method to update field Y.
I'd go with option 2... should be less code depending on how many fields
there are on the form.
--
Mathieu Vaillancourt
http://vaillancourtm.blogspot.com
Post by JohnnyYes, that is probably not an acceptable solution :-)
If I change this to the form level. Is it possible to lock all fields for
editing except for one?
Post by LuegisdorfHi Jonny
{
anyType fieldValueWhichCanBeChanged = this.YOURFIELD; // isloate the
field value, which should be updated
;
this = this.orig(); // reset the buffer to the last load state
this.YOURFIELD = fieldValueWhichCanBeChanged; // apply only the isolated
field value
super();
}
But: if someone skips the data methods or use doUpdate(), you cannot react
on it. And keep in mind, this technique is out of best practice and seems bad
concept ...
May be you find a better way (he he, or should I say: may you find a better
way :)
Regards
Patrick
Post by JohnnyI have a problem which I have not found a good way of solving.
I got a field X. If the field X is set then ONLY the field Y is allowed to
be updated. How can I make sure that only field Y is being changed when
updating the table?
I would prefer to do this on the table level.