mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-12 22:39:14 +02:00
LCL, fix dbnavigator not hidding buttons at design time, also fix dbnavigator do not react on changing Options property, issue #21305
git-svn-id: trunk@36102 -
This commit is contained in:
parent
cad639764b
commit
b5b42666c1
@ -1141,6 +1141,7 @@ type
|
||||
procedure SetDirection(const AValue: TDBNavButtonDirection);
|
||||
procedure SetFlat(const AValue: Boolean);
|
||||
procedure SetHints(const AValue: TStrings);
|
||||
procedure SetOptions(AValue: TDBNavigatorOptions);
|
||||
procedure SetShowButtonHints(const AValue: boolean);
|
||||
procedure SetVisibleButtons(const AValue: TDBNavButtonSet);
|
||||
procedure CMGetDataLink(var Message: TLMessage); message CM_GETDATALINK;
|
||||
@ -1172,7 +1173,7 @@ type
|
||||
property Direction: TDBNavButtonDirection read FDirection write SetDirection default nbdHorizontal;
|
||||
property Flat: Boolean read FFlat write SetFlat default False;
|
||||
property Hints: TStrings read GetHints write SetHints;
|
||||
property Options: TDBNavigatorOptions read FOptions write FOptions;
|
||||
property Options: TDBNavigatorOptions read FOptions write SetOptions;
|
||||
property OnClick: TDBNavClickEvent read FOnNavClick write FOnNavClick;
|
||||
property VisibleButtons: TDBNavButtonSet read FVisibleButtons
|
||||
write SetVisibleButtons default DefaultDBNavigatorButtons;
|
||||
|
@ -116,6 +116,14 @@ begin
|
||||
FHints.Assign(AValue);
|
||||
end;
|
||||
|
||||
procedure TDBCustomNavigator.SetOptions(AValue: TDBNavigatorOptions);
|
||||
begin
|
||||
if FOptions=AValue then Exit;
|
||||
FOptions:=AValue;
|
||||
if not (csLoading in ComponentState) then
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
||||
procedure TDBCustomNavigator.SetShowButtonHints(const AValue: boolean);
|
||||
begin
|
||||
if FShowButtonHints=AValue then exit;
|
||||
@ -240,6 +248,13 @@ begin
|
||||
else
|
||||
ChildSizing.Layout:=cclTopToBottomThenLeftToRight;
|
||||
|
||||
// force insertion in predefined order
|
||||
for CurButtonType:=Low(Buttons) to High(Buttons) do
|
||||
begin
|
||||
FreeThenNil(Buttons[CurButtonType]);
|
||||
FreeThenNil(FocusableButtons[CurButtonType]);
|
||||
end;
|
||||
|
||||
// not-focusable buttons
|
||||
for CurButtonType:=Low(Buttons) to High(Buttons) do
|
||||
begin
|
||||
@ -263,8 +278,10 @@ begin
|
||||
CurButton.Flat:=Flat;
|
||||
CurButton.Index:=CurButtonType;
|
||||
CurButton.Visible:=CurButtonType in FVisibleButtons;
|
||||
if not (navFocusableButtons in FOptions) then CurButton.Parent := Self
|
||||
else CurButton.Parent := nil;
|
||||
if not (navFocusableButtons in FOptions) and CurButton.Visible then
|
||||
CurButton.Parent := Self
|
||||
else
|
||||
CurButton.Parent := nil;
|
||||
end;
|
||||
|
||||
// focusable buttons
|
||||
@ -290,8 +307,10 @@ begin
|
||||
// update button properties
|
||||
CurFocusableButton.Index:=CurButtonType;
|
||||
CurFocusableButton.Visible:=CurButtonType in FVisibleButtons;
|
||||
if (navFocusableButtons in FOptions) then CurFocusableButton.Parent := Self
|
||||
else CurFocusableButton.Parent := nil;
|
||||
if (navFocusableButtons in FOptions) and CurFocusableButton.Visible then
|
||||
CurFocusableButton.Parent := Self
|
||||
else
|
||||
CurFocusableButton.Parent := nil;
|
||||
end;
|
||||
|
||||
EnableAlign;
|
||||
|
Loading…
Reference in New Issue
Block a user