How do I determine which Pane is active? |
Post Reply |
Author | |
SteveL
Newbie Joined: 13 September 2004 Location: United Kingdom Status: Offline Points: 2 |
Post Options
Thanks(0)
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. |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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. |
|
JSram
Groupie Joined: 22 October 2004 Status: Offline Points: 42 |
Post Options
Thanks(0)
|
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. |
|
JSram
Groupie Joined: 22 October 2004 Status: Offline Points: 42 |
Post Options
Thanks(0)
|
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.
|
|
JamesH
Senior Member Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
|
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; 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? |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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.
|
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
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? |
|
JamesH
Senior Member Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
|
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 Edited by JamesH |
|
JamesH
Senior Member Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
|
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.
- James |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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.
|
|
tknijff
Newbie Joined: 11 February 2005 Location: Netherlands Status: Offline Points: 6 |
Post Options
Thanks(0)
|
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 |
|
knight4c
Newbie Joined: 15 April 2005 Status: Offline Points: 5 |
Post Options
Thanks(0)
|
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... |
|
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 |