Print Page | Close Window

(WORKAROUND) MDI Tab Groups events

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=13128
Printed Date: 15 June 2025 at 7:54pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: (WORKAROUND) MDI Tab Groups events
Posted By: chrisABC
Subject: (WORKAROUND) MDI Tab Groups events
Date 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



Replies:
Posted By: PPL1
Date Posted: 04 December 2009 at 9:39pm
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





Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net