Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005178 [JEDI VCL] 00 JVCL Components major always 2010-02-24 08:34 2011-06-10 16:09
Reporter TheRoadrunner View Status public  
Assigned To AHUser
Priority normal Resolution fixed  
Status resolved   Product Version 3.38
Summary 0005178: TJvCustomEditorBase.ClearSelection does not clear, just deselects
Description Using a TJVHLEditor wired up with a TJvEditDelete action does not work when text is seleceted and 'Delete' is pressed.
Additional Information procedure TJvCustomEditorBase.ClearSelection;
begin
  SetUnSelected;
end;

should be changed to:

procedure TJvCustomEditorBase.ClearSelection;
begin
  DeleteSelected;
end;

Tags No tags attached.
Attached Files html file icon JvEditor.html [^] (12,403 bytes) 2010-02-24 13:06
html file icon JVEditorCommon.html [^] (21,319 bytes) 2010-02-24 13:06
html file icon JvStdEditActions.html [^] (12,241 bytes) 2010-02-24 13:07

- Relationships

-  Notes
(0017208)
obones (administrator)
2010-02-24 09:57

I'm sorry, but clearing the selection is just meant to unselect everything, not delete the selected text.
(0017209)
TheRoadrunner (reporter)
2010-02-24 10:02

I'm sorry too, but you are wrong. Look at the implementation of TCustomEdit or look at the docs:
Description
Use ClearSelection to delete the selected text from the edit control. If no text is selected, ClearSelection does nothing. If all of the text is selected, ClearSelection clears all text, like the Clear method.

Note: Calling ClearSelection does the same thing as sending the edit control a WM_CLEAR message.

Otherwise, it wouldn't be the logic handler of the TJvEditDelete action, would it?
(0017210)
obones (administrator)
2010-02-24 10:20

Hum, bugger.
This is bad naming of procedures then
(0017211)
TheRoadrunner (reporter)
2010-02-24 10:38

Yes, I see what you mean now, there is name confusion and TJvEditDelete.ExecuteTarget should be implemented as:

procedure TJvEditDelete.ExecuteTarget(Target: TObject);
var
  Intf: IStandardEditActions;
begin
  if Supports(Target, IStandardEditActions, Intf) then
    Intf.Delete // NOT ClearSelection
  else if Target is TCustomEdit then
    GetEditControl(Target).ClearSelection;
end;
(0017212)
TheRoadrunner (reporter)
2010-02-24 10:43

The right solution might be to rename

IStandardEditActions.ClearSelection to IStandardEditActions.Deselect
and
IStandardEditActions.Delete to IStandardEditActions.ClearSelection

but I can't overlook the consequences
(0017213)
TheRoadrunner (reporter)
2010-02-24 13:11

Hi obones,

I don't meen to spam you, but let me present, what I think is the "right" solution.
I have attached my Guiffy diff reports on the three affected files.
I'm well aware that writers of TJvCustomEditor descendants have to handle the renaming of ClearSelection to Deselect.
The change form Delete to ClearSelection is handled in the binding of the interface to the TJvCustomEditorBase class, so it should require no handling.

Kind regards
Søren
(0017215)
AHUser (developer)
2010-02-24 18:34

This is now fixed. The IStandardEditActions.Delete method is gone (it was a relict from copying the IFixedPopupIntf interface) and the IStandardEditActions.ClearSelection method is redirected to TJvEditorCommon.DeleteSelected. The old TJvEditorCommon.ClearSelection is renamed to Deselect.

- Issue History
Date Modified Username Field Change
2010-02-24 08:34 TheRoadrunner New Issue
2010-02-24 09:57 obones Note Added: 0017208
2010-02-24 09:57 obones Status new => feedback
2010-02-24 10:02 TheRoadrunner Note Added: 0017209
2010-02-24 10:20 obones Note Added: 0017210
2010-02-24 10:20 obones Status feedback => confirmed
2010-02-24 10:38 TheRoadrunner Note Added: 0017211
2010-02-24 10:43 TheRoadrunner Note Added: 0017212
2010-02-24 13:06 TheRoadrunner File Added: JvEditor.html
2010-02-24 13:06 TheRoadrunner File Added: JVEditorCommon.html
2010-02-24 13:07 TheRoadrunner File Added: JvStdEditActions.html
2010-02-24 13:11 TheRoadrunner Note Added: 0017213
2010-02-24 18:34 AHUser Note Added: 0017215
2010-02-24 18:34 AHUser Status confirmed => resolved
2010-02-24 18:34 AHUser Fixed in Version => Daily / SVN
2010-02-24 18:34 AHUser Resolution open => fixed
2010-02-24 18:34 AHUser Assigned To => AHUser
2011-06-10 16:09 obones Fixed in Version Daily / SVN => 3.40


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker