Merged revision(s) 47983 #01cc0f741c, 47994 #e9dc6f1eff from trunk:

TI Grid: Make a CheckBox boolean editor work somehow. Was stuck on 'True'. Must be fixed properly later.
........
TI Grid: move HookGetCheckboxForBoolean from OI dialog to PropertyGrid. Publish CheckboxForBoolean. Solves issue #27521.
........

git-svn-id: branches/fixes_1_4@48007 -
This commit is contained in:
maxim 2015-02-25 23:10:28 +00:00
parent 5046cb4dc1
commit 829ad5d9e9
2 changed files with 23 additions and 29 deletions

View File

@ -146,8 +146,7 @@ type
property GutterColor: TColor read FGutterColor write FGutterColor;
property GutterEdgeColor: TColor read FGutterEdgeColor write FGutterEdgeColor;
property ShowHints: boolean read FShowHints
write FShowHints;
property ShowHints: boolean read FShowHints write FShowHints;
property AutoShow: boolean read FAutoShow write FAutoShow;
property CheckboxForBoolean: boolean read FCheckboxForBoolean write FCheckboxForBoolean;
property BoldNonDefaultValues: boolean read FBoldNonDefaultValues write FBoldNonDefaultValues;
@ -353,6 +352,7 @@ type
procedure SetSelection(const ASelection:TPersistentSelectionList);
procedure SetPropertyEditorHook(NewPropertyEditorHook:TPropertyEditorHook);
procedure UpdateSelectionNotifications;
procedure HookGetCheckboxForBoolean(var Value: Boolean);
procedure AddPropertyEditor(PropEditor: TPropertyEditor);
procedure AddStringToComboBox(const s: string);
@ -493,17 +493,14 @@ type
property RowCount: integer read GetRowCount;
property Rows[Index: integer]: TOIPropertyGridRow read GetRow;
property RowSpacing: integer read FRowSpacing write SetRowSpacing;
property Selection: TPersistentSelectionList read FSelection
write SetSelection;
property Selection: TPersistentSelectionList read FSelection write SetSelection;
property ShowGutter: Boolean read FShowGutter write SetShowGutter default True;
property CheckboxForBoolean: Boolean read FCheckboxForBoolean
write FCheckboxForBoolean;
property CheckboxForBoolean: Boolean read FCheckboxForBoolean write FCheckboxForBoolean;
property PreferredSplitterX: integer read FPreferredSplitterX
write FPreferredSplitterX default 100;
property SplitterX: integer read FSplitterX write SetSplitterX default 100;
property TopY: integer read FTopY write SetTopY default 0;
property Favorites: TOIFavoriteProperties read FFavorites
write SetFavorites;
property Favorites: TOIFavoriteProperties read FFavorites write SetFavorites;
property Filter : TTypeKinds read FFilter write SetFilter;
end;
@ -722,7 +719,6 @@ type
procedure SetAvailComboBoxText;
procedure HookGetSelection(const ASelection: TPersistentSelectionList);
procedure HookSetSelection(const ASelection: TPersistentSelectionList);
procedure HookGetCheckboxForBoolean(var Value: Boolean);
procedure DestroyNoteBook;
procedure CreateNoteBook;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
@ -761,11 +757,10 @@ type
property InfoBoxHeight: integer read GetInfoBoxHeight write SetInfoBoxHeight;
property OnAddAvailPersistent: TOnAddAvailablePersistent
read FOnAddAvailablePersistent write FOnAddAvailablePersistent;
property OnAddToFavorites: TNotifyEvent read FOnAddToFavorites
write FOnAddToFavorites;
property OnAddToFavorites: TNotifyEvent read FOnAddToFavorites write FOnAddToFavorites;
property OnAutoShow: TNotifyEvent read FOnAutoShow write FOnAutoShow;
property OnFindDeclarationOfProperty: TNotifyEvent
read FOnFindDeclarationOfProperty write FOnFindDeclarationOfProperty;
property OnFindDeclarationOfProperty: TNotifyEvent read FOnFindDeclarationOfProperty
write FOnFindDeclarationOfProperty;
property OnModified: TNotifyEvent read FOnModified write FOnModified;
property OnOIKeyDown: TKeyEvent read FOnOIKeyDown write FOnOIKeyDown;
property OnPropertyHint: TOIPropertyHint read FOnPropertyHint write FOnPropertyHint;
@ -789,10 +784,7 @@ type
property RestrictedProps: TOIRestrictedProperties read FRestricted write SetRestricted;
property Selection: TPersistentSelectionList read FSelection write SetSelection;
property AutoShow: Boolean read FAutoShow write FAutoShow;
property CheckboxForBoolean: Boolean read FCheckboxForBoolean
write FCheckboxForBoolean;
property ShowComponentTree: Boolean read FShowComponentTree
write SetShowComponentTree;
property ShowComponentTree: Boolean read FShowComponentTree write SetShowComponentTree;
property ShowFavorites: Boolean read FShowFavorites write SetShowFavorites;
property ShowInfoBox: Boolean read FShowInfoBox write SetShowInfoBox;
property ShowRestricted: Boolean read FShowRestricted write SetShowRestricted;
@ -866,7 +858,7 @@ begin
FSelection:=TPersistentSelectionList.Create;
FNotificationComponents:=TFPList.Create;
FPropertyEditorHook:=APropertyEditorHook;
PropertyEditorHook:=APropertyEditorHook; // Through property setter.
FFilter:=TypeFilter;
FItemIndex:=-1;
FStates:=[];
@ -969,6 +961,7 @@ begin
Enabled:=false;
AutoSize:=true; // SetBounds does not work for CheckBox, AutoSize does.
Parent:=Self;
Top := -30;
OnMouseDown := @ValueControlMouseDown;
OnMouseMove := @ValueControlMouseMove;
OnExit:=@ValueCheckBoxExit;
@ -1236,6 +1229,7 @@ procedure TOICustomPropertyGrid.SetPropertyEditorHook(
begin
if FPropertyEditorHook=NewPropertyEditorHook then exit;
FPropertyEditorHook:=NewPropertyEditorHook;
FPropertyEditorHook.AddHandlerGetCheckboxForBoolean(@HookGetCheckboxForBoolean);
IncreaseChangeStep;
SetSelection(FSelection);
end;
@ -1264,6 +1258,11 @@ begin
//DebugLn(['TOICustomPropertyGrid.UpdateSelectionNotifications FNotificationComponents=',FNotificationComponents.Count,' FSelection=',FSelection.Count]);
end;
procedure TOICustomPropertyGrid.HookGetCheckboxForBoolean(var Value: Boolean);
begin
Value := FCheckboxForBoolean;
end;
function TOICustomPropertyGrid.PropertyPath(Index:integer):string;
begin
if (Index>=0) and (Index<FRows.Count) then begin
@ -1642,7 +1641,8 @@ begin
ValueCheckBox.State:=cbGrayed
else if NewValue='(True)' then
ValueCheckBox.State:=cbChecked
else
// Note: this condition can be removed when the right propedit is used always.
else if NewValue='(False)' then
ValueCheckBox.State:=cbUnchecked;
end;
@ -3796,7 +3796,7 @@ begin
FShowHints := AnObjInspector.PropertyGrid.ShowHint;
FAutoShow := AnObjInspector.AutoShow;
FCheckboxForBoolean := AnObjInspector.CheckboxForBoolean;
FCheckboxForBoolean := AnObjInspector.FCheckboxForBoolean;
FBoldNonDefaultValues := fsBold in AnObjInspector.PropertyGrid.ValueFont.Style;
FDrawGridLines := AnObjInspector.PropertyGrid.DrawHorzGridLines;
FShowGutter := AnObjInspector.PropertyGrid.ShowGutter;
@ -3826,7 +3826,7 @@ begin
end;
AnObjInspector.DefaultItemHeight := DefaultItemHeight;
AnObjInspector.AutoShow := AutoShow;
AnObjInspector.CheckboxForBoolean := FCheckboxForBoolean;
AnObjInspector.FCheckboxForBoolean := FCheckboxForBoolean;
AnObjInspector.ShowComponentTree := ShowComponentTree;
AnObjInspector.ShowInfoBox := ShowInfoBox;
AnObjInspector.ComponentPanelHeight := ComponentTreeHeight;
@ -4064,10 +4064,8 @@ begin
FPropertyEditorHook:=NewValue;
if FPropertyEditorHook<>nil then begin
FPropertyEditorHook.AddHandlerChangeLookupRoot(@HookLookupRootChange);
FPropertyEditorHook.AddHandlerRefreshPropertyValues(
@HookRefreshPropertyValues);
FPropertyEditorHook.AddHandlerRefreshPropertyValues(@HookRefreshPropertyValues);
FPropertyEditorHook.AddHandlerSetSelection(@HookSetSelection);
FPropertyEditorHook.AddHandlerGetCheckboxForBoolean(@HookGetCheckboxForBoolean);
Selection := nil;
for Page:=Low(TObjectInspectorPage) to High(TObjectInspectorPage) do
if GridControl[Page]<>nil then
@ -4684,11 +4682,6 @@ begin
Selection := ASelection;
end;
procedure TObjectInspectorDlg.HookGetCheckboxForBoolean(var Value: Boolean);
begin
Value := fCheckboxForBoolean;
end;
procedure TObjectInspectorDlg.SetShowComponentTree(const AValue: boolean);
begin
if FShowComponentTree = AValue then Exit;

View File

@ -44,6 +44,7 @@ type
property BackgroundColor;
property BorderSpacing;
property BorderStyle;
property CheckboxForBoolean;
property Constraints;
property DefaultItemHeight;
property DefaultValueFont;