View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003761 | JEDI VCL | 00 JVCL Components | public | 2006-06-11 01:02 | 2008-10-14 02:25 |
Reporter | bunglehead | Assigned To | obones | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.20 | ||||
Target Version | Fixed in Version | 3.34 | |||
Summary | 0003761: JvDocking focus bug (VID and .NET style) | ||||
Description | Tab Container doesn't focus properly.. You can try it on VIDDemo example.. 1. Show 3 docking forms (at least). For example Project Explorer, Properties and Toolbox. 2. Dock two of them into a tab container, then dock this container. 3. Now set focus on third (not tabbed) form and dock it to then container 4. Container caption didn't highlight. And doesn't respond on mouse clicks and focusing of tabbed forms. | ||||
Tags | No tags attached. | ||||
|
Yes, it does not highlight, but it does respond to mouse clicks on tabs. Please try with todays snapshot: http://jvcl.sf.net/daily/ |
|
No, no..I meant caption doesn't respond by highlighting when you click on it.. Tabs work of course.. It isn't a big problem, but users don't understand it) |
|
Can you provide the zipped sources of a demo application showing what you mean? |
|
You can try this with src provided. I've tried it just now with latest snapshot, problem remains the same. Dock two froms to each other to get tab container. Then dock this container to left side of a main form. After docking title bar of tab container remains inactive, but all tab functions are ok. After Minimizing -> Maximizing everything become good. |
2007-03-07 13:34
|
JediDockVSNET.zip (20,121 bytes) |
|
In my private copy of JvDockVIDStyle I have made the following changes to deal with focus problems: a) In TJvDockVIDTabPageControl.Change I have commented out 5 lines as below: procedure TJvDockVIDTabPageControl.Change; begin Assert(Assigned(ParentForm)); inherited Change; { During closing/undocking of a form, ActivePage is actually going to be wrong. See above in DoRemoveDockClient for where we fix this problem. } ParentForm.Caption := ActivePage.Caption; if ParentForm.HostDockSite is TJvDockCustomPanel then begin // if ParentForm.Visible and ParentForm.CanFocus then // ParentForm.SetFocus; ParentForm.HostDockSite.Invalidate; end; // if (ActivePage <> nil) and (ActivePage.Visible) and (ActivePage.CanFocus) then // if ParentForm.Visible and ParentForm.CanFocus then // ActivePage.SetFocus; end; b) In TJvDockTabPanel.MouseDown I have added 8 lines procedure TJvDockTabPanel.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var Ctrl: TControl; Index: Integer; Msg: TWMMouse; Sheet: TJvDockVIDTabSheet; begin inherited MouseDown(Button, Shift, X, Y); if Page = nil then Exit; Index := GetPageIndexFromMousePos(X, Y); if Index >= 0 then begin // added if Page.ParentForm.HostDockSite is TJvDockCustomPanel then with Page do begin if ParentForm.Visible and ParentForm.CanFocus then ParentForm.SetFocus; if (ActivePage <> nil) and (ActivePage.Visible) and (ActivePage.CanFocus) then if ParentForm.Visible and ParentForm.CanFocus then ActivePage.SetFocus; end; // added Does this resolve your problem? Analysis: Further down in TJvDockTabPanel.MouseDown there is the code: Page.ActivePageIndex := Index; This shows the new page of TabPanel sets the focus to the first selectable control of the docked form. Just below this statement there the line: Page.Change; This triggers the change method that is listed at the top of this comment. The commented out lines remove the focus from the docked form and set to the tab page itself. This creates the focus problems. |
|
No, this doesn't resolve it. Problem remains the same. |
|
OK. The submitted changes solve a different focus problem. Please try the following: In unit JvDockVIDStyle add these lines at the end of TJvDockVIDPanel.CustomDockDrop if (Source.Control is TJvDockTabHostForm) and (TJvDockTabHostForm(Source.Control).GetActiveDockForm <> nil) and TJvDockTabHostForm(Source.Control).GetActiveDockForm.CanFocus then TJvDockTabHostForm(Source.Control).GetActiveDockForm.SetFocus; Optionally (this is for when you undock tabbed forms) add the following method to TJvDockTabHostForm in unit JvDockControlForm declaration procedure DoDock(NewDockSite: TWinControl; var ARect: TRect); override; procedure TJvDockTabHostForm.DoDock(NewDockSite: TWinControl; var ARect: TRect); begin inherited; if (GetActiveDockForm <> nil) and GetActiveDockForm.CanFocus then GetActiveDockForm.SetFocus; end; Please report back. |
|
Corrected TJvDockTabHostForm.DoDock below. Please use this one instead of the one given above. procedure TJvDockTabHostForm.DoDock(NewDockSite: TWinControl; var ARect: TRect); begin inherited; if not JvGlobalDockIsLoading and (GetActiveDockForm <> nil) and GetParentForm(Self).Visible and GetActiveDockForm.CanFocus then GetActiveDockForm.SetFocus; end; |
|
Also, make sure you set the Dock Server AutoFocusDockedForm property to True. With the combined changes I have presented I get the desired focus behaviour in the scenarios you described. |
2007-03-20 09:25
|
JvDocking.zip (135,781 bytes) |
|
I have done some more work on the Focus issue and attached the private copies of modified JvDocking files in the attached JvDocking.zip file. To test use the Advanced Demo: a) Copy the zipped files to the directory of the Demo. b) Modify TRunTimeForm.Create in the demo so that the memo component is displayed in the form and you can observe whether it receives the focus or not. with TMemo.Create(Self) do begin Parent := Self; //added Align := alClient; BorderStyle := bsNone; end; c) Test with the VID VSNet styles If the changes produce the desired results or at least improve over the current situation I will submit pathches to Jvcl. |
|
Hello, I've tried it all. Well, it solves something it's true, but problem still exists. Sometimes caption of pagecontrol is not highlighted. But now it goes better. Vista style of dragging is very pretty, but it's must be an option (published property) I think. And it isn't included in SVN yet... |
|
With a new dragging there're some unnecessary flashing of alphablended rectangle. This blinking goes far out of window - container of DockServer.. Maybe it's a common JvDocking issue, and isn't the result of your suggestions.. |
|
Is the problem in this specific case maybe just the "if ActiveControl = Control then" check in TJvDockVIDTree.DrawDockGrabber? ie, if you change it to "if TWinControl(Control).ContainsControl(GetActiveControl) then" it works for me. |
|
No, it doesn't help always. Sometimes I got the incorrect font color (when the same condition used for font color preselection). |
|
Could you try to reproduce a case when it's not correct? I'll inspect the changes by Kiriakos in the mean time :) |
|
I'm sorry. I meant color of close and hide buttons on a grabber. I can't reproduce it all the time..Same as my initial issue (0003761). Kiriakos' changes don't resolve it all. Your suggestion is much more light. It eliminates focus issue, but not completely (it remains sometimes after multiple minimize/restore operations). If you could fix color of buttons this solution must be temporarely used. Look at another Kiriakos suggestion on using Vista's alpha rectangle when dragging instead of traditional (in JvDocking.zip). It isn't a finished work yet. Cause of flickering of this rectangle. But after some work it solud live as an aditional property I think. |
|
I think this is fixed now (at 03/29/2007). But another behaviour changed: when main form (Container of all JvDocking components) lost focus, grabber remains highlighted. Is it a desired behaviour? I think previous versions (where grabber was disabled when main form lost focus) were better in this part. |
|
Thanks for the feedback, I didn't think of that. Should now be fixed in Rev 11245. |
|
Yes, I thought about this solution yesterday. But: It works only if Control in your IsActive condition contain a control that can catch a focus (such as in Advancepro demo example). If dock form has no focusable objects grabber doesn't repaint correctly. And this code is unsafe. If you want to use this you should split it in something like that to prevent AV on getting Focused property: if Assigned(Screen.ActiveControl) then IsActive := Screen.ActiveControl.Focused and Control.ContainsControl(Screen.ActiveControl) else IsActive := False; But first of all a patch needed to resolve this issue completely. I'm trying to find it too. |
|
That is not correct, I think: * If the dock form contains no focusable objects and you or the system focuses the dock form then the Screen.ActiveControl will be the dock form itself; and the ContainsControl method will return True in this case. * JVCL uses Delphi's short-circuit Boolean evaluation that means strict left-to-right evaluation that stops as soon as the result of the entire expression is determined. Thus if "Assigned(Screen.ActiveControl)" is False then "Screen.ActiveControl.Focused" will not be evaluated. |
|
About the first: may be it isn't serious, but when dockform contains no focusable objects in doesn't catch focus (I might be wrong but simple clicking on it hasn't any consequence such as grabber highlighting; but clicking on grabber active it normally. About short boolean evaluation: I did not know that it's a default JVCL compiler configuration. What about debug mode? By myself I prefer splitting in such pointer operation cases to be sure. |
|
Remko The new JvDocking code is working fine except for the change you made in TJvDockTabPanel.MouseDown following my suggestion which does not always pass the focus to the controls of the form when you click the tab. I got a better solution which always works. It also focuses correctly when you click the tab of an already selected form. Here is the amended part of TJvDockTabPanel.MouseDown. procedure TJvDockTabPanel.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var Ctrl: TControl; Index: Integer; Msg: TWMMouse; Sheet: TJvDockVIDTabSheet; AParentForm: TCustomForm; begin inherited MouseDown(Button, Shift, X, Y); if Page = nil then Exit; Index := GetPageIndexFromMousePos(X, Y); if Index >= 0 then begin if Index <> Page.ActivePageIndex then begin Sheet := Page.ActiveVIDPage; Page.ActivePageIndex := Index; Sheet.SetSheetSort(Sheet.Caption); Page.ActiveVIDPage.SetSheetSort(Page.ActiveVIDPage.Caption); Page.Change; Invalidate; end; // Added code if Assigned(Page.ActivePage) and Page.ActivePage.CanFocus then begin AParentForm := GetParentForm(Page); if Assigned(AParentForm) then begin Page.SelectFirst; AParentForm.SetFocus; end; end; Also please take a look at reports 4108 and 4109. |
|
Remko, Also outstanding JvDocking patches are in reports 3998 and 4076. Many thanks! |
|
Any news on this? |
2008-03-07 22:20
|
JvDockVIDStyle.patch (1,693 bytes)
--- C:/Sandbox/P4D/PythonForDelphi/PythonIDE/JvDockVIDStyle.pas Thu Dec 27 18:50:43 2007 +++ C:/Delphi/Components/jvcl/run/JvDockVIDStyle.pas Sun Jun 24 14:09:46 2007 @@ -1049,6 +1048,0 @@ - //KV - if not JvGlobalDockIsLoading and - (TJvDockTabHostForm(Host).GetActiveDockForm <> nil) and - GetParentForm(Host).Visible and - TJvDockTabHostForm(Host).GetActiveDockForm.CanFocus then - TJvDockTabHostForm(Host).GetActiveDockForm.SetFocus; @@ -1146,6 +1139,0 @@ - //KV - if (ControlCount > 0) and Assigned(Controls[0]) and (Controls[0] is TJvDockTabHostForm) then begin - with TJvDockTabHostForm(Controls[0]) do - if (GetActiveDockForm <> nil) and GetActiveDockForm.CanFocus then - GetActiveDockForm.SetFocus; - end; @@ -2611,6 +2598,0 @@ - //KV - with ActivePage do - if not JvGlobalDockIsLoading and (ControlCount > 0) and Assigned(Controls[0]) then begin - if Visible and (Controls[0] <> nil) and (Controls[0] as TWinControl).CanFocus then - (Controls[0] as TWinControl).SetFocus; - end; @@ -3290,0 +3273,6 @@ + if Assigned(Page.ActivePage) and Page.ActivePage.CanFocus then + begin + AParentForm := GetParentForm(Page); + if Assigned(AParentForm) then + AParentForm.ActiveControl := Page.ActivePage; + end; @@ -3297,8 +3284,0 @@ - end; - if Assigned(Page.ActivePage) and Page.ActivePage.CanFocus then - begin - AParentForm := GetParentForm(Page); - if Assigned(AParentForm) then begin - Page.SelectFirst; - AParentForm.SetFocus; - end; |
|
I have attached a patch file with my changes to JvDockVIDStyle.pas. The changes are related to this focus issue. I have been using these changes for ages in the open source project PyScripter (pyscripter.googlepages.com, pyscripter.googlecode.com) and have not heard of any problems. |
|
Thanks, but the patch seems to be done on a very old version of the file, in a format that TortoiseSVN cannot understand. And I even suspect it's done in reverse with the "--" lines being what you want added and not removed. Can you recreate the patch from the current version of the file from subversion? Thanks in advance. |
2008-03-13 14:53
|
JvDockVIDStyle2.patch (1,634 bytes)
--- C:/jvcl/run/JvDockVIDStyle.pas Thu Mar 13 22:44:49 2008 +++ C:/Sandbox/P4D/PythonForDelphi/PythonIDE/JvDockVIDStyle.pas Thu Mar 13 22:40:04 2008 @@ -1048,0 +1049,5 @@ + if not JvGlobalDockIsLoading and + (TJvDockTabHostForm(Host).GetActiveDockForm <> nil) and + GetParentForm(Host).Visible and + TJvDockTabHostForm(Host).GetActiveDockForm.CanFocus then + TJvDockTabHostForm(Host).GetActiveDockForm.SetFocus; @@ -1139,0 +1145,5 @@ + if (ControlCount > 0) and Assigned(Controls[0]) and (Controls[0] is TJvDockTabHostForm) then begin + with TJvDockTabHostForm(Controls[0]) do + if (GetActiveDockForm <> nil) and GetActiveDockForm.CanFocus then + GetActiveDockForm.SetFocus; + end; @@ -2598,0 +2609,5 @@ + with ActivePage do + if not JvGlobalDockIsLoading and (ControlCount > 0) and Assigned(Controls[0]) then begin + if Visible and (Controls[0] <> nil) and (Controls[0] as TWinControl).CanFocus then + (Controls[0] as TWinControl).SetFocus; + end; @@ -3273,6 +3287,0 @@ - if Assigned(Page.ActivePage) and Page.ActivePage.CanFocus then - begin - AParentForm := GetParentForm(Page); - if Assigned(AParentForm) then - AParentForm.ActiveControl := Page.ActivePage; - end; @@ -3284,0 +3294,8 @@ + end; + if Assigned(Page.ActivePage) and Page.ActivePage.CanFocus then + begin + AParentForm := GetParentForm(Page); + if Assigned(AParentForm) then begin + Page.SelectFirst; + AParentForm.SetFocus; + end; |
|
Added a new patch, which is against the SVN version. I hope the format is OK... |
|
This is in SVN since March, sorry for the delay in updating the issue. |
Date Modified | Username | Field | Change |
---|---|---|---|
2006-06-11 01:02 | bunglehead | New Issue | |
2006-06-22 08:11 | obones | Note Added: 0009621 | |
2006-06-22 08:11 | obones | Status | new => feedback |
2006-06-22 16:16 | bunglehead | Note Added: 0009631 | |
2007-01-03 12:07 | obones | Note Added: 0010492 | |
2007-03-07 13:34 | bunglehead | Note Added: 0011296 | |
2007-03-07 13:34 | bunglehead | File Added: JediDockVSNET.zip | |
2007-03-18 17:03 | Kiriakos | Note Added: 0011459 | |
2007-03-19 07:58 | bunglehead | Note Added: 0011477 | |
2007-03-19 19:55 | Kiriakos | Note Added: 0011493 | |
2007-03-19 20:47 | Kiriakos | Note Added: 0011494 | |
2007-03-19 21:11 | Kiriakos | Note Added: 0011495 | |
2007-03-20 09:25 | Kiriakos | File Added: JvDocking.zip | |
2007-03-20 09:31 | Kiriakos | Note Added: 0011520 | |
2007-03-20 13:03 | bunglehead | Note Added: 0011521 | |
2007-03-20 13:19 | bunglehead | Note Added: 0011522 | |
2007-03-26 15:55 | remkobonte | Note Added: 0011610 | |
2007-03-27 12:10 | bunglehead | Note Added: 0011634 | |
2007-03-27 14:13 | remkobonte | Note Added: 0011635 | |
2007-03-28 01:13 | bunglehead | Note Added: 0011645 | |
2007-03-29 12:15 | bunglehead | Note Added: 0011675 | |
2007-03-29 12:45 | remkobonte | Note Added: 0011676 | |
2007-03-30 11:52 | bunglehead | Note Added: 0011704 | |
2007-04-01 05:22 | remkobonte | Note Added: 0011738 | |
2007-04-01 13:26 | bunglehead | Note Added: 0011743 | |
2007-04-17 18:38 | Kiriakos | Note Added: 0012153 | |
2007-04-17 18:45 | Kiriakos | Note Added: 0012154 | |
2008-02-21 03:30 | obones | Note Added: 0014224 | |
2008-03-07 22:20 | Kiriakos | File Added: JvDockVIDStyle.patch | |
2008-03-07 22:23 | Kiriakos | Note Added: 0014285 | |
2008-03-10 01:59 | obones | Note Added: 0014287 | |
2008-03-13 14:53 | Kiriakos | File Added: JvDockVIDStyle2.patch | |
2008-03-13 14:54 | Kiriakos | Note Added: 0014294 | |
2008-10-14 02:24 | obones | Status | feedback => resolved |
2008-10-14 02:24 | obones | Fixed in Version | => 3.34 |
2008-10-14 02:24 | obones | Resolution | open => fixed |
2008-10-14 02:24 | obones | Assigned To | => obones |
2008-10-14 02:24 | obones | Note Added: 0014856 |