forms in tabpanel with no records

Hi folks,

I’ve created a navigator menu with tabpanel. It works like a charm.
Question: when in a form I haven’t records, I could hidden the structure (design) of the form?

example: tabpanel with form1, form2 and form3. Form1 has 3 records with relations with the ‘master’ record on generic form. Form2 nothing. Form3 2 records. Well, Form2 has normally a structure. It’s possible to hidden the form2 when there aren’t records?

I hope that’s clear.
Regards
Andrea

Just thinking loudly here..
I think what you want is to hide or disable the tab if there are no records in the form, the structure itself stays like it is.
This can be achieved - I think - if you make your own tab-buttons.
Then make a method that checks all the tab forms on zero records.
This (refresh) method has to be triggered every time you do some kind of action: eg. clicking a tab button.
Include in the method a disable or hide instruction for the tab-button(s).

HTH

Ron

disabling is possible with standard tabpanels. hiding not!

both is possible, if you make your own tabs, the way Ron is describing.

Thanks guys,

how could I disable a tab with standard tabpanel?

thanks for all
Regards
Andrea

give the tab a name.

than in the editor, you can do this:

elements.tabpanel_name.enabled = false

Ron:
Then make a method that checks all the tab forms on zero records.

ehmm … sorry Ron,

have you an idea for me to do that?
I would use the method suggested from HJK, but how could I say “in my standard tabpanel, when I click on the first tab button (the most important form), please check the other tabs, and if records=0 use the HJK method” … ?

It’s possible? or not?
thanks for any suggestion
Regards
Andrea

Yes is possible! Mostly your tabpanels are related data.
You can do a check on that.

for example:

if(customers_to_adresses.getSize() == 0)
{
elements.tabpanel_adresses.enabled = false
}
if(customers_to_contacts.getSize() == 0)
{
elements.tabpanel_to_contacts.enabled = false
}

or if your tabpanels not related do this:

if(forms.adresses.foundset.getSize() == 0)
{
elements.tabpanel_adresses.enabled = false
}
if(forms.contacts.foundset.getSize() == 0)
{
elements.tabpanel_adresses.enabled = false)
}

Hope this helps

HJK:

Don’t you have to use IF (false) ELSE (true) statements?
Once a tabpanel is disabled, it stays that way. :wink:

BTW, the way you do it, the entire tabPANEL is dis/enabled.
I thought we were talking about those little tabBUTTONS?
I gave it a try: gave the tab(button) a name in the properties, but it did’nt show up as an element in the editor. Am I missing something?

Don’t you have to use IF (false) ELSE (true) statements?
Once a tabpanel is disabled, it stays that way. :wink:

It is just an example. We should’nt give away all the fun! :wink:

I gave it a try: gave the tab(button) a name in the properties, but it did’nt show up as an element in the editor. Am I missing something?

refresh in editor!!

I did refresh, but it just won’t show up.
One would expect that after giving the name-property to an object, it should always appear as an element in the editor.
Can you give it a try?

I am sorry, that’s not going to work!

Try this:

elements.tabPanel.setTabEnabled(3,false);

in this example tabpanel 3 is disabled!

(see under elements of the tabpanel!)

I was going too fast! :lol:

I was going too fast!

No problem, this code works OK. :lol:

thanks guys,

just a question: how could I say “use that method for tab2 tab3 and tab4 when I go to the previous or the next record in tab1?”

It’s possible?
Thanks for all
Regards
Andrea

connect the method to the onShow and on to the onRecordSelect property!

HJK:
connect the method to the onShow and on to the onRecordSelect property!

well, it works like a charm only for the first record.

Situation:

general_form and tab1 from the same table.
tab2, tab3 and tab4 related
tab1 has the controller.
I’ve connected the method to the onShow and onRecordSelection in the general_form, but I use the tab1 controller.

For the first record, the method works correctly. When I change record, I see the tabs as the first record, and not as that record.
Where is my mistake?

Thanks for suggestions
Regards
Andrea

can you give us a screenshot? I don’t understand what you are doing.

in this case, for record 1 “progetti” and “documenti” = 0 records.
That’s correct.
But if I change record (example, record 2), I see always “progetti” and “documenti” = 0, while “progetti” = 3 records.
Refresh??

thank you very much
Regards
Andrea

ah, you have connected , the method to the main form?
connect it onShow and onRecordselect of form: clienti

Beacuse THAT is the form, where you change and show the records!

HJK:
ah, you have connected , the method to the main form?
connect it onShow and onRecordselect of form: clienti

Beacuse THAT is the form, where you change and show the records!

probably the method is incorrect, because I receive that error:

Could not perform form method ‘tabview’
The undefined value has no properties

the ‘tabview’ method is that:

if (clienti_ana_to_fatture_mod.getSize() == 0)
{
elements.navigator.setTabEnabled(2,false)
}
if (clienti_ana_to_progetti_mod.getSize() == 0)
{
elements.navigator.setTabEnabled(3,false)
}
if (clienti_ana_to_documenti.getSize() == 0)
{
elements.navigator.setTabEnabled(4,false)
}

I haven’t navigator in ‘clienti’ elements!

HJK:
ah, you have connected , the method to the main form?
connect it onShow and onRecordselect of form: clienti

Beacuse THAT is the form, where you change and show the records!

Now I’ve connect the method to the form:clienti, now there isn’t a message error, but it doesn’t work

My method:

if(clienti_ana_to_fatture_mod.getSize() == 0)
{
forms.navigator.elements.navigator.setTabEnabled(2,false)
}
if(clienti_ana_to_progetti_mod.getSize() == 0)
{
forms.navigator.elements.navigator.setTabEnabled(3,false)
}
if(clienti_ana_to_documenti.getSize() == 0)
{
forms.navigator.elements.navigator.setTabEnabled(4,false)
}

Could you help me?
Thanks for any suggestion
Regards
Andrea