IDE,IdeIntf: Simplify code passing keys from Designer to OI. Debug why works wrong with GT5. Issue #10155.

This commit is contained in:
Juha 2024-03-08 06:47:47 +02:00
parent 09632c3206
commit 790df77a21
2 changed files with 12 additions and 15 deletions

View File

@ -1337,12 +1337,8 @@ end;
procedure TOICustomPropertyGrid.FocusCurrentEditor;
begin
if (IsCurrentEditorAvailable) and (FCurrentEdit.CanFocus) then
begin
FCurrentEdit.SetFocus;
if (FCurrentEdit is TEdit) then
TEdit(FCurrentEdit).SelStart := Length((FCurrentEdit as TEdit).Text);
end;
if FCurrentEdit = ValueEdit then
ValueEdit.SelStart := Length(ValueEdit.Text);
end;
function TOICustomPropertyGrid.ConsistencyCheck: integer;
@ -2299,9 +2295,11 @@ begin
if FCurrentEdit<>nil then
begin
SetActiveControl(FCurrentEdit);
if (FCurrentEdit is TCustomEdit) then
if (FCurrentEdit is TCustomEdit) then begin
DebugLn(['SetItemIndexAndFocus: Selecting All.']);
TCustomEdit(FCurrentEdit).SelectAll
{$IFnDEF UseOINormalCheckBox}
end
else if (FCurrentEdit is TCheckBoxThemed) and WasValueClick then
TCheckBoxThemed(FCurrentEdit).Checked:=not TCheckBoxThemed(FCurrentEdit).Checked;
{$ELSE}

View File

@ -12638,6 +12638,7 @@ end;
procedure TMainIDE.ForwardKeyToObjectInspector(Sender: TObject; Key: TUTF8Char);
var
PropGrid: TOICustomPropertyGrid;
Kind: TTypeKind;
begin
CreateObjectInspector(False);
@ -12645,15 +12646,13 @@ begin
if ObjectInspector1.IsVisible then
begin
ObjectInspector1.FocusGrid;
if ObjectInspector1.GetActivePropertyGrid.CanEditRowValue(False) then
PropGrid := ObjectInspector1.GetActivePropertyGrid;
Kind := PropGrid.GetActiveRow.Editor.GetPropType^.Kind;
if Kind in [tkInteger, tkInt64, tkSString, tkLString, tkAString, tkWString, tkUString] then
begin
Kind := ObjectInspector1.GetActivePropertyGrid.GetActiveRow.Editor.GetPropType^.Kind;
if Kind in [tkInteger, tkInt64, tkSString, tkLString, tkAString, tkWString, tkUString] then
begin
ObjectInspector1.GetActivePropertyGrid.CurrentEditValue := Key;
ObjectInspector1.GetActivePropertyGrid.FocusCurrentEditor;
end;
end
PropGrid.CurrentEditValue := Key;
PropGrid.FocusCurrentEditor;
end;
end;
case DisplayState of
dsSource: DisplayState := dsInspector;