showformInDialog not working

I have a form displayed as a list view a button on the left side that launches the following method

application.showFormInDialog(forms.popup_comment,-1,-1,-1,-1,'Comment',true,false,'Status Legend',true);

Which works

But when I place this layout on a tab panel and click on the button to launch the method it will only show one record, no matter which row i click on.

For example, if i first click on the first row (“indy”) below, the correct record will show (“indy”) in showFormInDialog. However, when i go to click on the 2nd row “star wars”, the showFormInDialog will launch and still show “indy”.

Icon____ID_____Commment
_x______1_______indy
_x______2_______star wars
_x______3_______the empire strikes back

any ideas?

David

Details:
OS: Windows XP SP2
Servoy: Version 3.5.6-build 519

Main Layout is based on table: core_rso_emp
TabPanel Layout is based on table: core_rso_comment

Relationship based on the emplid column in main table (core_rso_emp)
core_rso_emp to core_rso_comment
emplid ---------< emplid

does forms.popup_comment has the same relation in it that the tab panel where you click on?

forms.popup_comment.controller.loadRecord(tabpanel.foundset)
// show

Hi Johan,

I don’t understand your question.

I have a Form based on a comment table and an icon in one column that lauches a method with the following code:

application.showFormInDialog(forms.popup_comment,-1,-1,-1,-1,'Comment',true,false,'Status Legend',true);

Which works. But when I place this form in a tab it doesn’t work. The tab shows the correct records that are related, but when i launch the method it doesn’t show the correct record in the showFormInDialog

The relationship to actually place the tab on the other form is correct, since the correct related records are displayed.

Here is the screen shot of the form, from which the methdo works just fine:

Here is the screen shot in which the same form is used in a tab panel, but notice which row is highlighted in the background and which record is actually shown in the dialog pop-up:

One way to solve this is with an onAction method that loads that line item record’s primary key into a global. Then finds that record using the global, then shows the FID.

This is pretty bombproof but there may be a more elegant solution.

Hope this is helpful. K

What Johan is saying is that your tab panel form and form in dialog form need to share the same foundset to show the same records.

Forms based on the same table share the same foundset unless:

  1. when the source and/or destination form has the “useSeparateFoundSet” property checked
  2. when the source and/or destination form is being viewed through a relationship

In your case, one of your forms if viewed through a relationship (the tab panel one), and your form in dialog form is not.

So you need to transfer the foundset from the tab panel form to your form in dialog form:

forms.dialogFormName.controller.loadRecords(forms.tabFormName.foundset)

Hi David,

Ok, so how exactly do i transfer the foundset to the tab panel?

Main Form name is: form_RSO_Customers_Details
Relationship from Main form to tab is: core_rso_emp_to_core_rso_comment

Tab panel form name is: tab_comments

The button that launches the method is on the form named tab_comments

forms.yourformname.controller.loadRecords(nameofyourfoundsetorrelationorwhatever).

This is documented btw :)

so yeah… i checked the manual and still can’t this to work correctly…

here’s the code:

forms.form_RSO_Customers_Details.core_rso_emp_to_core_rso_comment.loadRecords(foundset)

application.showFormInDialog(forms.popup_comment,-1,-1,-1,-1,‘Comment’,true,false,‘Comment’,true);

-david

what is this: ore_rso_emp_to_core_rso_comment ?

Is it a relation?

When you want to load records into a form it should be:
forms.form_RSO_Customers_Details.ccontroller.loadRecords(foundset)

you are still seem to set it the wrong way around
you are showing the form: forms.popup_comment

so what you should right before your show form code:

forms.popup_comment.controller.loadRecord(tabpanel.foundset)

it seems that you try to do it the other way around…

that tabpanel.foundset should then be the foundset/relation of that tabpanel that you want to see

So if you are in the tabpanels itself where you do show dialog you can just do:

forms.popup_comment.controller.loadRecord(foundset)

if you are somewhere else for example in the parent form of the tabpanel you should do something like this:

forms.popup_comment.controller.loadRecord(this_is_the_tab_relation)

then do

application.showFormInDialog(forms.popup_comment,-1,-1,-1,-1,‘Comment’,true,false,‘Comment’,true);

thanks for the replies,

I got it to work with this:

forms.popup_comment.controller.loadAllRecords();
forms.popup_comment.controller.find();
forms.popup_comment.core_rso_comment_id = core_rso_comment_id;
forms.popup_comment.controller.search();

application.showFormInDialog(forms.popup_comment,-1,-1,-1,-1,'Comment',true,false,'Comment',true);