diff --git a/lcl/forms.pp b/lcl/forms.pp index 5d66be0a90..f941a5bd41 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -345,6 +345,8 @@ type fhtCreate ); + TShowInTaskbar = (stDefault, stAlways, stNever); + { TCustomForm } TCustomForm = class(TScrollingWinControl) @@ -383,7 +385,7 @@ type FRestoredTop: integer; FRestoredWidth: integer; FRestoredHeight: integer; - FShowInTaskbar: Boolean; + FShowInTaskbar: TShowInTaskbar; FWindowState: TWindowState; function IsForm : Boolean; function IsHelpFileStored: boolean; @@ -394,8 +396,6 @@ type procedure DoDestroy; procedure IconChanged(Sender: TObject); function IsKeyPreviewStored: boolean; - function IsShowInTaskBarStored: boolean; - function GetShowInTaskBarDefault: boolean; procedure SetActive(AValue: Boolean); procedure SetActiveControl(AWinControl: TWinControl); procedure SetActiveDefaultControl(AControl: TControl); @@ -409,7 +409,7 @@ type procedure SetMenu(Value : TMainMenu); procedure SetModalResult(const AValue: TModalResult); procedure SetPosition(Value : TPosition); - procedure SetShowInTaskbar(Value: Boolean); + procedure SetShowInTaskbar(Value: TShowInTaskbar); procedure SetVisible(Value: boolean); procedure SetWindowFocus; procedure SetWindowState(Value : TWindowState); @@ -542,8 +542,8 @@ type property RestoredTop: integer read FRestoredTop; property RestoredWidth: integer read FRestoredWidth; property RestoredHeight: integer read FRestoredHeight; - property ShowInTaskBar: Boolean read FShowInTaskbar write SetShowInTaskBar - stored IsShowInTaskBarStored; + property ShowInTaskBar: TShowInTaskbar read FShowInTaskbar write SetShowInTaskBar + default stDefault; property TextHeight: Longint read FDummyTextHeight write FDummyTextHeight stored False; property Visible write SetVisible stored VisibleIsStored default false; diff --git a/lcl/include/customform.inc b/lcl/include/customform.inc index ee9f930bcc..ebcf8b7d86 100644 --- a/lcl/include/customform.inc +++ b/lcl/include/customform.inc @@ -203,17 +203,6 @@ begin Result:=FKeyPreview=true; end; -function TCustomForm.IsShowInTaskBarStored: boolean; -begin - Result := FShowInTaskBar <> GetShowInTaskBarDefault; -end; - -function TCustomForm.GetShowInTaskBarDefault: boolean; -begin - Result := (Application = nil) or (Application.MainForm=nil) - or (Application.MainForm = Self); -end; - procedure TCustomForm.SetCancelControl(NewControl: TControl); var OldCancelControl: TControl; @@ -697,9 +686,6 @@ end; ------------------------------------------------------------------------------} procedure TCustomForm.DoShow; begin - HandleNeeded; - TWSCustomFormClass(WidgetSetClass).SetShowInTaskbar(Self, FShowInTaskbar); - if Assigned(FOnShow) then FOnShow(Self); end; @@ -1236,7 +1222,7 @@ begin end; end; -procedure TCustomForm.SetShowInTaskbar(Value: Boolean); +procedure TCustomForm.SetShowInTaskbar(Value: TShowInTaskbar); begin if Value = FShowInTaskbar then exit; FShowInTaskbar := Value; @@ -1249,7 +1235,7 @@ end; constructor TCustomForm.Create(AOwner : TComponent); begin //DebugLn('[TCustomForm.Create] A Class=',Classname); - FShowInTaskbar := GetShowInTaskBarDefault; + FShowInTaskbar := stDefault; BeginFormUpdate; try @@ -1588,9 +1574,10 @@ var begin Result := false; if Assigned(FOnShortcut) then + begin FOnShortcut(Message, Result); - if Result then - exit; + if Result then exit; + end; if Assigned(FMenu) then begin Result := FMenu.IsShortCut(Message); diff --git a/lcl/interfaces/win32/win32wsforms.pp b/lcl/interfaces/win32/win32wsforms.pp index c705b2fd7d..99db96060e 100644 --- a/lcl/interfaces/win32/win32wsforms.pp +++ b/lcl/interfaces/win32/win32wsforms.pp @@ -92,7 +92,7 @@ type class procedure SetFormBorderStyle(const AForm: TCustomForm; const AFormBorderStyle: TFormBorderStyle); override; class procedure SetIcon(const AForm: TCustomForm; const AIcon: HICON); override; - class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: Boolean); override; + class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: TShowInTaskbar); override; class procedure ShowModal(const ACustomForm: TCustomForm); override; end; @@ -231,7 +231,7 @@ begin Height := LongInt(CW_USEDEFAULT); SubClassWndProc := nil; if ((Application = nil) or (Application.MainForm <> lForm)) - and lForm.ShowInTaskBar then + and (lForm.ShowInTaskBar = stAlways) then Parent := 0; end; // create window @@ -301,7 +301,7 @@ begin end; procedure TWin32WSCustomForm.SetShowInTaskbar(const AForm: TCustomForm; - const AValue: Boolean); + const AValue: TShowInTaskbar); begin if not AForm.HandleAllocated then exit; if (Application <> nil) and (AForm = Application.MainForm) then diff --git a/lcl/widgetset/wsforms.pp b/lcl/widgetset/wsforms.pp index 9f1f3847f8..4cecba7f40 100644 --- a/lcl/widgetset/wsforms.pp +++ b/lcl/widgetset/wsforms.pp @@ -81,7 +81,7 @@ type class procedure SetFormBorderStyle(const AForm: TCustomForm; const AFormBorderStyle: TFormBorderStyle); virtual; class procedure SetIcon(const AForm: TCustomForm; const AIcon: HICON); virtual; - class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: Boolean); virtual; + class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: TShowInTaskbar); virtual; class procedure SetZPosition(const AWinControl: TWinControl; const APosition: TWSZPosition); virtual; class procedure ShowModal(const ACustomForm: TCustomForm); virtual; end; @@ -139,7 +139,7 @@ begin end; procedure TWSCustomForm.SetShowInTaskbar(const AForm: TCustomForm; - const AValue: Boolean); + const AValue: TShowInTaskbar); begin end;