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

setting tab control's properties not working in create event

For example, in the create event I have:

Set_Property(OLECtrlEntID, "OLE.TabVisible[1]", 0)

then the first tab is still visible when I open the form, so I have to place the code in other event, i.e have a button and place the code in the click event then it will work


  • Does the tab already exist before you call this property?
  • @DonBakke , it is in the create, not sure whether the tab is created or not at this stage
  • I think what Don means, is have you set the tabcount before trying to make the first one invisible?
  • Correct. You can't set the property of an item in the control if that item doesn't exist.
  • @AusMarkB

    Thank you guys, it woked after I set the tabcount. But there is still a problem:

    after I click a button, I want to switch from tab1 to tab2, so I use
    Set_Property(OLECtrlEntID, "OLE.SelectedTab", 2), but the content is still tab1 's content not tab2's content( though the tab2 will get the focus and selected, it just the content is still tab1's content), so I have to click tab1 first and then click tab2 to update the content, any way to fix this problem?
  • I'll assume that the form is a multi page form and when you refer to tab content, you are referring to the controls on the page of the form that coincides with the selected tab. If this assumption is wrong, then no need to read any further.

    The tab control itself has no inherent functionality. Think of it as a graphical tool only. You can use it to create all sorts of pleasant visual cues or simply backgrounds if you like but if you want anything to happen when the user clicks on it, you have to code it the same way as you would a button. Same goes if you programmatically select a tab, you still need to code what you want to happen. As you've noticed, setting the selected tab changes the appearance of the tab control. If you want to change the page of the form, then you need to do that yourself.

    Granted, the most common use of a tab control is to change pages of a form but this control is not limited to that and as such if that's what you want to do, then you must code it that way.
  • @AusMarkB

    so how do code in the way that change the page to another page, which property I need to set?
  • I guess I waffled too much. Sorry.
    Basically just trying to say it has nothing to do with the tab control and I thought by this
    so I have to click tab1 first and then click tab2 to update the content, any way to fix this problem?

    that you had already coded it for either the onClick or selchanged event.

    You need to set the vposition of the window to the page that you want.
    Set_Property(@Window, 'VPOSITION', tabno)
  • @AusMarkB

    Thank you, it worked :)
Sign In or Register to comment.