View Issue Details

IDProjectCategoryView StatusLast Update
0005178JEDI VCL00 JVCL Componentspublic2011-06-10 16:09
ReporterTheRoadrunnerAssigned ToAHUser 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.38 
Target VersionFixed in Version3.40 
Summary0005178: TJvCustomEditorBase.ClearSelection does not clear, just deselects
DescriptionUsing a TJVHLEditor wired up with a TJvEditDelete action does not work when text is seleceted and 'Delete' is pressed.
Additional Informationprocedure TJvCustomEditorBase.ClearSelection;
begin
  SetUnSelected;
end;

should be changed to:

procedure TJvCustomEditorBase.ClearSelection;
begin
  DeleteSelected;
end;

TagsNo tags attached.

Activities

obones

2010-02-24 09:57

administrator   ~0017208

I'm sorry, but clearing the selection is just meant to unselect everything, not delete the selected text.

TheRoadrunner

2010-02-24 10:02

reporter   ~0017209

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?

obones

2010-02-24 10:20

administrator   ~0017210

Hum, bugger.
This is bad naming of procedures then

TheRoadrunner

2010-02-24 10:38

reporter   ~0017211

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;

TheRoadrunner

2010-02-24 10:43

reporter   ~0017212

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

2010-02-24 13:06

 

JvEditor.html (12,403 bytes)

2010-02-24 13:06

 

JVEditorCommon.html (21,319 bytes)

2010-02-24 13:07

 

JvStdEditActions.html (12,241 bytes)

TheRoadrunner

2010-02-24 13:11

reporter   ~0017213

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

AHUser

2010-02-24 18:34

developer   ~0017215

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