Problem with DockingPane Focus |
Post Reply |
Author | |
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
Posted: 19 April 2004 at 2:40pm |
Since the 8.6x version of Xtreme Suite for ActiveX, I have been having an issue with controls not properly receiving focus after clicking around on different panes. This issue still exists in the latest 8.70 release. After many attempts to isolate the issue, I have finally found a way to do so. Here's a description of the problem. I have a form with docking panes. One pane contains a simple VB Textbox. Another pane contains a 3rd-party grid control. If I click on the grid control and then click back to my textbox, the focus is not properly given to the textbox. If I type characters, the textbox shows those characters being typed. But if I use the cursor keys or PageUp/Down keys, nothing happens. It's as if some keyboard/mouse events are still being processed by the grid control and others are being processed by the textbox. It's very difficult to get the controls to respond properly again (combination of closing the pane and selecting other panes eventually fixes it). This problem does not exist when the grid control is not in a docking pane. Needless to say, this type of issue can't exist in a commercial program. I'm providing a demo application that will illustrate the issue I'm describing. It's a modification of the "MDIDocking" example to include two new panes (a pane with the Textbox and a pane with the Grid). This example uses a 3rd-party grid control called 'itGrid' by 'it-partners.com'. The OCX control is located in the 'it-partners.com' directory of the project and must be registered to run the compiled 'MDIDocking.exe' sample. If you plan to work with the application in the IDE, you'll need to download and install the eval version to have the proper license for the control. The eval version can be downloaded from the following link: http://www.it-partners.com/downloads.asp?RequireDetails=Y&am p;Product=itGrid The project has been zipped and, due to 500k size limit, is attached here in two files (#1 has just the project, #2 contains the grid control): 2004-04-19_143445_MDIDockingMOD_1.zip; 2004-04-19_143513_MDIDockingMOD_2.zip I hope that someone from Codejock can isolate the issue and provide a fix. I've had the same problem with more than one grid control, so I know the grid control is not the problem. If I had to guess, I'd say that the grid control is using message hooks or subclassing to provide in-cell editing. The grid does not appear to be properly notified when the pane looses focus, so these hooks are still in place when focus is on another control. Just a guess |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
See email I send.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
castleJoe
Newbie Joined: 16 August 2004 Status: Offline Points: 30 |
Post Options
Thanks(0)
|
I have the same problem with my grid (use latest CJ version). Is there a fix/workaround?
|
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
The problem appears to lie in Visual Basic. I looked at all the Codejock examples when I began designing my application. They almost always used a Form to design a pane and then used the handle to that Form to attach to the pane. Initially, this approach appears to work. That's when I started seeing these focus problems. It appears that Visual Basic isn't properly send/receiving some of the windows messages related to focus when you use a Form to hold the contents of a pane. The solution is to stop using separate Forms to hold your pane controls. Instead, create a PictureBox on the same form that contains the DockingPanes control. Set the 'Border' of these PictureBoxes to 0 (for no border). When you attach your panes, specify the handle to the PictureBox instead of the handle to the Form. This approach makes it harder to organize your code because the code for all your separate panes now resides in one location. But I stopped having the focus problems after I did this. As a general rule when working with any of the Codejock controls, don't use a Form to contain your controls. Use a PictureBox instead. I wish they'd update their examples to stop using Forms since this starts you developing in the wrong direction. I hope this helped provide some insight. |
|
gshawn
Senior Member Joined: 04 October 2004 Status: Offline Points: 227 |
Post Options
Thanks(0)
|
Thanks Boyd, that was a very informative post. It doesn't sound like these are issues that the CodeJock developers can fix, so I don't think we'll be seeing a resolution soon... The problem as you mentioned is that ALL the code now resides in the same form. This will make it a nightmare to use on large projects like mine. Do you or anyone else perhaps know of another alternative? |
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
I've been using this approach on a fairly large project, and I've still managed to keep things clean. The only code that really has to remain on the main form are the event handlers. Anything else can generally be moved to a module. I've declared a global reference to the main form of my application so that it can be accessed from the modules. As necessary, I made certain items in the main form public so that they can also be accessed by the modules. It's not as tidy a solution as just being able to place everything on a form, but it has worked. Good luck! |
|
tobi
Senior Member Joined: 09 September 2004 Location: Germany Status: Offline Points: 451 |
Post Options
Thanks(0)
|
I have some problems doing the PictureBox way Boyd descibed in my MDI VB6 application: |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
You probably need to refference like fMainFrame.picMainPane.hwnd, just
a guess. Or maybe try storing the picture box on a "dummy" form.
|
|
tobi
Senior Member Joined: 09 September 2004 Location: Germany Status: Offline Points: 451 |
Post Options
Thanks(0)
|
Your first suggestion does not work - same error ! The second way works but do you think I will not run into the focus problem ?
|
|
SteveL
Newbie Joined: 13 September 2004 Location: United Kingdom Status: Offline Points: 2 |
Post Options
Thanks(0)
|
Hi. I have an application with up to seven panes open at any one time. Each one of these contains a form with a variety of controls. We are implementing a windows explorer style interface with a treeview in one pane, which acts as the parent and the rest of the panes being children whose data is dependant upon what level in the treeview we are. As we change the level of the treeview we therefore update the data shown in all child forms. The problem is, if I use the cursor keys to navigate the treeview, it fires a nodeclick event (correctly) which updates the child forms(correctly). Unfortunately, for some reason, the pane with the treeview then loses focus and one of the child panes becomes active. I have even tried explicitly setting the focus back to the form and treeview control but this still doesn't work. However, if I have no other panes open it behaves correctly. When I do have other panes there, I am never setting focus to them, merely updating their displays via code. I could perhaps accept the fact that this is all down to the way that vb handles things and that maybe I should be using picture boxes instead, if it wasn't for the following: If I have the pane with the treeview floating, it works correctly. It is just when it is docked that it all becomes a mess. I've noticed other posts elsewhere that have similar issues. This suggests to me that the docking pane may be handling things differently for docked panes and floating ones, so there may be something that codejock developers can do. Has anyone encountered similar and have a workaround (that doesn't involve rewriting the whole app with picture boxes two weeks before its supposed release date!!)? Cheers,
Steve
|
|
tknijff
Newbie Joined: 11 February 2005 Location: Netherlands Status: Offline Points: 6 |
Post Options
Thanks(0)
|
Hi, I had the same problem with the focus, so I am using PictureBoxes now for the DockingPanes. However, I discovered a major problem: when you make the docking pane floating, the form of the DockingPane cannot get the focus anymore... (it looks that the floating pane becomes Modal) Has anyone encountered this problem and have a workaround? Thanks, Thierry |
|
acmh
Newbie Joined: 14 March 2005 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
Hi,
|
|
acmh
Newbie Joined: 14 March 2005 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
Hi, Albert |
|
Zarch
Newbie Joined: 15 June 2005 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
Hi, I have the exact same problems as listed above by Boyd and SteveL. Is there anything codejock can do to fix this? I refuse to accept the fact that there is no way for a pane with a grid control or treeview to work correctly? I used forms as well in my panes. I'm willing to use pictureboxes if that is in fact the workaround that will get the panes working corectly, but it looks like even that has problems! How should I proceed from here? It seems the docking panes have a fundemental problem that should be addressed and documented somewhere. Regards... |
|
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 |