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