(WORKAROUND) MDI Tab Groups events |
Post Reply |
Author | |
chrisABC
Senior Member Joined: 05 June 2008 Status: Offline Points: 258 |
Post Options
Thanks(0)
Posted: 09 January 2009 at 6:37am |
Using MDI Tabs the Workspace event _SelectedChanged is fired each time a different Tab is clicked by user. That is good.
But when I have several Groups of Tabs, the _SelectedChanged event does NOT always fire when user clicks different Tab if the Tab is in a different Group. It only behaves correctly if we stay in the same Group. To explain better: It seems each Group retains its own "Current Tab". When user clicks on any "current Tab" the Changed event does not fire -- even if Tab is in a different Group. I expect this is Working As Designed (ie. not a bug). But how can I detect when user clicks in a different Group ?? eg. is there a Group_Changed event? WORKAROUND -- the Workspace_BeforeItemClick event is correctly fired for ALL times when user clicks on a Tab. Even if it is current Tab or in a different Group. So with a bit of logic I can use this event to get around the problem with _SelectedChanged event. But please still comment if I have missed something or there is a better way. |
|
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6
|
|
PPL1
Groupie Joined: 10 April 2006 Location: Canada Status: Offline Points: 70 |
Post Options
Thanks(0)
|
Bump... Can CJ confirm if this is a bug or not.
What's the purpose of a Workspace_SelectedChanged event if it does not fire when a different tab is selected ? (current version still has this "behaviour") BTW, the proposed workaround only works when the user actually "clicks" on the tab. For all other methods of selecting a different tab, this does not work (e.g. click on the contained form, keyboard, etc) [edit] For those interested, until this is fixed, the way to go is using a timer and checking the Selected property. It changes as expected: Private Sub FastTimer_Timer() Dim TabID As Long, GroupID As Long Static OldWorkspaceTabID As Long, OldWorkspaceGroupID As Long '2009-12: selectionchanged does not work between groups in 13.2 TabID = Me.CB.TabWorkspace.Selected.Index GroupID = Me.CB.TabWorkspace.FindGroup(Me.CB.TabWorkspace.Selected) If TabID <> OldWorkspaceTabID Or GroupID <> OldWorkspaceGroupID Then Me.WorkspaceSelectionChanged OldWorkspaceTabID = TabID OldWorkspaceGroupID = GroupID end if end sub Public Sub WorkspaceSelectionChanged() Set FocusForm = Me.ActiveForm ' use this FocusForm to reference the active tab End Sub |
|
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 |