|  | 
| [solved] TabControl - problem with closable Items | 
| Post Reply   | 
| Author | |
| readypro   Groupie   Joined: 01 March 2011 Status: Offline Points: 14 |  Post Options  Thanks(0)  Quote  Reply  Topic: [solved] TabControl - problem with closable Items Posted: 16 May 2011 at 9:20am | 
| 
   IDE : VB 6.0 Suite Control v.15.0.1 The NavigateButtonClick event of the TabControl control seems to return always 2 as the ID of the tab being closed Sample code (put 1 commandbutton and 1 tabcontrol on a form) Private Sub Command1_Click()     Dim newTab As TabControlItem     TabControl1.ShowCloseItemButton = xtpTabItemButtonAlways     TabControl1.RemoveAll     Set newTab = TabControl1.InsertItem(0, "1st tab", 0, 0)     newTab.Closable = True     Set newTab = TabControl1.InsertItem(0, "2nd tab", 0, 0)     newTab.Closable = True     Set newTab = TabControl1.InsertItem(0, "3rd tab", 0, 0)     newTab.Closable = True End Sub Private Sub TabControl1_NavigateButtonClick(ByVal Id As Long, Cancel As Variant)     MsgBox "Closing tab " & Id ' this displays always "2"     Cancel = True End Sub On the manual i've read Id : Id of the tab navigation button that was clicked. It's a bug or it's normal? Thanks | |
|  | |
| Oleg   Senior Member   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |  Post Options  Thanks(0)  Quote  Reply  Posted: 16 May 2011 at 12:46pm | 
| 
   Its id of navigation button. not Id of tab.
    | |
| 
     Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS | |
|  | |
| readypro   Groupie   Joined: 01 March 2011 Status: Offline Points: 14 |  Post Options  Thanks(0)  Quote  Reply  Posted: 18 May 2011 at 3:01am | 
| 
   Thanks Oleg, actually i've set ShowCloseItemButton = xtpTabItemButtonSelected and i'm using SelectedItem to detect the clicked tab Is it possible to retrieve also the clicked tab id using ShowCloseItemButton = xtpTabItemButtonAlways or another way to detect the tab that is being closed? | |
|  | |
| younicke   Senior Member     Joined: 11 March 2005 Status: Offline Points: 107 |  Post Options  Thanks(0)  Quote  Reply  Posted: 30 May 2011 at 1:36am | 
| 
   and also when u close an item using the closebutton... how do u get the actual itemcount of the tab? Private Sub TabControl1_NavigateButtonClick(ByVal Id As Long, Cancel As Variant)     MsgBox TabControl1.ItemCountEnd Sub this always return the actual itemcount (not deducting the tab that you closed). does anybody know how to get the itemcount inside navigatebuttonclick event? | |
|  | |
| sined   Newbie   Joined: 13 July 2010 Location: Italy Status: Offline Points: 5 |  Post Options  Thanks(0)  Quote  Reply  Posted: 06 October 2011 at 8:45am | 
| 
   
Hello, here the same problem. How to detect the tab that is closing? Mirko | |
|  | |
| cmaxmedia   Groupie   Joined: 22 April 2006 Location: Austria Status: Offline Points: 38 |  Post Options  Thanks(0)  Quote  Reply  Posted: 01 May 2015 at 6:48am | 
| 
   Hi, i have the same Problem: how to detect the tab id/index that is being closed Private Sub TabControl1_NavigateButtonClick(ByVal Id As Long, Cancel As Variant) MsgBox TabControl1.Selected.Index '<- Nup, thats the active, not the closing tab index!! End Sub | |
|  | |
| olebed   Senior Member   Joined: 01 July 2014 Location: Ukraine Status: Offline Points: 841 |  Post Options  Thanks(0)  Quote  Reply  Posted: 03 May 2015 at 6:46am | 
| 
   Hi cmaxmedia, This strange solution was because in first implementation of TabManager there was only one set of navigation buttons for all tabs (separately in tab header). Then navigate buttons were added for every tab, but NavigateButtonClick event stayed the same. I fixed it by adding reference to closed TabControlItem in NavigateButtonClick event. Fix will be available from next beta or final release. | |
|  | |
| Post Reply   | |
| Tweet | 
| Forum Jump | Forum Permissions  You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |