mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 16:19:28 +02:00
IDEIntf: TOIPropertyGrid: distinguish calling property Edit and changing the value
git-svn-id: trunk@44226 -
This commit is contained in:
parent
fdc2fe0d53
commit
56d751c730
@ -220,7 +220,8 @@ type
|
|||||||
pgsUpdatingEditControl,
|
pgsUpdatingEditControl,
|
||||||
pgsBuildPropertyListNeeded,
|
pgsBuildPropertyListNeeded,
|
||||||
pgsGetComboItemsCalled,
|
pgsGetComboItemsCalled,
|
||||||
pgsIdleEnabled
|
pgsIdleEnabled,
|
||||||
|
pgsCallingEdit // calling property editor Edit
|
||||||
);
|
);
|
||||||
TOIPropertyGridStates = set of TOIPropertyGridState;
|
TOIPropertyGridStates = set of TOIPropertyGridState;
|
||||||
|
|
||||||
@ -789,7 +790,10 @@ type
|
|||||||
const
|
const
|
||||||
DefaultObjectInspectorName: string = 'ObjectInspectorDlg';
|
DefaultObjectInspectorName: string = 'ObjectInspectorDlg';
|
||||||
|
|
||||||
// the ObjectInspector of the IDE can be found in FormEditingIntf
|
// the ObjectInspector descendant of the IDE can be found in FormEditingIntf
|
||||||
|
|
||||||
|
function dbgs(s: TOIPropertyGridState): string; overload;
|
||||||
|
function dbgs(States: TOIPropertyGridStates): string; overload;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -825,6 +829,25 @@ begin
|
|||||||
TOIPropertyGridRow(Item2).Name);
|
TOIPropertyGridRow(Item2).Name);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function dbgs(s: TOIPropertyGridState): string;
|
||||||
|
begin
|
||||||
|
Result:=GetEnumName(TypeInfo(s),ord(s));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function dbgs(States: TOIPropertyGridStates): string;
|
||||||
|
var
|
||||||
|
s: TOIPropertyGridState;
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
for s in States do
|
||||||
|
begin
|
||||||
|
if not (s in States) then continue;
|
||||||
|
if Result<>'' then Result+=',';
|
||||||
|
Result+=dbgs(s);
|
||||||
|
end;
|
||||||
|
Result:='['+Result+']';
|
||||||
|
end;
|
||||||
|
|
||||||
{ TOICustomPropertyGrid }
|
{ TOICustomPropertyGrid }
|
||||||
|
|
||||||
constructor TOICustomPropertyGrid.CreateWithParams(AnOwner:TComponent;
|
constructor TOICustomPropertyGrid.CreateWithParams(AnOwner:TComponent;
|
||||||
@ -1402,10 +1425,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// set value in edit control
|
// set value in edit control
|
||||||
SetCurrentEditValue(CurRow.Editor.GetVisualValue);
|
SetCurrentEditValue(Editor.GetVisualValue);
|
||||||
|
|
||||||
// update volatile sub properties
|
// update volatile sub properties
|
||||||
if (paVolatileSubProperties in CurRow.Editor.GetAttributes)
|
if (paVolatileSubProperties in Editor.GetAttributes)
|
||||||
and ((CurRow.Expanded) or (CurRow.ChildCount>0)) then begin
|
and ((CurRow.Expanded) or (CurRow.ChildCount>0)) then begin
|
||||||
OldExpanded:=CurRow.Expanded;
|
OldExpanded:=CurRow.Expanded;
|
||||||
ShrinkRow(FItemIndex);
|
ShrinkRow(FItemIndex);
|
||||||
@ -1440,14 +1463,14 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
DebugLn(['#################### TOICustomPropertyGrid.DoCallEdit for ',
|
DebugLn(['#################### TOICustomPropertyGrid.DoCallEdit for ',
|
||||||
CurRow.Editor.ClassName,' Edit=',Edit=oiqeEdit]);
|
CurRow.Editor.ClassName,' Edit=',Edit=oiqeEdit]);
|
||||||
Include(FStates,pgsApplyingValue);
|
Include(FStates,pgsCallingEdit);
|
||||||
try
|
try
|
||||||
if Edit=oiqeShowValue then
|
if Edit=oiqeShowValue then
|
||||||
CurRow.Editor.ShowValue
|
CurRow.Editor.ShowValue
|
||||||
else
|
else
|
||||||
CurRow.Editor.Edit;
|
CurRow.Editor.Edit;
|
||||||
finally
|
finally
|
||||||
Exclude(FStates,pgsApplyingValue);
|
Exclude(FStates,pgsCallingEdit);
|
||||||
end;
|
end;
|
||||||
{$IFNDEF DoNotCatchOIExceptions}
|
{$IFNDEF DoNotCatchOIExceptions}
|
||||||
except
|
except
|
||||||
@ -1605,9 +1628,10 @@ var
|
|||||||
NewValue: string;
|
NewValue: string;
|
||||||
EditorAttributes: TPropertyAttributes;
|
EditorAttributes: TPropertyAttributes;
|
||||||
begin
|
begin
|
||||||
|
//if FRows.Count=0 then
|
||||||
|
// debugln(['TOICustomPropertyGrid.SetItemIndex ',DbgSName(Self),' ',dbgsname(FCurrentEdit),' ',dbgs(FStates),' GridIsUpdating=',GridIsUpdating,' FItemIndex=',FItemIndex,' NewIndex=',NewIndex]);
|
||||||
if GridIsUpdating or (FItemIndex = NewIndex) then
|
if GridIsUpdating or (FItemIndex = NewIndex) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
// save old edit value
|
// save old edit value
|
||||||
SetRowValue(true);
|
SetRowValue(true);
|
||||||
|
|
||||||
@ -2030,6 +2054,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result:=
|
Result:=
|
||||||
not GridIsUpdating and IsCurrentEditorAvailable
|
not GridIsUpdating and IsCurrentEditorAvailable
|
||||||
|
and (not (pgsCallingEdit in FStates))
|
||||||
and ((FCurrentEditorLookupRoot = nil)
|
and ((FCurrentEditorLookupRoot = nil)
|
||||||
or (FPropertyEditorHook = nil)
|
or (FPropertyEditorHook = nil)
|
||||||
or (FPropertyEditorHook.LookupRoot = FCurrentEditorLookupRoot));
|
or (FPropertyEditorHook.LookupRoot = FCurrentEditorLookupRoot));
|
||||||
|
Loading…
Reference in New Issue
Block a user