Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - [solved] TabControl - problem with closable Items
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[solved] TabControl - problem with closable Items

 Post Reply Post Reply
Author
Message
readypro View Drop Down
Groupie
Groupie


Joined: 01 March 2011
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote readypro Quote  Post ReplyReply Direct Link To This Post 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


Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2011 at 12:46pm
Its id of navigation button. not Id of tab.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
readypro View Drop Down
Groupie
Groupie


Joined: 01 March 2011
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote readypro Quote  Post ReplyReply Direct Link To This Post 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?

Back to Top
younicke View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 March 2005
Status: Offline
Points: 107
Post Options Post Options   Thanks (0) Thanks(0)   Quote younicke Quote  Post ReplyReply Direct Link To This Post 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.ItemCount
End 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?
Back to Top
sined View Drop Down
Newbie
Newbie


Joined: 13 July 2010
Location: Italy
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote sined Quote  Post ReplyReply Direct Link To This Post Posted: 06 October 2011 at 8:45am
Hello,
here the same problem.
How to detect the tab that is closing?
 
Mirko
Back to Top
cmaxmedia View Drop Down
Groupie
Groupie


Joined: 22 April 2006
Location: Austria
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmaxmedia Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post 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. 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.