mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 13:20:18 +02:00
ideintf: extended TPropertyEditor for record fields
This commit is contained in:
parent
9cf1648a96
commit
0ec8e94840
@ -534,7 +534,7 @@ begin
|
|||||||
|
|
||||||
// set things up
|
// set things up
|
||||||
Pen.Color := clWindowText;
|
Pen.Color := clWindowText;
|
||||||
Brush.Style := TBrushStyle(GetEnumValue(GetPropInfo^.PropType, CurValue));
|
Brush.Style := TBrushStyle(GetEnumValue(GetPropType, CurValue));
|
||||||
|
|
||||||
// bsClear hack
|
// bsClear hack
|
||||||
if Brush.Style = bsClear then begin
|
if Brush.Style = bsClear then begin
|
||||||
@ -610,7 +610,7 @@ begin
|
|||||||
|
|
||||||
// set thing up and do work
|
// set thing up and do work
|
||||||
Pen.Color := clWindowText;
|
Pen.Color := clWindowText;
|
||||||
i:=GetEnumValue(GetPropInfo^.PropType, CurValue);
|
i:=GetEnumValue(GetPropType, CurValue);
|
||||||
Pen.Style := TPenStyle(i);
|
Pen.Style := TPenStyle(i);
|
||||||
MoveTo(ARect.Left + 1, vTop);
|
MoveTo(ARect.Left + 1, vTop);
|
||||||
LineTo(vRight - 1, vTop);
|
LineTo(vRight - 1, vTop);
|
||||||
|
@ -1511,20 +1511,18 @@ procedure TOICustomPropertyGrid.SetRowValue(CheckFocus, ForceValue: boolean);
|
|||||||
|
|
||||||
function GetPropValue(Editor: TPropertyEditor; Index: integer): string;
|
function GetPropValue(Editor: TPropertyEditor; Index: integer): string;
|
||||||
var
|
var
|
||||||
PropKind: TTypeKind;
|
Info: PTypeInfo;
|
||||||
PropInfo: PPropInfo;
|
|
||||||
BoolVal: Boolean;
|
BoolVal: Boolean;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
PropInfo := Editor.GetPropInfo;
|
Info:=Editor.GetPropType;
|
||||||
PropKind := PropInfo^.PropType^.Kind;
|
case Info^.Kind of
|
||||||
case PropKind of
|
|
||||||
tkInteger, tkInt64:
|
tkInteger, tkInt64:
|
||||||
Result := IntToStr(Editor.GetInt64ValueAt(Index));
|
Result := IntToStr(Editor.GetInt64ValueAt(Index));
|
||||||
tkChar, tkWChar, tkUChar:
|
tkChar, tkWChar, tkUChar:
|
||||||
Result := Char(Editor.GetOrdValueAt(Index));
|
Result := Char(Editor.GetOrdValueAt(Index));
|
||||||
tkEnumeration:
|
tkEnumeration:
|
||||||
Result := GetEnumName(PropInfo^.PropType, Editor.GetOrdValueAt(Index));
|
Result := Editor.GetEnumValueAt(Index);
|
||||||
tkFloat:
|
tkFloat:
|
||||||
Result := FloatToStr(Editor.GetFloatValueAt(Index));
|
Result := FloatToStr(Editor.GetFloatValueAt(Index));
|
||||||
tkBool: begin
|
tkBool: begin
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,10 @@ unit RTTIGrids;
|
|||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
{$IF FPC_FULLVERSION>30300}
|
||||||
|
{$WARN 6060 off : }
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -586,10 +590,12 @@ end;
|
|||||||
procedure TTICustomGrid.AddHeaderPropertyEditor(Prop: TPropertyEditor);
|
procedure TTICustomGrid.AddHeaderPropertyEditor(Prop: TPropertyEditor);
|
||||||
var
|
var
|
||||||
NewProperty: TTIGridProperty;
|
NewProperty: TTIGridProperty;
|
||||||
|
PropName: String;
|
||||||
begin
|
begin
|
||||||
if (FHideProperties.IndexOf(Prop.GetPropInfo^.Name)>=0)
|
PropName:=Prop.GetName;
|
||||||
|
if (FHideProperties.IndexOf(PropName)>=0)
|
||||||
or ((tgoShowOnlyProperties in FTIOptions)
|
or ((tgoShowOnlyProperties in FTIOptions)
|
||||||
and (FShowOnlyProperties.IndexOf(Prop.GetPropInfo^.Name)<0))
|
and (FShowOnlyProperties.IndexOf(PropName)<0))
|
||||||
then begin
|
then begin
|
||||||
// skip property
|
// skip property
|
||||||
Prop.Free;
|
Prop.Free;
|
||||||
|
@ -635,7 +635,7 @@ begin
|
|||||||
|
|
||||||
TheDialog := CreateEnhancedDlg(Strings);
|
TheDialog := CreateEnhancedDlg(Strings);
|
||||||
try
|
try
|
||||||
TheDialog.Caption := Format(SSQLStringsPropertyEditorDlgTitle, [GetPropInfo^.Name]);
|
TheDialog.Caption := Format(SSQLStringsPropertyEditorDlgTitle, [GetName]);
|
||||||
if (GetComponent(0) is TSQLQuery) then
|
if (GetComponent(0) is TSQLQuery) then
|
||||||
begin
|
begin
|
||||||
Query := (GetComponent(0) as TSQLQuery);
|
Query := (GetComponent(0) as TSQLQuery);
|
||||||
|
10
ide/main.pp
10
ide/main.pp
@ -2020,6 +2020,11 @@ var
|
|||||||
ActiveUnitInfo: TUnitInfo;
|
ActiveUnitInfo: TUnitInfo;
|
||||||
CTResult: Boolean;
|
CTResult: Boolean;
|
||||||
begin
|
begin
|
||||||
|
if (InstProp^.Instance=nil) or (InstProp^.PropInfo=nil) then begin
|
||||||
|
debugln(['TMainIDE.PropHookGetCompatibleMethods not a TPersistent property']);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
ActiveSrcEdit:=nil;
|
ActiveSrcEdit:=nil;
|
||||||
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource])
|
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource])
|
||||||
then exit;
|
then exit;
|
||||||
@ -2046,6 +2051,11 @@ var
|
|||||||
ActiveSrcEdit: TSourceEditor;
|
ActiveSrcEdit: TSourceEditor;
|
||||||
ActiveUnitInfo: TUnitInfo;
|
ActiveUnitInfo: TUnitInfo;
|
||||||
begin
|
begin
|
||||||
|
if (InstProp^.Instance=nil) or (InstProp^.PropInfo=nil) then begin
|
||||||
|
debugln(['TMainIDE.PropHookCompatibleMethodExists not a TPersistent property']);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
ActiveSrcEdit:=nil;
|
ActiveSrcEdit:=nil;
|
||||||
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) then
|
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) then
|
||||||
Exit(False);
|
Exit(False);
|
||||||
|
Loading…
Reference in New Issue
Block a user