You've already forked lazarus-ccr
TvPlanIt: Avoid windows-like messages in printing routines (fixes crashes in cocoa related to PrintPreview).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8888 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -42,7 +42,7 @@ uses
|
||||
VpBase, VpBaseDS, VpConst;
|
||||
|
||||
type
|
||||
TVpPrintFormatComboBox = class (TCustomComboBox)
|
||||
TVpPrintFormatComboBox = class (TCustomComboBox, IVpWatcher)
|
||||
private
|
||||
FControlLink : TVpControlLink;
|
||||
|
||||
@@ -53,7 +53,12 @@ type
|
||||
procedure Notification (AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure SetAbout(const Value: string);
|
||||
procedure SetControlLink(const v: TVpControlLink);
|
||||
procedure VpPrintFormatChanged(var Msg: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF}); message Vp_PrintFormatChanged;
|
||||
{$IFDEF LCL}
|
||||
procedure VpDatastoreChanged;
|
||||
procedure VpPrintFormatChanged;
|
||||
{$ELSE}
|
||||
procedure VpPrintFormatChanged(var Msg: TMessage); message Vp_PrintFormatChanged;
|
||||
{$ENDIF}
|
||||
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
@@ -167,7 +172,7 @@ end;
|
||||
destructor TVpPrintFormatComboBox.Destroy;
|
||||
begin
|
||||
if HandleAllocated and Assigned(FControlLink) then
|
||||
FControlLink.Printer.DeregisterWatcher(Handle);
|
||||
FControlLink.Printer.DeregisterWatcher({$IFDEF LCL}Self{$ELSE}Handle{$ENDIF});
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
@@ -214,7 +219,7 @@ begin
|
||||
{ Check for new TVpControlLink }
|
||||
if AComponent is TVpControlLink then begin
|
||||
if not Assigned (FControlLink) then begin
|
||||
FControlLink := TVpControlLink (AComponent);
|
||||
FControlLink := TVpControlLink(AComponent);
|
||||
UpdateItems;
|
||||
end;
|
||||
end;
|
||||
@@ -231,17 +236,21 @@ procedure TVpPrintFormatComboBox.SetControlLink (const v : TVpControlLink);
|
||||
begin
|
||||
if v <> FControlLink then begin
|
||||
if Assigned (FControlLink) then
|
||||
FControlLink.Printer.DeregisterWatcher (Handle);
|
||||
FControlLink.Printer.DeregisterWatcher({$IFDEF LCL}Self{$ELSE}Handle{$ENDIF});
|
||||
FControlLink := v;
|
||||
if Assigned (FControlLink) then
|
||||
FControlLink.Printer.RegisterWatcher (Handle);
|
||||
FControlLink.Printer.RegisterWatcher({$IFDEF LCL}Self{$ELSE}Handle{$ENDIF});
|
||||
UpdateItems;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVpPrintFormatComboBox.VpPrintFormatChanged(var Msg: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF});
|
||||
procedure TVpPrintFormatComboBox.VpDatastoreChanged;
|
||||
begin
|
||||
//
|
||||
end;
|
||||
|
||||
procedure TVpPrintFormatComboBox.VpPrintFormatChanged({$IFNDEF LCL}var Msg: TMessage{$ENDIF});
|
||||
begin
|
||||
Unused(Msg);
|
||||
UpdateItems;
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user