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
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
Comments
@DonBakke
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?
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.
so how do code in the way that change the page to another page, which property I need to set?
Basically just trying to say it has nothing to do with the tab control and I thought by this
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)
Thank you, it worked :)