Moving or inserting a tab

Docking/MDI for Windows Forms Forum

Posted 18 years ago by Domenico
Avatar
I wrote a simple test application for the TabStrip control.
I want to add a TabStripPage in a given position, but both these instructions

TabStrip1.Pages.Insert(index, tabPage)
or

TabStrip1.Pages.Add(tabPage)
TabStrip1.Pages.MoveTo(tabPage, index)
always put the tabPage as the last tab, not in the specified position.
Only when I click on an unselected tab, my tabPage goes in the desired position.

I'm using .Net Framework 1.1 and Actipro 2.0.0062.

Thanks

Comments (4)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I tried it in our test application in the TabStripForm by putting these lines at the end of the constructor and it worked as expected:
TabStripPage p = new TabStripPage("TEST", "TEST", null);
tabStrip.Pages.Insert(1, p);
Are you able to repro the problem in our sample project? If so, please post how. Thanks!


Actipro Software Support

Posted 18 years ago by Domenico
Avatar
I was able to reproduce the problem in your sample project. In the TabStripForm I simply add a button and the following code

    Private Sub newTabButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles newTabButton.Click
        Dim p As TabStripPage

        p = New TabStripPage("TEST", "TEST", 0)
        tabStrip.Pages.Insert(1, p)
    End Sub
and the new tab page is always inserted in the last position. Only when a redraw of the TabStrip is needed, the tab goes in the right position.

Thanks
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ahh, I can dupe it now. Must be that in the constructor there still was a layout occurring that worked around the problem.

Ok, this will be fixed for the next maintenance release but in the meantime, add this code right after the insert:
tabStrip.Invalidate(InvalidationLevels.ElementAndChildren, InvalidationTypes.All);


Actipro Software Support

Posted 18 years ago by Domenico
Avatar
Ok, now it works.
Thank you.
The latest build of this product (v24.1.0) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.