On 4/19/07, Vincent Snijders <[EMAIL PROTECTED]> wrote:
> +    if (FCurrentEdit is TCustomEdit) then
> +      TEdit(FCurrentEdit).SelectAll;

This doesn't look right, checking for TCustomEdit and then casting to TEdit.



That will work and does. TEdit doesn't implement anything new and all
that the cast is for, is to call the TCustomEdit.SelectAll() method.
Even if I changed the cast to TCustomEdit, it will end up calling the
exact same method.

But to make things look consistent....  :-)
... Attached is a updated patch using TCustomEdit for the cast as well.


--
Graeme Geldenhuys

There's no place like S34° 03.168'  E018° 49.342'
Index: ideintf/objectinspector.pp
===================================================================
--- ideintf/objectinspector.pp	(revision 10971)
+++ ideintf/objectinspector.pp	(working copy)
@@ -1639,7 +1639,12 @@
 procedure TOICustomPropertyGrid.SetItemIndexAndFocus(NewItemIndex: integer);
 begin
   ItemIndex:=NewItemIndex;
-  if FCurrentEdit<>nil then FCurrentEdit.SetFocus;
+  if FCurrentEdit<>nil then
+  begin
+    FCurrentEdit.SetFocus;
+    if (FCurrentEdit is TCustomEdit) then
+      TCustomEdit(FCurrentEdit).SelectAll;
+  end;
 end;
 
 function TOICustomPropertyGrid.CanEditRowValue: boolean;
@@ -1854,7 +1859,11 @@
       Handled:=false;
 
   VK_RETURN:
-    SetRowValue;
+    begin
+      SetRowValue;
+      if (FCurrentEdit is TCustomEdit) then
+        TCustomEdit(FCurrentEdit).SelectAll;
+    end;
 
   else
     if Assigned(OnOIKeyDown) then

Reply via email to