4 Replies Latest reply on Jan 31, 2013 2:52 PM by BillPlunkett

    Tab Control and header table and detail table

    BillPlunkett

      Title

      Tab Control and header table and detail table

      Post

           This should be easy but I'm having way too much trouble.  I'm new to FM but an old hand in other environments (RealStudio and Delphi)

           I have a layout with a tab control.  on the first tab is header information for customer order.  second tab has a protal to the detail line item table.  Simple so far right.

           I really am have two different issues.  one I can work around but the other is a real problem.  First, the easy one.  I wanted to add a Button that said "Add Line Items" rather than having the user click the tab control.  I can't find how to script the button to change the active tab.  is this possible, if not then they'll just have to click the tab control.

           Here's the one I don't know how to work around.  How do you provide the user a way to add a new record to the DETAIL table.  Everything I do seems to add a new record to the Header table which the layout is based on.  How do you add to a different table?

            

           thanks in advance,

           bill plunkett

           FM Pro 12 Advanced, Mac Pro, Mountain Lion

            

            

            

        • 1. Re: Tab Control and header table and detail table
          philmodjunk
               

                    I can't find how to script the button to change the active tab.

               Enter layout mode.

               Click the tab control once to select the entire tab control.

               Click the specific tab panel for the detail portal to select it.

               Now enter an Object Name in the Name box found at the top of the Inspector's position tab.

               Now the script step: Go to Object can be used to select that tab panel if you enter the exact same name into this script step.

               

                    How do you add to a different table?

               Assuming that your layout is based on a table named Invoice...

               Freeze Window
               Set variable [$ID ; Invoice::__pkInvoiceID  //use your field name for the primary key instead of mine]
               Go to Layout ["Line Items" (Line Items )]
               New Record/Request
               Set Field [LineItems::_fkInvoiceID ; $ID ]
               Go To Layout [original layout]
               Go to Object ["specify name of desired tab panel here"]

          • 2. Re: Tab Control and header table and detail table
            BillPlunkett
                 

                      "Go to Layout ["Line Items" (Line Items )]"

            But the detail table is displayed in a protal on the same layout as the header file.  Do I have to use 2 different layouts?

                  

            thanks,

            b

            • 3. Re: Tab Control and header table and detail table
              philmodjunk

                   You don't absolutely have to, but it makes for much simpler scripting and the script is a bit less sensitive to the current design of your layout.

                   If you don't use that method, you have to enable "allow creation" for the portal in it's relationship to the layout's table and your script must use go to portal row [Last] to put the focus in the bottom 'add' row of this portal. Then Set Field can populate a field in this portal row to create a new record. But this, IMO, is much less desirable than using the change in layouts.

              • 4. Re: Tab Control and header table and detail table
                BillPlunkett

                     Ok, that's what I'll do.  Thanks so much for your help.  

                     This is a great forum to quickly get help from knowledgable users.

                     thanks again,

                     b