Empty foundset onLoad/onShow in (relationless) tabpanel

Hi,

Trying to get a form in a (relationless) tabpanel to show with an empty foundset.

Tried the following:
1- setting onShowAllRecordsCMD to “none”: This normally (imho) results in an empty foundset when the form is loaded. In a (relationless) tabpanel, this doesn’t work, because all records are loaded (if you view the form directly, indeed no records are loaded).

2- attach an onShow method with a clearFoundSet command to the form. Works fine the first time, but (after I set the foundset explicitly based on a relation decending from another form) this results in a “clearing a related foundset is not possible” error in the console and an error icon in the status bar

3- attach an onLoad method with a clearFoundSet command to the form. Doesn’t work, foundset remains all records (I assume the fouyndset gets set automatically after the onLoad method has fired.

So, how do I achieve the desired effect?

And what about scenario 1? Is this a bug or expected behavior?

Paul

In addition to scenario 2: Clearing the foundset with the onShow command makes the GUI show the foundset just briefly before clearing it, so it doens’t look nice.

Paul

Hello Paul,

regarding your approach #2 you should load all records before clearing the foundset. Loading all records should un-related the foundset. Then it can be cleared. But yes, there remains an ugly short flicker on the screen…

Bascially you are asking for the ability to add related tabs, no?

:D You catch my drift… Yes, that would throw this entire workaround overboard.

But, i have been told by people who know, that adding of related tabs at runtime will not be possible…

I myself cannot figure out why it cannot be done, but then again, I cannot look under the hood.

So, I have to live with a workable workaround, one that I haven’t found yet… first LoadAllRecords, before being able to clear the foundset seems a bit overdoing it… And it makes the screen flicker…

Paul

And it makes the screen flicker…

If you are building it for ex-Filemaker customers?
no problem!
They are used to it! :lol:

Noop, I don’t do FileMaker… Gave it a try once, couldn’t figure it out in five minutes how it worked… :x

Spoke the guy who said adding related tabs at runtime wasn’t possible and he forwarded me to the guy who would really know and his question was: Why do you need to add related tabs at runtime? Because at runtime you would need to know all the data, like which relation to use and if you know that allready, you can add the related tab in designmode…

So, why do you need to have the ability to add related tabs at runtime? here are a couple of scenario’s:

1: A multiUser, Multi Company system, where users might have rights to access data for multiple companies. the configuration for which data is shown differs per Company, so when the a user looks at data for COmpany 1, tabs A,B and C are shown (all related tabs). Then the users looks at data for Company 2 and only tabs B and C can be shown (so you remove tab A). Then the User goes back to looking at data for Company 1, so tab A needs to be added again…

2: A ProductOffering module, where I have a table called Products, with a Column called Type. I want to show a TabPanel with per Type of product 1 tab. Since Admin users can define new Product Types, I need to be able to add more tabs depending on the number of product Types defined.

3: A FrameWork solution, where others can add extra functionality by building new forms in a specific module. By registering the new forms in a table, with the proper data and using addTab functionality build into the FrameWork solution that adds tabs to tabpanels based on the data in this specific table, the forms designed inside the module are displayed, without giving the designer of that form access to the main solution

Maybe somebody else has more scenario’s?

To me the argument that you can add the related tabs at designtime, because you need certain information doesn’t really fly. Dynamic GUI’s is the keyword here, offering different users a different GUI, based on specific configuration.

The argument that for related tabs you need to knwo certain information that you allready have available at designtime also goes for the current situation where you can add relationless tabs. The only extra thing that you need to know is the relation, I think. The argument could have been used for adding relationless tabs, but apparently, adding relationless tabs at runtime was deemed a nessecity :)

If there would be a function to hide/show an existing tab, this would solve scenario 1, but wouldn’t help for scenario 2 or 3.

All in all, I think the ability to add related tabs at runtime would be a good addition to the current functionality.

Maybe this could be done by specifying the relation when adding the tab, or by making

forms['xxx'].controller.loadRecords(relation) 
``` change the selection in the child form, when the selection changes in the parent form (currently, according to my experience, when you call this function, the foundset of the child form is set to the correct related foundset based on the selection in the parent form, but when the selection changes in the parent form, the foundset in the childform remains as is, untill you call this function again).

So, a long story. I hope it sheds some light on the reason for wanting to add related tabs dynamically. It goes a bit off topic (my issue with getting the foundset empty on the form in the relationless tab still stands).

Paul

haven’t read the complete thread completely yet.

But i think you think wrong. If you want the tab to be relational. Then you don’t have to do things in the tab. But in the parent of the tab.
So the parent of the tab must have an onShow and onRecordSelection. method that does the clear or sets the related wanted data for the selected record.

The situation I have is probably one that is out of the ordinary…

Both the parent and child form are in their own TabLess TabPanel as relationless tabs.

The two tabless tabpanels are added into a JSplitPane as top and bottom component.

The reason I need to have an empty foundset by default on the childform, is that it’s possible to look at the childform, before the parent form is shown or even loaded. so, since the parent form doens’t have a selected record, the childform should not show any records.

On onShow event on the parent form therefor doesn’t do the trick, because it might not have been fired before the childform is shown.

The onRecordSelection event (offcourse) needs to be registered on the parent form, which I have.

Paul

So Johan, did you have time to read the rest of the post explaining the scenario’s where the adding of related Tabs at Runtime is required?

Also, how to achieve the empty foundset on the (child) form properly, if the form is in an unrelated tab? (as described, setting the onShowAllRecordsCMD to “none” seems to have no effect, since all records are loaded anyway).

Paul