View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001619||JEDI VCL||00 JVCL Components||public||2004-04-10 09:35||2004-04-11 02:21|
|Status||resolved||Resolution||no change required|
|Target Version||Fixed in Version|
|Summary||0001619: TJvCustomItemViewer: SelectedIndex incorrect in OnClick handler|
|Description||TJvCustomItemViewer updates its SelectedIndex property in its MouseUp override. Unfortunately, TControl.Click is called before TControl.MouseUp (in D5 anyway), so at the time an OnClick handler is called, SelectedIndex still has its old value. You can see this with the TJvOwnerDrawViewer in the JvItemViewer demo -- the status bar does not update until the second click of a particular item.|
|Additional Information||Looking further into this, I think the real problem may be that TJvOwnerDrawViewer does not publish OnItemChanged (and OnItemChanging and several other events). If it did, instead of using an OnClick handler, the demo could have:|
procedure TfrmMain.DoItV3ItemChanged(Sender: TObject; Item: TJvViewerItem);
if Assigned(Item) and (cdsSelected in Item.State) then
StatusBar1.Panels.Text := ColorToString(TColor(Item.Data));
|Tags||No tags attached.|
Or you could use OnMouseUp...
The problem is that I can't change SelectedIndex in MouseDown because that causes problems when doing MouseDown on one item but MouseUp on another and it also messes up multi-select in some cases.
Publishing the mentioned events could also be a good choice but the base problem remains the same: you can't use OnClick to determine the currently selected item, you generally need to use OnMouseUp.
Well, whatever you decide, I think you should update the demo to show the recommended way to do this sort of thing (I have no immediate plans to use this control. I was just curious what it was, so I ran the demo and noticed the problem.) (This by glchapman, who forgot to log in again)
edited on: 04-10-04 16:34
> I think you should update the demo
Good suggestion. Will do. Wil also have a look at the publishing of the suggested events.
|2004-04-10 09:35||glchapman||New Issue|
||Note Added: 0003787|
|2004-04-10 16:33||anonymous||Note Added: 0003792|
|2004-04-10 16:34||anonymous||Note Edited: 0003792|
||Status||new => resolved|
||Resolution||open => no change required|
||Assigned To||=> user72|
||Note Added: 0003793|