View Issue Details

IDProjectCategoryView StatusLast Update
0001786JEDI VCL00 JVCL Componentspublic2004-05-20 07:04
ReporterMarkus SpoettlAssigned Tomarcelb 
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0001786: JvInspector: Major Problem with usage of SetFocus
DescriptionHello Marcel,

  there is a major problem in JvInspector which is caused by how
TJvCustomInspectorItem.SetEditCtrl(const Value: TCustomEdit);

is implemented. Assume the following situation:

1) One Inspector and a list view on a form
2) When the item changes in the list view
   Inspector.RefreshValues is called
3) Now, set the focus to an inspector item so
   that the editor becomes visible
4) Click another item in the list.

What SHOULD happen now is that the input focus is removed from the inspector and set to the list view. However, the inspector forces the focus onto itself, apparently assuming that the edit control had the focus. that should never happen.

What happens is that you have to click the list view twice, the first time the focus get removed from the editor to the inspector, the second time it is really removed.

Another problem is that the inspector never really gets out of editing if you call RefreshValues because it automatically creates an editor (which it shouldn't if it doesn't have the focus).
TagsNo tags attached.



2004-05-20 06:18

manager   ~0004306

Well, that's a nice bug. Increased the priority. Better report the second issue separately though.

Markus Spoettl

2004-05-20 06:28

reporter   ~0004307

There is no second issue, it's the same problem - the control should never set the focus to itself - at least not without checking whether the editor had the focus previously.


2004-05-20 06:50

manager   ~0004308

Interestingly enough, I can't replicate your first issue. AFAICT, SetEditCtrl does set focus when it shouldn't, so I added a test to see if the editor had focus:

        if Inspector.CanFocus and EditCtrl.Focused then
        {$IFDEF VCL}
        EditCtrl.WindowProc := Edit_WndProc;
        {$ENDIF VCL}

InitEdit will only focus the editor if the inspector has the focus, so RefreshValues should not force the focus to the inspector, unless the current editor had the focus (in which case, the recreated editor get's the focus anyway).

BTW, an editor is created as soon as an inspector item is selected. It should obviously not get focus if the inspector doesn't have it, but TJvCustomInspectorItem.InitEdit handles that OK. So, perhaps the change outlined above corrected the issue (don't know, since I couldn't replicate it anyway). If it does, I'll commit the change. If not, I'll need a small test project that does exhibit this issue.

Markus Spoettl

2004-05-20 06:59

reporter   ~0004309

Yes, that works, Thank!


2004-05-20 07:04

manager   ~0004310

Great! I'll commit the change. Still wondering why I didn't get a focus problem though...

Issue History

Date Modified Username Field Change
2004-05-20 05:51 Markus Spoettl New Issue
2004-05-20 06:18 marcelb Note Added: 0004306
2004-05-20 06:18 marcelb Assigned To => marcelb
2004-05-20 06:18 marcelb Priority normal => high
2004-05-20 06:18 marcelb Status new => assigned
2004-05-20 06:28 Markus Spoettl Note Added: 0004307
2004-05-20 06:50 marcelb Note Added: 0004308
2004-05-20 06:59 Markus Spoettl Note Added: 0004309
2004-05-20 07:04 marcelb Status assigned => resolved
2004-05-20 07:04 marcelb Resolution open => fixed
2004-05-20 07:04 marcelb Note Added: 0004310