Enter and Leave events dont work |
Post Reply |
Author | |
blazej
Groupie Joined: 09 February 2005 Location: Canada Status: Offline Points: 53 |
Post Options
Thanks(0)
Posted: 09 February 2005 at 5:52pm |
Hi
I'm in the process of evaluating Xtreme Suite for the purposes of the software project we're working on. I'm using the ActiveX version of the components in C# (VS .NET 2003). I'm using both Command Bars and Docking Pane Manager. In one of my panes I have an edit box. I subscribed to Enter and Leave events of this control. This allows me to automatically save text typed by the user when he/she leaves the edit box. This used to work before I switched my code to CodeJock but now - it doesn't. The Enter event I'm getting only once (no matter how many times I enter and leave the control) and the Leave event I don't get at all. Knowing ActiveX, I think this problem is related to the fact that Xtreme Suite is implemented in ActiveX. Any comments? Workarounds? Michal Blazejczyk |
|
blazej
Groupie Joined: 09 February 2005 Location: Canada Status: Offline Points: 53 |
Post Options
Thanks(0)
|
Anyone?
:-))))) Michal |
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
I just ran this scenario in one of my applications, and I'm seeing the same behavior. The events will fire properly if you move between controls hosted on the same pane, but not if you move from one pane to another. Codejock, any comments on how to get these events to fire properly? |
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
I just figured it out. I remembered a similar problem when using these controls in Visual Basic. Only one control within the same container should be able to have focus. In Visual Basic, I use to use separate Forms to create each pane, and that created all kinds of focus problems (since two different forms can have two different active controls). The workaround was to place all my pane controls within different PictureBoxes on the same form. Since they were all in the same container, only one could have focus at a time. When working with C#, I use separate UserControls for each pane, and I never really give them a container. To test this theory, I added each newly created pane UserControl to my main form's 'Controls' collection. Since they all are in the same collection, only one can have focus at a time. Sure enough, all the events fired as expected! Here's some basic sample code from a routine on a Main Form that could set up the panes: // User Controls used as a panes |
|
blazej
Groupie Joined: 09 February 2005 Location: Canada Status: Offline Points: 53 |
Post Options
Thanks(0)
|
You rock, man!
Thanks Michal |
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
No problem! I did find an issue with this approach that I need to warn you about. Since the AttachPane event is only fired when a pane becomes visible, this means you're controls will be unattached until the pane is visible. In the case of grouped panes, this means the controls aren't attached until the user actually selects the pane in the tabbed group. If you use the approach I mentioned, the controls are visible when the are added to the controls collection. That means that unattached controls will be visible until the pane is selected for the first time. To avoid this, you should set the visible property to false when you create the control and then, in the AttachPane event, set the visible property back to true. An alternative to the AttachPane event would be to use the OnHandleCreated event of the items you want to add to your panes. At that point, you could assign the handle to the proper pane and not have to wait until the user selects a pane. |
|
gshawn
Senior Member Joined: 04 October 2004 Status: Offline Points: 227 |
Post Options
Thanks(0)
|
Boyd, I remember an old post of yours about not using multiple Forms in the VB version to host Docking Panes. However I am unable to find this post. I am having some focus issues in the VB version at the moment, due to the exact problem you just mentioned. If I remember correctly, this issue has existed for a long time now. Do you have a simple VB sample that you could post, that uses your method of using PictureBoxes in a single form you are describing? Since all the CodeJock samples are based on the seemingly incorrect way of doing things (multiple forms), I think that would be very valuable resource. Thanks in advance. |
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
Unfortunately, I don't have a sample VB app that uses this, but I'll repeat the basic concepts.
That's the basics. I've been using C# so long that I don't recall any other tricky steps. I hope that helps. |
|
gshawn
Senior Member Joined: 04 October 2004 Status: Offline Points: 227 |
Post Options
Thanks(0)
|
Thanks Boyd, I'm sure this will come in handy. I appreciate your taking the time to write this out.
|
|
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 |