From 477ec0d4452eaf7c3c0d4b61ebf376498bf0822d Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 11 Jul 2004 13:03:54 +0000 Subject: [PATCH] extended RolesForForm to manage multiple roles for on control git-svn-id: trunk@5665 - --- lcl/buttons.pp | 10 +- lcl/comctrls.pp | 93 +++++++++----- lcl/controls.pp | 11 +- lcl/extctrls.pp | 13 +- lcl/forms.pp | 1 + lcl/include/buttons.inc | 32 +++-- lcl/include/control.inc | 13 +- lcl/include/customform.inc | 43 ++++--- lcl/include/trackbar.inc | 255 +++++++++++++++---------------------- 9 files changed, 247 insertions(+), 224 deletions(-) diff --git a/lcl/buttons.pp b/lcl/buttons.pp index f7b18633dc..8919cb6649 100644 --- a/lcl/buttons.pp +++ b/lcl/buttons.pp @@ -77,17 +77,16 @@ type procedure RealSetText(const Value: TCaption); override; function ChildClassAllowed(ChildClass: TClass): boolean; override; public - constructor Create(AOwner: TComponent); override; - + constructor Create(TheOwner: TComponent); override; procedure ExecuteDefaultAction; override; procedure ExecuteCancelAction; override; - procedure SetRoleForForm(NewRole: TControlRoleForForm); override; + procedure UpdateRolesForForm; override; published property Action; property Anchors; property Align; property Constraints; - property Default : Boolean read FDefault write SetDefault default false; + property Default: Boolean read FDefault write SetDefault default false; property Enabled; property ModalResult: TModalResult read FModalResult write FModalResult default mrNone; property Cancel: Boolean read FCancel write SetCancel default false; @@ -334,6 +333,9 @@ end. { ============================================================================= $Log$ + Revision 1.71 2004/07/11 13:03:53 mattias + extended RolesForForm to manage multiple roles for on control + Revision 1.70 2004/07/04 20:07:08 micha form notifies control of new role diff --git a/lcl/comctrls.pp b/lcl/comctrls.pp index 7011a99ad6..40ee62e278 100644 --- a/lcl/comctrls.pp +++ b/lcl/comctrls.pp @@ -1322,14 +1322,14 @@ type {$ENDIF} - { TTrackBar } + { TCustomTrackBar } TTrackBarOrientation = (trHorizontal, trVertical); TTickMark = (tmBottomRight, tmTopLeft, tmBoth); TTickStyle = (tsNone, tsAuto, tsManual); TTrackBarScalePos = (trLeft, trRight, trTop, trBottom); - TTrackBar = class(TWinControl) + TCustomTrackBar = class(TWinControl) private FOrientation: TTrackBarOrientation; FTickMarks: TTickMark; @@ -1340,75 +1340,99 @@ type FMax: Integer; FFrequency: Integer; FPosition: Integer; - FSelStart: Integer; - FSelEnd: Integer; FShowScale : boolean; FScalePos : TTrackBarScalePos; FScaleDigits : integer; FOnChange: TNotifyEvent; + procedure SetFrequency(Value: Integer); + procedure SetLineSize(Value: Integer); + procedure SetMax(Value: Integer); + procedure SetMin(Value: Integer); procedure SetOrientation(Value: TTrackBarOrientation); + procedure SetPageSize(Value: Integer); procedure SetParams(APosition, AMin, AMax: Integer); procedure SetPosition(Value: Integer); - procedure SetMin(Value: Integer); - procedure SetMax(Value: Integer); - procedure SetFrequency(Value: Integer); - procedure SetTickStyle(Value: TTickStyle); - procedure SetTickMarks(Value: TTickMark); - procedure SetLineSize(Value: Integer); - procedure SetPageSize(Value: Integer); - procedure SetSelStart(Value: Integer); - procedure SetSelEnd(Value: Integer); - procedure UpdateSelection; - private { additional functionality } - procedure SetShowScale(Value: boolean); procedure SetScalePos(Value: TTrackBarScalePos); + procedure SetShowScale(Value: boolean); + procedure SetTickMarks(Value: TTickMark); + procedure SetTickStyle(Value: TTickStyle); + procedure UpdateSelection; protected procedure ApplyChanges; procedure DoChange(var msg); message LM_CHANGED; procedure InitializeWnd; override; + procedure Loaded; override; public constructor Create(AOwner: TComponent); override; procedure SetTick(Value: Integer); published - property Ctl3D; - property DragCursor; - property Enabled; property Frequency: Integer read FFrequency write SetFrequency; - property Hint; property LineSize: Integer read FLineSize write SetLineSize default 1; property Max: Integer read FMax write SetMax default 10; property Min: Integer read FMin write SetMin default 0; property OnChange: TNotifyEvent read FOnChange write FOnChange; + property Orientation: TTrackBarOrientation read FOrientation write SetOrientation; + property PageSize: Integer read FPageSize write SetPageSize default 2; + property Position: Integer read FPosition write SetPosition; + property ScalePos: TTrackBarScalePos read FScalePos write SetScalePos; + property ShowScale: boolean read FShowScale write SetShowScale; + property TabStop default True; + property TickMarks: TTickMark read FTickMarks write SetTickMarks default tmBottomRight; + property TickStyle: TTickStyle read FTickStyle write SetTickStyle default tsAuto; + end; + + + { TTrackBar } + + TTrackBar = class(TCustomTrackBar) + published + property Align; + property Anchors; + property Constraints; + property Ctl3D; + property DragCursor; + property DragMode; + property Enabled; + property Frequency; + property Hint; + property LineSize; + property Max; + property Min; + property OnChange; property OnChangeBounds; + property OnClick; property OnDragDrop; property OnDragOver; property OnEndDrag; property OnEnter; property OnExit; + property OnMouseDown; + property OnMouseEnter; + property OnMouseLeave; + property OnMouseMove; + property OnMouseUp; property OnKeyDown; property OnKeyPress; property OnKeyUp; property OnResize; property OnStartDrag; - property Orientation: TTrackBarOrientation read FOrientation write SetOrientation; - property PageSize: Integer read FPageSize write SetPageSize default 2; + property Orientation; + property PageSize; property ParentCtl3D; property ParentShowHint; property PopupMenu; - property Position: Integer read FPosition write SetPosition; - property SelEnd: Integer read FSelEnd write SetSelEnd; - property SelStart: Integer read FSelStart write SetSelStart; + property Position; + property ScalePos; property ShowHint; + property ShowScale; property TabOrder; - property TabStop default True; - property TickMarks: TTickMark read FTickMarks write SetTickMarks; - property TickStyle: TTickStyle read FTickStyle write SetTickStyle; + property TabStop; + property TickMarks; + property TickStyle; property Visible; - published { additional functionality } - property ShowScale : boolean read FShowScale write SetShowScale; - property ScalePos : TTrackBarScalePos read FScalePos write SetScalePos; - property DragMode; end; + + { TTreeNode } @@ -2258,6 +2282,9 @@ end. { ============================================================================= $Log$ + Revision 1.135 2004/07/11 13:03:53 mattias + extended RolesForForm to manage multiple roles for on control + Revision 1.134 2004/06/28 23:16:24 mattias added TListView.AddItems from Andrew Haines @@ -2438,7 +2465,7 @@ end. fixed taborder=0, implemented TabOrder Editor Revision 1.77 2003/06/13 21:13:20 mattias - fixed TTrackBar initial size + fixed TCustomTrackBar initial size Revision 1.76 2003/06/13 12:53:51 mattias fixed TUpDown and added handler lists for TControl diff --git a/lcl/controls.pp b/lcl/controls.pp index 847cfbc425..01e075a8fb 100644 --- a/lcl/controls.pp +++ b/lcl/controls.pp @@ -206,7 +206,11 @@ type TBorderStyle = bsNone..bsSingle; TControlBorderStyle = TBorderStyle; - TControlRoleForForm = (crffNormal, crffDefault, crffCancel); + TControlRoleForForm = ( + crffDefault,// this control is notified when user presses Return + crffCancel // this control is notified when user presses Escape + ); + TControlRolesForForm = set of TControlRoleForForm; TBevelCut = TGraphicsBevelCut; @@ -1026,7 +1030,7 @@ type procedure CheckNewParent(AParent: TWinControl); virtual; procedure SendToBack; procedure SetTempCursor(Value: TCursor); - procedure SetRoleForForm(NewRole: TControlRoleForForm); virtual; + procedure UpdateRolesForForm; virtual; procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual; procedure SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); virtual; procedure SetBoundsKeepBase(aLeft, aTop, aWidth, aHeight: integer; @@ -2337,6 +2341,9 @@ end. { ============================================================================= $Log$ + Revision 1.225 2004/07/11 13:03:53 mattias + extended RolesForForm to manage multiple roles for on control + Revision 1.224 2004/07/07 22:26:57 mattias fixed showing grabers for boundless components diff --git a/lcl/extctrls.pp b/lcl/extctrls.pp index 713dc9afb3..5a1a851f7d 100644 --- a/lcl/extctrls.pp +++ b/lcl/extctrls.pp @@ -521,20 +521,20 @@ type property AutoSize; property Center; property Constraints; - property Picture; - property Visible; property OnChangeBounds; property OnClick; property OnMouseDown; - property OnMouseMove; - property OnMouseUp; property OnMouseEnter; property OnMouseLeave; + property OnMouseMove; + property OnMouseUp; property OnPaint; property OnResize; + property Picture; + property Proportional; property Stretch; property Transparent; - property Proportional; + property Visible; end; @@ -945,6 +945,9 @@ end. { $Log$ + Revision 1.109 2004/07/11 13:03:53 mattias + extended RolesForForm to manage multiple roles for on control + Revision 1.108 2004/07/10 18:17:30 mattias added Delphi ToDo support, Application.WndProc, small bugfixes from Colin diff --git a/lcl/forms.pp b/lcl/forms.pp index 9cca3647ea..65f301c048 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -445,6 +445,7 @@ type function SetFocusedControl(Control: TWinControl): Boolean ; Virtual; procedure FocusControl(WinControl: TWinControl); function ShowModal : Integer; + function GetRolesForControl(AControl: TControl): TControlRolesForForm; public property Active: Boolean read FActive; property ActiveControl: TWinControl read FActiveControl write SetActiveControl; diff --git a/lcl/include/buttons.inc b/lcl/include/buttons.inc index e5badba6a4..4ad3c5e596 100644 --- a/lcl/include/buttons.inc +++ b/lcl/include/buttons.inc @@ -21,23 +21,23 @@ { TButton Constructor } {------------------------------------------------------------------------------} -constructor TButton.Create(AOwner: TComponent); +constructor TButton.Create(TheOwner: TComponent); begin - Inherited Create(AOwner); + Inherited Create(TheOwner); With FShortcut do begin OldKey := 0; OldModifier := [ssCtrl]; NewModifier := [ssCtrl]; NewKey := 0; end; - {set the component style to csButton} + // set the component style to csButton fCompStyle := csButton; ControlStyle:=ControlStyle-[csClickEvents]+[csHasDefaultAction,csHasCancelAction]; TabStop := true; - {set default alignment} + // set default alignment Align := alNone; - {setup default sizes} - SetInitialBounds(1, 1, 75, 25); + // setup default sizes + SetInitialBounds(0,0,75,25); end; {------------------------------------------------------------------------------ @@ -96,10 +96,21 @@ begin DoSendBtnDefault; end; -procedure TButton.SetRoleForForm(NewRole: TControlRoleForForm); +procedure TButton.UpdateRolesForForm; +var + AForm: TCustomForm; + NewRoles: TControlRolesForForm; begin - Default := NewRole = crffDefault; - Cancel := NewRole = crffCancel; + AForm:=GetParentForm(Self); + if AForm=nil then begin + // not on a form => keep settings + exit; + end else begin + // on a form => use settings of parent form + NewRoles:=AForm.GetRolesForControl(Self); + Default := crffDefault in NewRoles; + Cancel := crffCancel in NewRoles; + end; end; {------------------------------------------------------------------------------ @@ -216,6 +227,9 @@ end; { ============================================================================= $Log$ + Revision 1.31 2004/07/11 13:03:54 mattias + extended RolesForForm to manage multiple roles for on control + Revision 1.30 2004/07/04 20:07:08 micha form notifies control of new role diff --git a/lcl/include/control.inc b/lcl/include/control.inc index a7af2cab6e..bc8ff58a0a 100644 --- a/lcl/include/control.inc +++ b/lcl/include/control.inc @@ -247,10 +247,6 @@ begin Invalidate; end; -procedure TControl.SetRoleForForm(NewRole: TControlRoleForForm); -begin -end; - procedure TControl.SetAction(Value: TBasicAction); begin if (Value=Action) then exit; @@ -1934,6 +1930,12 @@ begin TWSControlClass(WidgetSetClass).SetCursor(Self, Value); end; +procedure TControl.UpdateRolesForForm; +begin + // called by the form when the "role" controls DefaultControl or CancelControl + // has changed +end; + {------------------------------------------------------------------------------} { TControl SetCursor } {------------------------------------------------------------------------------} @@ -3217,6 +3219,9 @@ end; { ============================================================================= $Log$ + Revision 1.204 2004/07/11 13:03:54 mattias + extended RolesForForm to manage multiple roles for on control + Revision 1.203 2004/07/07 22:26:58 mattias fixed showing grabers for boundless components diff --git a/lcl/include/customform.inc b/lcl/include/customform.inc index 9d846befc6..d4b60c01a5 100644 --- a/lcl/include/customform.inc +++ b/lcl/include/customform.inc @@ -194,35 +194,35 @@ end; procedure TCustomForm.SetCancelControl(NewControl: TControl); var - lControl: TControl; + OldCancelControl: TControl; begin if NewControl <> FCancelControl then begin - // prevent inf. recursion problems - lControl := FCancelControl; - FCancelControl := nil; - if lControl <> nil then - lControl.SetRoleForForm(crffNormal); + OldCancelControl:=FCancelControl; FCancelControl := NewControl; - if NewControl <> nil then - NewControl.SetRoleForForm(crffCancel); + // notify old control + if OldCancelControl<>nil then + OldCancelControl.UpdateRolesForForm; + // notify new control + if FCancelControl<>nil then + FCancelControl.UpdateRolesForForm; end; end; procedure TCustomForm.SetDefaultControl(NewControl: TControl); var - lControl: TControl; + OldDefaultControl: TControl; begin if NewControl <> FDefaultControl then begin - // prevent inf. recursion problems - lControl := FDefaultControl; - FDefaultControl := nil; - if lControl <> nil then - lControl.SetRoleForForm(crffNormal); + OldDefaultControl:=FDefaultControl; FDefaultControl := NewControl; - if NewControl <> nil then - NewControl.SetRoleForForm(crffDefault); + // notify old control + if OldDefaultControl<>nil then + OldDefaultControl.UpdateRolesForForm; + // notify new control + if FDefaultControl<>nil then + FDefaultControl.UpdateRolesForForm; end; end; @@ -1637,9 +1637,20 @@ begin end; end; +function TCustomForm.GetRolesForControl(AControl: TControl + ): TControlRolesForForm; +begin + Result:=[]; + if DefaultControl=AControl then Include(Result,crffDefault); + if CancelControl=AControl then Include(Result,crffCancel); +end; + { ============================================================================= $Log$ + Revision 1.145 2004/07/11 13:03:54 mattias + extended RolesForForm to manage multiple roles for on control + Revision 1.144 2004/07/07 15:31:47 micha fix code editor restoring when maximized upon ctrl+shift+up diff --git a/lcl/include/trackbar.inc b/lcl/include/trackbar.inc index ac2454148d..ef23af11ae 100644 --- a/lcl/include/trackbar.inc +++ b/lcl/include/trackbar.inc @@ -1,7 +1,7 @@ {%MainUnit ../comctrls.pp} {****************************************************************************** - TTrackBar + TCustomTrackBar ****************************************************************************** ***************************************************************************** @@ -53,13 +53,13 @@ } {ASSERTIONS ON} {------------------------------------------------------------------------------ - Method: TTrackBar.Create + Method: TCustomTrackBar.Create Params: AOwner: the owner of the class Returns: Nothing Constructor for the trackbar. ------------------------------------------------------------------------------} -constructor TTrackBar.Create (AOwner : TComponent); +constructor TCustomTrackBar.Create (AOwner : TComponent); begin inherited Create (aOwner); fCompStyle := csTrackbar; @@ -68,70 +68,69 @@ begin FMax := 10; FMin := 0; FPosition := 0; - FLineSize := 1; FPageSize := 2; FOrientation := trHorizontal; FShowScale := false; FScalePos := trTop; FScaleDigits := 0; + FTickMarks:=tmBottomRight; + FTickStyle:=tsAuto; TabStop := true; SetInitialBounds(0,0,100,20); end; {------------------------------------------------------------------------------ - Method: TTrackBar.InitializeWnd + Method: TCustomTrackBar.InitializeWnd Params: none Returns: Nothing Set all properties after visual component has been created. Will be called from TWinControl. ------------------------------------------------------------------------------} -procedure TTrackBar.InitializeWnd; +procedure TCustomTrackBar.InitializeWnd; begin inherited InitializeWnd; ApplyChanges; end; +procedure TCustomTrackBar.Loaded; +begin + inherited Loaded; + ApplyChanges; +end; + {------------------------------------------------------------------------------ - Method: TTrackBar.SetTick + Method: TCustomTrackBar.SetTick Params: Value : new tick Returns: Nothing ------------------------------------------------------------------------------} -procedure TTrackBar.SetTick(Value: Integer); +procedure TCustomTrackBar.SetTick(Value: Integer); begin { := Value; } end; - {------------------------------------------------------------------------------ - Method: TTrackBar.SetOrientation + Method: TCustomTrackBar.SetOrientation Params: Value : new orientation Returns: Nothing Change the orientation of the trackbar. ------------------------------------------------------------------------------} -procedure TTrackBar.SetOrientation(Value: TTrackBarOrientation); +procedure TCustomTrackBar.SetOrientation(Value: TTrackBarOrientation); begin - if FOrientation <> Value then - begin - FOrientation := Value; - if HandleAllocated then - begin - RecreateWnd; -//TODO: Use "RecreateWnd;" instead of the calls below! -// CNSendMessage (LM_Destroy, Self, nil); -// CreateComponent (Owner); -//TODO: MWE: check if th next lines are stil needed while we're usin RecreateWnd - SetBounds (Left, Top, Width, Height); - ApplyChanges; { update min, max and current position } - Show; - end; - end; + if FOrientation <> Value then + begin + FOrientation := Value; + if HandleAllocated then + begin + RecreateWnd; + end; + end; end; {------------------------------------------------------------------------------ - Method: TTrackBar.SetParams + Method: TCustomTrackBar.SetParams Params: APosition : new position AMin : new minimum AMax : new maximum @@ -139,250 +138,204 @@ end; Set new parameters for the trackbar. ------------------------------------------------------------------------------} -procedure TTrackBar.SetParams(APosition, AMin, AMax: Integer); +procedure TCustomTrackBar.SetParams(APosition, AMin, AMax: Integer); begin - FPosition := APosition; - FMax := AMax; - FMin := AMin; - if FMax > FMin - then ApplyChanges - else ; + if (not (csLoading in ComponentState)) then begin + if AMin>AMax then AMin:=AMax; + if APositionAMax then APosition:=AMax; + end; + if (FPosition=APosition) and (FMin=AMin) and (AMax=AMin) then exit; + FPosition := APosition; + FMax := AMax; + FMin := AMin; + ApplyChanges; end; {------------------------------------------------------------------------------ - Method: TTrackBar.SetPosition + Method: TCustomTrackBar.SetPosition Params: Value : new position Returns: Nothing Set actual position of the trackbar. ------------------------------------------------------------------------------} -procedure TTrackBar.SetPosition(Value: Integer); +procedure TCustomTrackBar.SetPosition(Value: Integer); begin - if FPosition <> Value then - begin - FPosition := Value; - if HandleAllocated - then CNSendMessage (LM_SetValue, self, @FPosition); - end; + if FPosition <> Value then + begin + FPosition := Value; + if HandleAllocated + then CNSendMessage(LM_SetValue, Self, @FPosition); + end; end; {------------------------------------------------------------------------------ - Method: TTrackBar.SetMin + Method: TCustomTrackBar.SetMin Params: Value : new minimum Returns: Nothing Set minimum value of the trackbar. ------------------------------------------------------------------------------} -procedure TTrackBar.SetMin(Value: Integer); +procedure TCustomTrackBar.SetMin(Value: Integer); begin - if FMin <> Value then SetParams (FPosition, Value, FMax); + if FMin <> Value then SetParams(FPosition,Value,FMax); end; {------------------------------------------------------------------------------ - Method: TTrackBar.SetMax + Method: TCustomTrackBar.SetMax Params: Value : new maximum Returns: Nothing Set maximum value of the trackbar. ------------------------------------------------------------------------------} -procedure TTrackBar.SetMax(Value: Integer); +procedure TCustomTrackBar.SetMax(Value: Integer); begin - if FMax <> Value then SetParams (FPosition, FMin, Value); + if FMax<>Value then SetParams(FPosition,FMin,Value); end; {------------------------------------------------------------------------------ - Method: TTrackBar.SetFrequency + Method: TCustomTrackBar.SetFrequency Params: Value : new frequency Returns: Nothing ------------------------------------------------------------------------------} -procedure TTrackBar.SetFrequency(Value: Integer); +procedure TCustomTrackBar.SetFrequency(Value: Integer); begin - FFrequency := Value; + FFrequency := Value; end; {------------------------------------------------------------------------------ - Method: TTrackBar.SetTickStyle + Method: TCustomTrackBar.SetTickStyle Params: Value : new tickstyle Returns: Nothing ------------------------------------------------------------------------------} -procedure TTrackBar.SetTickStyle(Value: TTickStyle); +procedure TCustomTrackBar.SetTickStyle(Value: TTickStyle); begin - FTickStyle := Value; + FTickStyle := Value; end; {------------------------------------------------------------------------------ - Method: TTrackBar.SetTickMarks + Method: TCustomTrackBar.SetTickMarks Params: Value : new tickmarks Returns: Nothing ------------------------------------------------------------------------------} -procedure TTrackBar.SetTickMarks(Value: TTickMark); +procedure TCustomTrackBar.SetTickMarks(Value: TTickMark); begin - FTickMarks := Value; + FTickMarks := Value; end; {------------------------------------------------------------------------------ - Method: TTrackBar.SetLineSize + Method: TCustomTrackBar.SetLineSize Params: Value : new linesize Returns: Nothing Set the increment which is used when one of the arrow-keys is pressed. ------------------------------------------------------------------------------} -procedure TTrackBar.SetLineSize(Value: Integer); +procedure TCustomTrackBar.SetLineSize(Value: Integer); begin - if FLineSize <> Value then - begin - FLineSize := Value; - ApplyChanges - end + if FLineSize <> Value then + begin + FLineSize := Value; + ApplyChanges; + end end; {------------------------------------------------------------------------------ - Method: TTrackBar.SetPageSize + Method: TCustomTrackBar.SetPageSize Params: Value : new pagesize Returns: Nothing Set the increment which is used when one of the arrow-keys is pressed together with a modifier or when PgUp/PgDwn are pressed. ------------------------------------------------------------------------------} -procedure TTrackBar.SetPageSize(Value: Integer); +procedure TCustomTrackBar.SetPageSize(Value: Integer); begin - if FPageSize <> Value then - begin - FPageSize := Value; - ApplyChanges - end + if FPageSize <> Value then + begin + FPageSize := Value; + ApplyChanges; + end; end; {------------------------------------------------------------------------------ - Method: TTrackBar.SetSelStart + Method: TCustomTrackBar.UpdateSelection Params: Returns: Nothing ------------------------------------------------------------------------------} -procedure TTrackBar.SetSelStart(Value: Integer); -begin -{ := Value; } -end; - -{------------------------------------------------------------------------------ - Method: TTrackBar.SetSelEnd - Params: - Returns: Nothing - - ------------------------------------------------------------------------------} -procedure TTrackBar.SetSelEnd(Value: Integer); -begin -{ := Value; } -end; - -{------------------------------------------------------------------------------ - Method: TTrackBar.UpdateSelection - Params: - Returns: Nothing - - ------------------------------------------------------------------------------} -procedure TTrackBar.UpdateSelection; +procedure TCustomTrackBar.UpdateSelection; begin end; {------------------------------------------------------------------------------ - Method: TTrackBar.ApplyChanges + Method: TCustomTrackBar.ApplyChanges Params: none Returns: Nothing Sends message to update the visual apperance of the object. ------------------------------------------------------------------------------} -procedure TTrackBar.ApplyChanges; +procedure TCustomTrackBar.ApplyChanges; begin - if HandleAllocated - then CNSendMessage (LM_SETPROPERTIES, Self, nil); + if HandleAllocated and (not (csLoading in ComponentState)) + then CNSendMessage (LM_SETPROPERTIES, Self, nil); end; {------------------------------------------------------------------------------ - Method: TTrackBar.DoChange + Method: TCustomTrackBar.DoChange Params: Msg (longint = LM_CHANGE) Returns: Nothing Update position and call user's callback for Change event. ------------------------------------------------------------------------------} -procedure TTrackBar.DoChange(var msg); +procedure TCustomTrackBar.DoChange(var msg); var - tmpPosition : longint; + tmpPosition : longint; begin - CNSendMessage (LM_GetValue, Self, @tmpPosition); - Assert(True, 'Trace:Trackbar received a message -CHANGE'); - FPosition := TmpPosition; - if Assigned (FOnChange) - then FOnChange (Self); + CNSendMessage (LM_GetValue, Self, @tmpPosition); + Assert(True, 'Trace:Trackbar received a message -CHANGE'); + FPosition := TmpPosition; + if Assigned (FOnChange) + then FOnChange(Self); end; {------------------------------------------------------------------------------ - Method: TTrackBar.SetShowScale + Method: TCustomTrackBar.SetShowScale Params: value : true = show scaling text Returns: Nothing ------------------------------------------------------------------------------} -procedure TTrackBar.SetShowScale(Value: boolean); +procedure TCustomTrackBar.SetShowScale(Value: boolean); begin if FShowScale <> Value then begin - FShowScale := Value; - ApplyChanges; + FShowScale := Value; + ApplyChanges; end; end; {------------------------------------------------------------------------------ - Method: TTrackBar.SetScalePos + Method: TCustomTrackBar.SetScalePos Params: value : position of the scaling text Returns: Nothing ------------------------------------------------------------------------------} -procedure TTrackBar.SetScalePos(Value: TTrackBarScalePos); +procedure TCustomTrackBar.SetScalePos(Value: TTrackBarScalePos); begin if FScalePos <> Value then begin - FScalePos := Value; - ApplyChanges; + FScalePos := Value; + ApplyChanges; end; end; { -------------------- unimplemented stuff below ------------------------------} -{------------------------------------------------------------------------------ - Method: TTrackBar.CreateParams - Params: Params : ? - Returns: Nothing - - ------------------------------------------------------------------------------ -procedure CreateParams(var Params: TCreateParams); -begin -end; -} -{------------------------------------------------------------------------------ - Method: TTrackBar.CreateWnd - Params: Nothing - Returns: Nothing - - ------------------------------------------------------------------------------ -procedure CreateWnd; -begin -end; -} -{------------------------------------------------------------------------------ - Method: TTrackBar.DestroyWnd - Params: Nothing - Returns: Nothing - - ------------------------------------------------------------------------------ -procedure DestroyWnd; -begin -end; -} - { $Log$ + Revision 1.12 2004/07/11 13:03:54 mattias + extended RolesForForm to manage multiple roles for on control + Revision 1.11 2004/04/10 17:58:57 mattias implemented mainunit hints for include files @@ -399,7 +352,7 @@ end; enable tabstops for controls; implement tabstops in win32 intf Revision 1.6 2003/06/13 21:13:20 mattias - fixed TTrackBar initial size + fixed TCustomTrackBar initial size Revision 1.5 2002/05/10 06:05:56 lazarus MG: changed license to LGPL @@ -453,14 +406,14 @@ end; Revision 1.4 1999/09/26 13:30:15 lazarus - Implemented OnEnter & OnExit events for TTrackbar. These properties + Implemented OnEnter & OnExit events for TCustomTrackBar. These properties and handler functions have been added to TWincontrol, two new callbacks have been added to gtkcallback. stoppok Revision 1.3 1999/09/23 20:33:32 lazarus - reintroduced changes to TTrackbar from v1.46 which where lost in 1.48. - Some addtional changes to TTrackbar also applied. + reintroduced changes to TCustomTrackBar from v1.46 which where lost in 1.48. + Some addtional changes to TCustomTrackBar also applied. stoppok Revision 1.2 1999/09/17 20:49:03 lazarus @@ -470,7 +423,7 @@ end; stoppok Revision 1.1 1999/09/03 22:01:01 lazarus - Added TTrackBar + Added TCustomTrackBar stoppok }