Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Programmatically changing tabs

edited March 2019 in SRP Tab Control

Let's say I have 2 tabs, and I am currently in the first tab. To Programmatically switch to the other tab, you would do this:

Set_Property(@window:".OLE_TAB", "OLE.SelectedTab", 2)

This command does something, as the second tab icon becomes visibly selected, but the contents of the tab area does not change. It still displays the contents of the first tab:

Is there something else I have to do to get the contents of the second tab to load? The contents is an OI edit table, btw.


  • You need to execute the same code that you would if the user had clicked on the tab themselves.
    Set_Property(@Window, 'VPOSITION', 2)
  • Thanks, my work colleague also just told me that this is how you do it.

  • @SRPSupport
    i think you should add this to the documentation, as I would imagine this is a common use case. Or perhaps create a new tab method that does just this.
  • @josh I'm not disputing the usefulness of this kind of documentation, but it isn't something we would normally include with our control documentation for a couple for reasons. First, it's a specific implementation (or use case, as you worded it) of a control and normally we reserve blog articles or other medium for this. Second, I believe it is common knowledge that any UI that is used to change pages in an OI form has to use the VPOSITION property. This dates long before the SRP Tab control (i.e., back when people were use radio button controls as pseudo tab controls).

    Creating a method that interacts with the OI form in this way would be a cool feature, but I'm not sure that is easy to do. There are limits to what our controls can do internally to the OI environment itself.
  • @DonBakke

    ok , point taken. I have run into another issue however.

    When I call this:
    Set_Property(@window:".OLE_TAB", "OLE.SelectedTab", 2)
    my srp buttons disappear.

    Here is what my form looks like before I call that line of code:

    And here is what it looks like after:

  • Are you changing pages/vposition and are those buttons on all pages?
  • yes, i am also changing pages.

    The buttons are on all pages, and running that command doesn't screw everything up.
  • Not only did your buttons disappear, your tabs disappeared as well although the border for the tabs is still present. Curious.

    Unfortunately, this isn't much to go on. I'm very inclined to suggest this is a problem in your code.
  • @DonBakke

    hi, you're right there was a bug in my code.

  • They're sneaky buggers!!!
    See the world with wide eyes and wonder.
  • @josh I really appreciate the update on this. I'm glad you got this resolved.
Sign In or Register to comment.