Forum Discussion

JackSparrow's avatar
JackSparrow
Frequent Contributor
8 years ago

Navigation of the tabs on Delphi Application

Hi all,

 

I need to navigate number of tabs in a panel(Aliases.Teachers_debug.frmMaintainDeal.TPanel.tabDeal) , in object browser I saw so many method like TabClick(Ashift,Param1,Param2) and SelectNext(GoForward,Param2,Param3) , TabDown(Param1,Param2),Tabup(Ashift,Param2), but I didn't understood what parameters need to be given for these parameters.

 

Can anyone help me on this

 

9 Replies

  • Depends what kind of control they're using to manage their tabs?

     

    In my Delphi app, they use a "TPageControl" object. This has an "FTabs" property. Which contains the list of tabs within the control container with new line separators.

     

    So I have to extract these into an array. Find the one that matches the text I want. And then set the "ActivePageIndex" property of the control container to the index number of the matching tab. I think there is a method that allows you to set the active tab by name (SetActivePage or ChangeActivePage). But, as all my stuff is user data driven, I prefer to validate first which is why I do it the way I do. It makes sure a valid tab has been specified before it tries to switch to it.

     

    You could use a direct method, but I would want error trap[ping round it in case a bad tab name is specified.

     

    But this may be completely different for you. Depending on the tab controller in use.

     

    • JackSparrow's avatar
      JackSparrow
      Frequent Contributor

      Colin_McCrae

       

      Actually Aliases.Teachers_debug.frmMaintainDeal.TPanel.tabDeal.tabDayparts.click() or Aliases.Teachers_debug.frmMaintainDeal.TPanel.tabDeal.tabDayparts.SetFocus() is working but the tab is invisible so it is unable to change , so is there any way to change the properties of the tab from visible true to false or vice verse

       

      OR

      How to activate an invisible window

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        You're posting Alias names. These don't help me as I have no idea what they are.

         

        In my Delphi application, as I mentioned, I have a "TPageControl" object (this is the class name) which is the container for all the tabs on that panel. This has child objects which are all the tabs. They are of class "TTabSheet". I find them,validate them and activate them using the TPageControl object, not directly. If I want to check if an individual tab is active, I check it's visibility and focus states. But, as I say, control is all done via the controller/container object.

         

        Without knowing the class names of your objects, I have no idea of knowing what you're working with and therefore no idea how you would interact with it.

         

        Also - your Alias reads these are nested tabs. You have tabDeal then tabDayparts. For me, this wouldn't make any difference. There would simply be two TPageControl objects. The second being a child object of one of the tabs on the first. No idea how this looks for you ...