Print Page | Close Window

How do I determine which Pane is active?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=1173
Printed Date: 22 December 2024 at 3:40am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How do I determine which Pane is active?
Posted By: SteveL
Subject: How do I determine which Pane is active?
Date Posted: 13 September 2004 at 11:56am

Hi,

I have a number of panes containing different forms, but sharing one toolbar.

What I want is to capture when a particular pane/form is selected and rebuild the toolbar appropriately depending on what form is currently active. Also when selecting a menu option or tool event I need to know which pane is active  to fire the relevant action on the active pane. Unfortunately I can't figure out how to determine this. I have even tried workarounds such as manually setting a global active pane variable on the forms got focus event, which unfortuantely never seems to fire.

I read elsewhere that a selected event would be available in 8.62.

I am currently using 8.70 with VB6.0.

Any help would be greatly appreciated.




Replies:
Posted By: SuperMario
Date Posted: 13 September 2004 at 12:06pm
Try Something like this to determine the active pane:

      Dim activePane As Pane
      For Each activePane In DockingPaneManager
        If Not activePane Is Nothing Then
         &nbs p;If activePane.Selected = True And activePane.Hidden = False Then
         &nbs p;  MsgBox activePane.Title & " is currently selected.", vbOKOnly, "Currently Selected Pane"
         &nbs p;End If
        End If
      Next

You can use the pane actions to determine when a pane is opening, pinning, and closing in the Action event.  But this will not fire if you have panes grouped and are selecting different tabs in the group.  So you may need to use the code above and call it like every 100ms to determine which tab is active and if the appropriate commandbar is showing.  If you are using commandbars, you can place this in the update event.


Posted By: JSram
Date Posted: 28 October 2004 at 5:07pm
Well this may work in some situation, but is a very akward workaround for something as simple as a 'Click' or "Selected' event. This is a very basic event that can't be that hard to implement?

Your controls are really great in many ways, with almost a confusing load of classes, properties and methods BUT really poor on events that could make life a lot easier many times. After all Windows are an eventdriven environment... So please, an event to determine when a panes tab is selected. It could even go in the Action event, but well I guess you knows best were to put it, but we need it.


Posted By: JSram
Date Posted: 30 October 2004 at 6:58am
I actually found a workaround for this, although not sure if it's fool proof. If the pane is attached to a form handle, it seam that the form Activate event gets triggered each time a Pane tab is clicked. But I'm not sure this is consistent.


Posted By: JamesH
Date Posted: 09 December 2004 at 6:06pm

I am trying to get the selected pane but it seems the selected property is true for more than one pane.  Using the code sement below:

 int numSelected = 0;
 // Find the selected pane
 for ( int x = 1; x <= m_spPhotoPanes->PanesCount; x++ )
 {
  if ( m_spPhotoPanes->Panes[ x ]->Selected == VARIANT_TRUE &&
    m_spPhotoPanes->Panes[ x ]->Hidden == VARIANT_FALSE )
  {
   spSelectedPane = m_spPhotoPanes->Panes[ x ];
   numSelected++;
  }
 }

The numSelected variable is greater than one.  How can more than one pane be the active one?

Is there a better or different way to get the active pane?



Posted By: SuperMario
Date Posted: 09 December 2004 at 10:38pm
There isn't a good way to do this right now.  JScram's solution sounds like it might work.  As for the multiple active panes.  I found that it count's hidden panes as active if they were shown then auto hidden, even if another pane is selected.


Posted By: Boyd
Date Posted: 10 December 2004 at 6:54am

So does Codejock plan to implement a solution for this?  I've seen this topic come up several times over the past year, many new updates to DockingPanes have been released, and there still hasn't been a solution to truly determine which pane is active.

Ideally, an event should be triggered when a pane is selected, and there should be a property that also returns the active pane.

I figure you're probably gearing up for another release very soon.  Is this something Codejock can implement for that release?



Posted By: JamesH
Date Posted: 10 December 2004 at 10:49am

Thanks for the reply, it's great to get such fast feedback.

Although getting the active pane would seem a useful addition, perhaps there is an alternate way to do what I am interested in.  I would like to be able to open a new pane as a tab in the currently active pane.  Can anyone think of a work-around that would accomplish that?

I will investigate JScram's solution.  We're using ATL but I assume the VB activate event is just generated by the standard windows message.

*edit*

It looks like the contained window gets a  WM_IME_SETCONTEXT message as well as the WM_SETFOCUS and WM_KILLFOCUS messages.  As a work-around I think I can use these to manually keep track of which pane is active.

*edit*

Thanks again,

- James



Posted By: JamesH
Date Posted: 16 February 2005 at 2:18pm

First let me say thank you to Codejock for continuing to support the Active-X version of your controls it is really appreciated.  The release notes document is also very well put together.

 I have been putting off wrestling with a way to get the active pane hoping a new event would be added in 9.6.  The new HighlighActiveCaption property is great and now I can see which the active pane regardless of the theme.  However, I still can't find a way to programmatically determine what the active pane is.  I need to enable/disable various menu options depending on what the active pane is.  Am I missing something?

Thanks,

- James



Posted By: SuperMario
Date Posted: 14 March 2005 at 9:52am
In the next release 2 new actions will be included; PaneActionActivated and PaneActionDeActivated.  There will also be a new property; DockingPane.ActivePane that will reference the currently active pane.


Posted By: tknijff
Date Posted: 15 March 2005 at 3:02am

It is very nice that two new actions PaneActionActivated and PaneActionDeActivated will be included! Keep on going with the good work...

Could you tell me when the next release is released?

Thanks,

Thierry



Posted By: knight4c
Date Posted: 04 May 2005 at 11:03am
I really need that event to.
I only whant to refresh a grid in a panel when the panel is selected to limit database access...



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