mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 11:56:45 +02:00
Fixes compilation of TTrayIcon example
git-svn-id: trunk@15369 -
This commit is contained in:
parent
bc0e2703a9
commit
ac9c5de1ef
@ -1,7 +1,7 @@
|
||||
object frmTrayTest: TfrmTrayTest
|
||||
Left = 290
|
||||
Left = 183
|
||||
Height = 249
|
||||
Top = 175
|
||||
Top = 176
|
||||
Width = 393
|
||||
HorzScrollBar.Page = 392
|
||||
VertScrollBar.Page = 248
|
||||
@ -54,9 +54,9 @@ object frmTrayTest: TfrmTrayTest
|
||||
end
|
||||
object chkOnPaintDrawing: TCheckBox
|
||||
Left = 32
|
||||
Height = 18
|
||||
Height = 19
|
||||
Top = 152
|
||||
Width = 335
|
||||
Width = 261
|
||||
Caption = 'Test drawing the icon in the Form''s OnPaint event'
|
||||
OnChange = chkOnPaintDrawingChange
|
||||
TabOrder = 4
|
||||
|
@ -1,49 +1,27 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TfrmTrayTest','FORMDATA',[
|
||||
'TPF0'#12'TfrmTrayTest'#11'frmTrayTest'#4'Left'#3'"'#1#6'Height'#3#249#0#3'To'
|
||||
+'p'#3#175#0#5'Width'#3#137#1#18'HorzScrollBar.Page'#3#136#1#18'VertScrollBar'
|
||||
+'.Page'#3#248#0#13'ActiveControl'#7#7'btnShow'#7'Caption'#6#26'TTrayIcon tes'
|
||||
+'t application'#12'ClientHeight'#3#249#0#11'ClientWidth'#3#137#1#8'OnCreate'
|
||||
+#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#7'OnPaint'#7#9'FormPaint'#10
|
||||
+'LCLVersion'#6#6'0.9.25'#0#7'TButton'#7'btnShow'#4'Left'#2' '#6'Height'#2'!'
|
||||
+#3'Top'#2' '#5'Width'#3#136#0#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6
|
||||
+#4'Show'#7'OnClick'#7#12'btnShowClick'#8'TabOrder'#2#0#0#0#7'TButton'#7'btnH'
|
||||
+'ide'#4'Left'#2' '#6'Height'#2'!'#3'Top'#2'X'#5'Width'#3#136#0#25'BorderSpac'
|
||||
+'ing.InnerBorder'#2#4#7'Caption'#6#4'Hide'#7'OnClick'#7#12'btnHideClick'#8'T'
|
||||
+'abOrder'#2#1#0#0#7'TButton'#12'btnPaintTest'#4'Left'#3#216#0#6'Height'#2'!'
|
||||
+#3'Top'#2' '#5'Width'#3#136#0#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6
|
||||
+#14'Raw Paint Test'#7'OnClick'#7#17'btnPaintTestClick'#8'TabOrder'#2#2#0#0#7
|
||||
+'TButton'#17'btnDisplayMessage'#4'Left'#3#216#0#6'Height'#2'!'#3'Top'#2'X'#5
|
||||
+'Width'#3#136#0#7'Caption'#6#15'Display Message'#7'OnClick'#7#11'HandleClick'
|
||||
+#8'TabOrder'#2#3#0#0#9'TCheckBox'#17'chkOnPaintDrawing'#4'Left'#2' '#6'Heigh'
|
||||
+'t'#2#18#3'Top'#3#152#0#5'Width'#3'O'#1#7'Caption'#6'1Test drawing the icon '
|
||||
+'in the Form''s OnPaint event'#8'OnChange'#7#23'chkOnPaintDrawingChange'#8'T'
|
||||
+'abOrder'#2#4#0#0#10'TPopupMenu'#9'PopupMenu'#4'left'#3#136#0#3'top'#3#184#0
|
||||
+#0#9'TMenuItem'#9'MenuItem1'#7'Caption'#6#9'New Item1'#0#0#9'TMenuItem'#9'Me'
|
||||
+'nuItem3'#7'Caption'#6#9'New Item3'#0#0#9'TMenuItem'#9'MenuItem2'#7'Caption'
|
||||
+#6#9'New Item2'#0#0#0#9'TTrayIcon'#11'SystrayIcon'#4'left'#3#181#0#3'top'#3
|
||||
+#184#0#0#0#0#12'TfrmTrayTest'#11'frmTrayTest'#4'Left'#3'"'#1#6'Height'#3#249
|
||||
+#0#3'Top'#3#175#0#5'Width'#3#137#1#18'HorzScrollBar.Page'#3#136#1#18'VertScr'
|
||||
+'ollBar.Page'#3#248#0#13'ActiveControl'#7#7'btnShow'#7'Caption'#6#26'TTrayIc'
|
||||
+'on test application'#12'ClientHeight'#3#249#0#11'ClientWidth'#3#137#1#8'OnC'
|
||||
+'reate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#7'OnPaint'#7#9'FormP'
|
||||
+'aint'#10'LCLVersion'#6#6'0.9.25'#0#7'TButton'#7'btnShow'#4'Left'#2' '#6'Hei'
|
||||
+'ght'#2'!'#3'Top'#2' '#5'Width'#3#136#0#25'BorderSpacing.InnerBorder'#2#4#7
|
||||
+'Caption'#6#4'Show'#7'OnClick'#7#12'btnShowClick'#8'TabOrder'#2#0#0#0#7'TBut'
|
||||
+'ton'#7'btnHide'#4'Left'#2' '#6'Height'#2'!'#3'Top'#2'X'#5'Width'#3#136#0#25
|
||||
+'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#4'Hide'#7'OnClick'#7#12'btnHide'
|
||||
+'Click'#8'TabOrder'#2#1#0#0#7'TButton'#12'btnPaintTest'#4'Left'#3#216#0#6'He'
|
||||
+'ight'#2'!'#3'Top'#2' '#5'Width'#3#136#0#25'BorderSpacing.InnerBorder'#2#4#7
|
||||
+'Caption'#6#14'Raw Paint Test'#7'OnClick'#7#17'btnPaintTestClick'#8'TabOrder'
|
||||
+#2#2#0#0#7'TButton'#17'btnDisplayMessage'#4'Left'#3#216#0#6'Height'#2'!'#3'T'
|
||||
+'op'#2'X'#5'Width'#3#136#0#7'Caption'#6#15'Display Message'#7'OnClick'#7#11
|
||||
+'HandleClick'#8'TabOrder'#2#3#0#0#9'TCheckBox'#17'chkOnPaintDrawing'#4'Left'
|
||||
+#2' '#6'Height'#2#18#3'Top'#3#152#0#5'Width'#3'O'#1#7'Caption'#6'1Test drawi'
|
||||
+'ng the icon in the Form''s OnPaint event'#8'OnChange'#7#23'chkOnPaintDrawin'
|
||||
+'gChange'#8'TabOrder'#2#4#0#0#10'TPopupMenu'#9'PopupMenu'#4'left'#3#136#0#3
|
||||
+'top'#3#184#0#0#9'TMenuItem'#9'MenuItem1'#7'Caption'#6#9'New Item1'#0#0#9'TM'
|
||||
+'enuItem'#9'MenuItem3'#7'Caption'#6#9'New Item3'#0#0#9'TMenuItem'#9'MenuItem'
|
||||
+'2'#7'Caption'#6#9'New Item2'#0#0#0#9'TTrayIcon'#11'SystrayIcon'#4'left'#3
|
||||
+#181#0#3'top'#3#184#0#0#0#0
|
||||
]);
|
||||
|
||||
LazarusResources.Add('TfrmTrayTest','FORMDATA',[
|
||||
'TPF0'#12'TfrmTrayTest'#11'frmTrayTest'#4'Left'#3#183#0#6'Height'#3#249#0#3'T'
|
||||
+'op'#3#176#0#5'Width'#3#137#1#18'HorzScrollBar.Page'#3#136#1#18'VertScrollBa'
|
||||
+'r.Page'#3#248#0#13'ActiveControl'#7#7'btnShow'#7'Caption'#6#26'TTrayIcon te'
|
||||
+'st application'#12'ClientHeight'#3#249#0#11'ClientWidth'#3#137#1#8'OnCreate'
|
||||
+#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#7'OnPaint'#7#9'FormPaint'#10
|
||||
+'LCLVersion'#6#6'0.9.25'#0#7'TButton'#7'btnShow'#4'Left'#2' '#6'Height'#2'!'
|
||||
+#3'Top'#2' '#5'Width'#3#136#0#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6
|
||||
+#4'Show'#7'OnClick'#7#12'btnShowClick'#8'TabOrder'#2#0#0#0#7'TButton'#7'btnH'
|
||||
+'ide'#4'Left'#2' '#6'Height'#2'!'#3'Top'#2'X'#5'Width'#3#136#0#25'BorderSpac'
|
||||
+'ing.InnerBorder'#2#4#7'Caption'#6#4'Hide'#7'OnClick'#7#12'btnHideClick'#8'T'
|
||||
+'abOrder'#2#1#0#0#7'TButton'#12'btnPaintTest'#4'Left'#3#216#0#6'Height'#2'!'
|
||||
+#3'Top'#2' '#5'Width'#3#136#0#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6
|
||||
+#14'Raw Paint Test'#7'OnClick'#7#17'btnPaintTestClick'#8'TabOrder'#2#2#0#0#7
|
||||
+'TButton'#17'btnDisplayMessage'#4'Left'#3#216#0#6'Height'#2'!'#3'Top'#2'X'#5
|
||||
+'Width'#3#136#0#7'Caption'#6#15'Display Message'#7'OnClick'#7#11'HandleClick'
|
||||
+#8'TabOrder'#2#3#0#0#9'TCheckBox'#17'chkOnPaintDrawing'#4'Left'#2' '#6'Heigh'
|
||||
+'t'#2#19#3'Top'#3#152#0#5'Width'#3#5#1#7'Caption'#6'1Test drawing the icon i'
|
||||
+'n the Form''s OnPaint event'#8'OnChange'#7#23'chkOnPaintDrawingChange'#8'Ta'
|
||||
+'bOrder'#2#4#0#0#10'TPopupMenu'#9'PopupMenu'#4'left'#3#136#0#3'top'#3#184#0#0
|
||||
+#9'TMenuItem'#9'MenuItem1'#7'Caption'#6#9'New Item1'#0#0#9'TMenuItem'#9'Menu'
|
||||
+'Item3'#7'Caption'#6#9'New Item3'#0#0#9'TMenuItem'#9'MenuItem2'#7'Caption'#6
|
||||
+#9'New Item2'#0#0#0#9'TTrayIcon'#11'SystrayIcon'#4'left'#3#181#0#3'top'#3#184
|
||||
+#0#0#0#0
|
||||
]);
|
||||
|
@ -1,199 +1,199 @@
|
||||
{
|
||||
frmtest.dpr
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This demonstration program is public domain, which means no copyright, *
|
||||
* but also no warranty! *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Author: Felipe Monteiro de Carvalho
|
||||
}
|
||||
unit frmtest;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
{$ifdef fpc}
|
||||
LResources,
|
||||
{$endif}
|
||||
Forms, Controls, Graphics, Dialogs, Buttons, StdCtrls, Menus,
|
||||
ExtCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TfrmTrayTest }
|
||||
|
||||
TfrmTrayTest = class(TForm)
|
||||
btnShow: TButton;
|
||||
btnHide: TButton;
|
||||
btnPaintTest: TButton;
|
||||
btnDisplayMessage: TButton;
|
||||
chkOnPaintDrawing: TCheckBox;
|
||||
MenuItem1: TMenuItem;
|
||||
MenuItem2: TMenuItem;
|
||||
MenuItem3: TMenuItem;
|
||||
PopupMenu: TPopupMenu;
|
||||
SystrayIcon: TTrayIcon;
|
||||
procedure btnShowClick(Sender: TObject);
|
||||
procedure btnHideClick(Sender: TObject);
|
||||
procedure btnPaintTestClick(Sender: TObject);
|
||||
procedure chkOnPaintDrawingChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormPaint(Sender: TObject);
|
||||
procedure HandleClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
pathMedia: string;
|
||||
MyImage: TIcon;
|
||||
procedure DoPaint(Sender: TObject);
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmTrayTest: TfrmTrayTest;
|
||||
|
||||
{$ifndef fpc}
|
||||
{$R frmtest.dfm}
|
||||
{$endif}
|
||||
|
||||
implementation
|
||||
|
||||
{$ifdef Windows}
|
||||
uses Windows;
|
||||
{$endif}
|
||||
{$IFDEF Darwin}
|
||||
uses
|
||||
{$ifdef ver2_2_0}
|
||||
FPCMacOSAll;
|
||||
{$else}
|
||||
MacOSAll;
|
||||
{$endif}
|
||||
{$ENDIF}
|
||||
|
||||
{ TfrmTrayTest }
|
||||
|
||||
procedure TfrmTrayTest.btnShowClick(Sender: TObject);
|
||||
begin
|
||||
SystrayIcon.Visible := True;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.btnHideClick(Sender: TObject);
|
||||
begin
|
||||
SystrayIcon.Visible := False;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.btnPaintTestClick(Sender: TObject);
|
||||
var
|
||||
SecondImage: TIcon;
|
||||
begin
|
||||
SecondImage := TIcon.Create;
|
||||
|
||||
try
|
||||
SecondImage.Height := 22;
|
||||
SecondImage.Width := 22;
|
||||
{$IFDEF FPC}
|
||||
SecondImage.Canvas.Draw(0, 0, MyImage);
|
||||
{$ENDIF}
|
||||
Canvas.Draw(0, 0, SecondImage);
|
||||
finally
|
||||
SecondImage.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.chkOnPaintDrawingChange(Sender: TObject);
|
||||
begin
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.FormCreate(Sender: TObject);
|
||||
const
|
||||
IDI_ICON1 = 101;
|
||||
IDI_ICON2 = 115;
|
||||
BundleResourceFolder = '/Contents/Resources/';
|
||||
var
|
||||
{$IFDEF Darwin}
|
||||
pathRef: CFURLRef;
|
||||
pathCFStr: CFStringRef;
|
||||
pathStr: shortstring;
|
||||
{$ENDIF}
|
||||
begin
|
||||
pathMedia := '';
|
||||
|
||||
// Under Mac OS X we need to get the location of the bundle
|
||||
{$IFDEF Darwin}
|
||||
pathRef := CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
pathCFStr := CFURLCopyFileSystemPath(pathRef, kCFURLPOSIXPathStyle);
|
||||
CFStringGetPascalString(pathCFStr, @pathStr, 255, CFStringGetSystemEncoding());
|
||||
CFRelease(pathRef);
|
||||
CFRelease(pathCFStr);
|
||||
|
||||
pathMedia := pathStr + BundleResourceFolder;
|
||||
{$ENDIF}
|
||||
|
||||
{$ifdef Windows}
|
||||
SystrayIcon.Icon.Handle := LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
|
||||
|
||||
// Loading from a file should also work
|
||||
// SystrayIcon.Icon.LoadFromFile('icon.ico');
|
||||
{$else}
|
||||
SystrayIcon.Icon.LoadFromFile(pathMedia + 'icon.ico');
|
||||
{$endif}
|
||||
|
||||
SystrayIcon.Hint := 'my tool tip';
|
||||
|
||||
SystrayIcon.OnClick := HandleClick;
|
||||
|
||||
// SystrayIcon.OnPaint := DoPaint;
|
||||
|
||||
SystrayIcon.PopUpMenu := PopupMenu;
|
||||
|
||||
// Loads the icon
|
||||
|
||||
MyImage := TIcon.Create;
|
||||
|
||||
MyImage.LoadFromFile(pathMedia + 'icon.ico');
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
MyImage.Free;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.FormPaint(Sender: TObject);
|
||||
begin
|
||||
if chkOnPaintDrawing.Checked then btnPaintTestClick(Sender);
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.HandleClick(Sender: TObject);
|
||||
begin
|
||||
Application.MessageBox('Text', 'Caption', 0);
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.DoPaint(Sender: TObject);
|
||||
begin
|
||||
{$IFDEF FPC}
|
||||
SystrayIcon.Canvas.Draw(0, 0, MyImage);
|
||||
{$ENDIF}
|
||||
WriteLn('Paint');
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$ifdef fpc}
|
||||
{$I frmtest.lrs}
|
||||
{$endif}
|
||||
|
||||
end.
|
||||
|
||||
{
|
||||
frmtest.dpr
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This demonstration program is public domain, which means no copyright, *
|
||||
* but also no warranty! *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Author: Felipe Monteiro de Carvalho
|
||||
}
|
||||
unit frmtest;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
{$ifdef fpc}
|
||||
LResources,
|
||||
{$endif}
|
||||
Forms, Controls, Graphics, Dialogs, Buttons, StdCtrls, Menus,
|
||||
ExtCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TfrmTrayTest }
|
||||
|
||||
TfrmTrayTest = class(TForm)
|
||||
btnShow: TButton;
|
||||
btnHide: TButton;
|
||||
btnPaintTest: TButton;
|
||||
btnDisplayMessage: TButton;
|
||||
chkOnPaintDrawing: TCheckBox;
|
||||
MenuItem1: TMenuItem;
|
||||
MenuItem2: TMenuItem;
|
||||
MenuItem3: TMenuItem;
|
||||
PopupMenu: TPopupMenu;
|
||||
SystrayIcon: TTrayIcon;
|
||||
procedure btnShowClick(Sender: TObject);
|
||||
procedure btnHideClick(Sender: TObject);
|
||||
procedure btnPaintTestClick(Sender: TObject);
|
||||
procedure chkOnPaintDrawingChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormPaint(Sender: TObject);
|
||||
procedure HandleClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
pathMedia: string;
|
||||
MyImage: TIcon;
|
||||
procedure DoPaint(Sender: TObject);
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmTrayTest: TfrmTrayTest;
|
||||
|
||||
{$ifndef fpc}
|
||||
{$R frmtest.dfm}
|
||||
{$endif}
|
||||
|
||||
implementation
|
||||
|
||||
{$ifdef Windows}
|
||||
uses Windows;
|
||||
{$endif}
|
||||
{$IFDEF Darwin}
|
||||
uses
|
||||
{$ifdef ver2_2_0}
|
||||
FPCMacOSAll;
|
||||
{$else}
|
||||
MacOSAll;
|
||||
{$endif}
|
||||
{$ENDIF}
|
||||
|
||||
{ TfrmTrayTest }
|
||||
|
||||
procedure TfrmTrayTest.btnShowClick(Sender: TObject);
|
||||
begin
|
||||
SystrayIcon.Visible := True;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.btnHideClick(Sender: TObject);
|
||||
begin
|
||||
SystrayIcon.Visible := False;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.btnPaintTestClick(Sender: TObject);
|
||||
var
|
||||
SecondImage: TIcon;
|
||||
begin
|
||||
SecondImage := TIcon.Create;
|
||||
|
||||
try
|
||||
SecondImage.Height := 22;
|
||||
SecondImage.Width := 22;
|
||||
{$IFDEF FPC}
|
||||
SecondImage.Canvas.Draw(0, 0, MyImage);
|
||||
{$ENDIF}
|
||||
Canvas.Draw(0, 0, SecondImage);
|
||||
finally
|
||||
SecondImage.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.chkOnPaintDrawingChange(Sender: TObject);
|
||||
begin
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.FormCreate(Sender: TObject);
|
||||
const
|
||||
IDI_ICON1 = 101;
|
||||
IDI_ICON2 = 115;
|
||||
BundleResourceFolder = '/Contents/Resources/';
|
||||
{$IFDEF Darwin}
|
||||
var
|
||||
pathRef: CFURLRef;
|
||||
pathCFStr: CFStringRef;
|
||||
pathStr: shortstring;
|
||||
{$ENDIF}
|
||||
begin
|
||||
pathMedia := '';
|
||||
|
||||
// Under Mac OS X we need to get the location of the bundle
|
||||
{$IFDEF Darwin}
|
||||
pathRef := CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
pathCFStr := CFURLCopyFileSystemPath(pathRef, kCFURLPOSIXPathStyle);
|
||||
CFStringGetPascalString(pathCFStr, @pathStr, 255, CFStringGetSystemEncoding());
|
||||
CFRelease(pathRef);
|
||||
CFRelease(pathCFStr);
|
||||
|
||||
pathMedia := pathStr + BundleResourceFolder;
|
||||
{$ENDIF}
|
||||
|
||||
{$ifdef Windows}
|
||||
SystrayIcon.Icon.Handle := LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
|
||||
|
||||
// Loading from a file should also work
|
||||
// SystrayIcon.Icon.LoadFromFile('icon.ico');
|
||||
{$else}
|
||||
SystrayIcon.Icon.LoadFromFile(pathMedia + 'icon.ico');
|
||||
{$endif}
|
||||
|
||||
SystrayIcon.Hint := 'my tool tip';
|
||||
|
||||
SystrayIcon.OnClick := HandleClick;
|
||||
|
||||
// SystrayIcon.OnPaint := DoPaint;
|
||||
|
||||
SystrayIcon.PopUpMenu := PopupMenu;
|
||||
|
||||
// Loads the icon
|
||||
|
||||
MyImage := TIcon.Create;
|
||||
|
||||
MyImage.LoadFromFile(pathMedia + 'icon.ico');
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
MyImage.Free;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.FormPaint(Sender: TObject);
|
||||
begin
|
||||
if chkOnPaintDrawing.Checked then btnPaintTestClick(Sender);
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.HandleClick(Sender: TObject);
|
||||
begin
|
||||
Application.MessageBox('Text', 'Caption', 0);
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.DoPaint(Sender: TObject);
|
||||
begin
|
||||
{$IFDEF FPC}
|
||||
SystrayIcon.Canvas.Draw(0, 0, MyImage);
|
||||
{$ENDIF}
|
||||
WriteLn('Paint');
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$ifdef fpc}
|
||||
{$I frmtest.lrs}
|
||||
{$endif}
|
||||
|
||||
end.
|
||||
|
||||
|
@ -1,66 +1,67 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="/"/>
|
||||
<Version Value="6"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<SaveClosedFiles Value="False"/>
|
||||
<SaveOnlyProjectUnits Value="True"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=""/>
|
||||
</General>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="wndtray.dpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="wndtray"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="frmtest.pas"/>
|
||||
<ComponentName Value="frmTrayTest"/>
|
||||
<HasResources Value="True"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<ResourceFilename Value="frmtest.lrs"/>
|
||||
<UnitName Value="frmtest"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<SearchPaths>
|
||||
<SrcPath Value="/Users/felipe/Programas/lazarus-ccr/bindings/objc/;/Users/felipe/Programas/lazarus-ccr/bindings/pascocoa/applicationservices/coregraphics/;/Users/felipe/Programas/lazarus-ccr/bindings/pascocoa/appkit/;/Users/felipe/Programas/lazarus-ccr/bindings/pascocoa/foundation/"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Options>
|
||||
<LinkerOptions Value="-framework Qt4Intf -framework carbon -lobjc"/>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="6"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<SaveClosedFiles Value="False"/>
|
||||
<SaveOnlyProjectUnits Value="True"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value=".\"/>
|
||||
<TargetFileExt Value=""/>
|
||||
</General>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="wndtray.dpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="wndtray"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="frmtest.pas"/>
|
||||
<ComponentName Value="frmTrayTest"/>
|
||||
<HasResources Value="True"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ResourceFilename Value="frmtest.lrs"/>
|
||||
<UnitName Value="frmtest"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<SrcPath Value="\Users\felipe\Programas\lazarus-ccr\bindings\objc\;\Users\felipe\Programas\lazarus-ccr\bindings\pascocoa\applicationservices\coregraphics\;\Users\felipe\Programas\lazarus-ccr\bindings\pascocoa\appkit\;\Users\felipe\Programas\lazarus-ccr\bindings\pascocoa\foundation\"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Options>
|
||||
<LinkerOptions Value="-framework Qt4Intf -framework carbon -lobjc"/>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
||||
|
Loading…
Reference in New Issue
Block a user