onRecordSelection oddity

Not sure this is bus so I’m posting it here. I got two forms based on the same table. On form A there is a tabpanel that displays form B. So far so good.

Now, if i’m on form B and do some record manipulation (show omited, show all, etc) the onRecordSelection method of form A is executed.

It’s not bothering me since I actually don’t use form B directly but wanted to know if it’s normal behavior.

Ronnie

Servoy 2.0 RC13
MacOS 10.3.3

Just noticed similar behavior in this situation:
form A (record view) and form B (list view) based on same table, form A has a onRecordSelection method assigned but form B does not.

If you select a record on form B, having loaded form A first, the onRecordSelection of form A is executed.

Ronnie

Servoy 2.0 RC13
MacOS 10.3.3

onRecordSelection is triggered on table level (not on form level).

to make it more clear:

foundsets are shared over forms (or you have set yourself a relatedfoundset in the form or you have set the property useSeperateFoundset)

and if you have loaded form A and then go to form B both based on the same table. Then they have the same foundset. So if you are changing the selected foundset in B then A will also change. We have to execute onRecordSelection then for A because if you do something like testing data and on that data you color or set the visibility of elements. Then you expect that when you go again to form A that form A has the right visual state for the selected record!

Thanks guys, this clarifies things; I have some code editing to do ;)

A couple of notes:

1- Maarten’s comment should be included in Servoy’s help under the onRecordSelection definition as a note.

onRecordSelection is triggered on table level (not on form level).

I’d like it more if it would be on a form level.

2- Is there a way to just load a form without showing it? if not, Servoy could use a controller.load() to make form’s onRecordSelection method available to other forms.

Again, thaks.

it is on form level…

because the form does get an record selection change… It doesn’t matter that it is currently not showing.. that is not importand..

if you want a form to be there.. then you can call loadAllRecords or loadRecord on it with a foundset..

Then the form is “live” and wil get selection events if it als shares a foundset you are viewing in other forms.

I’ve solve my problem with

if(currentcontroller.getName() == controller.getName())

on each of my onRecordSelection methods; this insures that only the active form executes it’s method.

Thanks for your help

Hi All,

It would be nice if we could specify that the onRecordSelection even run for just this form (i.e. not cascade) as part of the property - rather than having to add code to EVERY SINGLE onRecordSelection method.

Just my $0.02,

Bob Cusick

onRecordSelection always runs just for that form. Where should i run in otherwise??

But in 2.1 only recordSelection will only be fired for the visible form.