question regarding the order in which methods are triggered

I have a question regarding the order in which methods are triggered.

My method:

var selected = cont_id
var contact = forms.contacts.cont_id

forms.contacts_join.controller.showRecords()
forms.contacts_join.controller.find()
forms.contacts_join.conjoin_rel1 = selected
forms.contacts_join.conjoin_rel2 = contact
forms.contacts_join.controller.search()

var found = forms.contacts_join.controller.getMaxRecordIndex()

if(found >= 1)
	{
	var message = i18n.getI18NMessage('coperta.dialog.contactjoin.text.already', new Array ())
	}
else
	{
	if (selected == contact)
		{
		var message = i18n.getI18NMessage('coperta.dialog.contactjoin.text.same', new Array ())
		}
	else
		{
		var message = i18n.getI18NMessage('coperta.dialog.contactjoin.text', new Array ())
		}
	}

globals.g_contact_dialog = message

forms.nav_user_main.controller.showRecords()
forms.nav_user_main.elements.tabs_dialog.visible = true
application.output("select_cont tab_dialog visible true")
forms.nav_user_main.elements.tabs_dialog.tabIndex = 2

The form nav_user_main triggers another script onShow with, among other things, these lines:

forms.nav_user_main.elements.tabs_dialog.visible = false
application.output("open_contacts tab_dialog visible false")

When I run the script using the debugger with breaks on, it gives me the following output:

open_application tab_dialog visible false
select_cont tab_dialog visible true

and everything works fine. But when I use the debugger without the breaks and run the script like it is normally run, it gives me:

select_cont tab_dialog visible true
open_contacts tab_dialog visible false

It seems to me that the order in which the scripts are triggered is changed. Is there a way to edit the order, so that it would run like it is when the debugger breaks are on? Or is there a way to disable the onShow option in a script?

Let me see if I got the idea:

  • you have a tab panel in form “A” that contains forms “B” and “C”
  • in “onShow” for “B” you hide the tab panel
  • you also have a method that shows (sets to visible) the tab panel and changes the tab to a certain tab (constant) - let’s say tab for “B”.

You would expect that when the tab panel is set to visible (after it was invisible), onShow from “B” would get called and the tab panel made invisible. Am I right?

In fact, two things can happen:

  1. if the tab panel was invisible and it’s selected tab was “B”, running the method would result in nothing else but the tab panel being shown.
  2. if the tab panel was invisible and it’s selected tab was “C” then running the script would result in the tab panel being shown, tab “B” being selected => onShow that hides the tab panel again.

In other words, if you hide/show a tab panel, the currently selected form in the tab-panel does not normally fire onShow.