examples: fixed compilation, removed writeln

git-svn-id: trunk@38134 -
This commit is contained in:
mattias 2012-08-03 23:03:00 +00:00
parent ef38ed2d21
commit a6a9b39dab
21 changed files with 143 additions and 146 deletions

View File

@ -16,7 +16,6 @@
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
<IgnoreBinaries Value="False"/> <IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
@ -40,11 +39,11 @@
<IsVisibleTab Value="True"/> <IsVisibleTab Value="True"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="226"/> <TopLine Value="102"/>
<CursorPos X="20" Y="243"/> <CursorPos X="10" Y="123"/>
<UsageCount Value="20"/> <UsageCount Value="20"/>
<Bookmarks Count="1"> <Bookmarks Count="1">
<Item0 X="4" Y="245" ID="1"/> <Item0 X="4" Y="242" ID="1"/>
</Bookmarks> </Bookmarks>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
@ -52,7 +51,7 @@
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="9"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Parsing> <Parsing>
<SyntaxOptions> <SyntaxOptions>
@ -70,4 +69,5 @@
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<EditorMacros Count="0"/>
</CONFIG> </CONFIG>

View File

@ -32,11 +32,10 @@
program CheckBox; program CheckBox;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
// program uses WriteLn
uses uses
Interfaces, Classes, Stdctrls, Forms, Buttons, Menus, Comctrls, Interfaces, Classes, Stdctrls, Forms, Buttons, Menus, Comctrls,
SysUtils, ExtCtrls, GraphType, Graphics, Controls; SysUtils, ExtCtrls, GraphType, Graphics, Controls, LazLogger;
type type
TForm1 = class(TFORM) TForm1 = class(TFORM)
@ -121,13 +120,12 @@ End;
procedure TForm1.CheckBoxClick(Sender : TObject); procedure TForm1.CheckBoxClick(Sender : TObject);
Begin Begin
WriteLn('[TForm1.CheckBoxClick]'); DebugLn('[TForm1.CheckBoxClick]');
if assigned (CheckBox1) and assigned (label1) then begin if assigned (CheckBox1) and assigned (label1) then begin
Writeln (' [checkbox and label assigned]'); Writeln (' [checkbox and label assigned]');
if CheckBox1.Checked if CheckBox1.Checked
then label1.Caption := 'checked' then label1.Caption := 'checked'
else label1.Caption := 'unchecked'; else label1.Caption := 'unchecked';
// ***SIGSEGV!!!!!!!!! label1.Repaint;
if CheckBox1.Checked if CheckBox1.Checked
then CheckBox1.Caption := 'new caption' then CheckBox1.Caption := 'new caption'
else CheckBox1.Caption := 'Checkbox 1'; else CheckBox1.Caption := 'Checkbox 1';
@ -136,25 +134,24 @@ End;
procedure TForm1.RadioButtonClick(Sender : TObject); procedure TForm1.RadioButtonClick(Sender : TObject);
begin begin
WriteLn('[TForm1.RadioButtonClick]'); debugln('[TForm1.RadioButtonClick]');
if assigned (label2) if assigned (label2)
then label2.Caption := 'active: ' + TRadioButton (Sender).Caption then label2.Caption := 'active: ' + TRadioButton (Sender).Caption
end; end;
procedure TForm1.RadioGroupClick(Sender : TObject); procedure TForm1.RadioGroupClick(Sender : TObject);
begin begin
WriteLn('[TForm1.RadioGroupClick]'); debugln('[TForm1.RadioGroupClick]');
end; end;
procedure TForm1.ToggleBoxClick(Sender : TObject); procedure TForm1.ToggleBoxClick(Sender : TObject);
begin begin
WriteLn('[TForm1.ToggleBoxClick]'); debugln('[TForm1.ToggleBoxClick]');
if assigned (ToggleBox) then if assigned (ToggleBox) then
begin begin
if ToggleBox.checked if ToggleBox.checked
then ToggleBox.Caption := 'Togglebox1' then ToggleBox.Caption := 'Togglebox1'
else ToggleBox.Caption := 'does nothing:-('; else ToggleBox.Caption := 'does nothing:-(';
// ***SIGSEGV!!!!!!!!! ToggleBox.RePaint;
end; end;
end; end;

View File

@ -292,7 +292,6 @@ end;
procedure TMyWidget.InvalidateRect(ARect: TRect; Erase: boolean); procedure TMyWidget.InvalidateRect(ARect: TRect; Erase: boolean);
begin begin
//writeln('TMyWidget.InvalidateRect ',Name,' ',ARect.Left,',',ARect.Top);
ARect.Left:=Max(0,ARect.Left); ARect.Left:=Max(0,ARect.Left);
ARect.Top:=Max(0,ARect.Top); ARect.Top:=Max(0,ARect.Top);
ARect.Right:=Min(Width,ARect.Right); ARect.Right:=Min(Width,ARect.Right);

View File

@ -1,19 +1,20 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<PathDelim Value="/"/> <Version Value="9"/>
<Version Value="6"/>
<General> <General>
<Flags> <Flags>
<SaveClosedFiles Value="False"/> <SaveClosedFiles Value="False"/>
<SaveOnlyProjectUnits Value="True"/> <SaveOnlyProjectUnits Value="True"/>
<LRSInOutputDirectory Value="False"/>
</Flags> </Flags>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=".exe"/>
<Title Value="project1"/> <Title Value="project1"/>
<ActiveEditorIndexAtStart Value="0"/> <ActiveWindowIndexAtStart Value="0"/>
</General> </General>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<DestinationDirectory Value="$(ProjPath)/published"/> <DestinationDirectory Value="$(ProjPath)/published"/>
@ -37,29 +38,34 @@
<Filename Value="fontenumeration.lpr"/> <Filename Value="fontenumeration.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="fontenumeration"/> <UnitName Value="fontenumeration"/>
<CursorPos X="44" Y="15"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="44" Y="15"/>
<UsageCount Value="158"/> <UsageCount Value="158"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="mainunit.pas"/> <Filename Value="mainunit.pas"/>
<ComponentName Value="frmMain"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ResourceFilename Value="mainunit.lrs"/> <ComponentName Value="frmMain"/>
<UnitName Value="mainunit"/> <UnitName Value="mainunit"/>
<CursorPos X="11" Y="10"/>
<TopLine Value="1"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="47" Y="9"/>
<UsageCount Value="158"/> <UsageCount Value="158"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit1> </Unit1>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="11"/>
<SearchPaths> <SearchPaths>
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/> <SrcPath Value="$(LazarusDir)/lcl;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)"/>
</SearchPaths> </SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Other> <Other>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
@ -74,4 +80,5 @@
</Item2> </Item2>
</Exceptions> </Exceptions>
</Debugging> </Debugging>
<EditorMacros Count="0"/>
</CONFIG> </CONFIG>

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
LCLType, LCLIntf, StdCtrls, Buttons, LCLProc, ComCtrls, ExtCtrls, Grids, LCLType, LCLIntf, StdCtrls, Buttons, LCLProc, ExtCtrls, Grids,
FileUtil, IniFiles; FileUtil, IniFiles;
type type
@ -399,7 +399,7 @@ begin
i := Sender.Items.IndexOf(s); i := Sender.Items.IndexOf(s);
if i>-1 then begin if i>-1 then begin
{$ifdef debug} {$ifdef debug}
WriteLn('RestoreSelection: listbox=',Sender.Name,' Old=',GetSelection,' New=',S); debugln('RestoreSelection: listbox=',Sender.Name,' Old=',GetSelection,' New=',S);
{$endif} {$endif}
if i<>Sender.ItemIndex then if i<>Sender.ItemIndex then
Sender.ItemIndex := i; Sender.ItemIndex := i;
@ -428,7 +428,7 @@ begin
lf.lfPitchAndFamily := i; lf.lfPitchAndFamily := i;
{$ifdef debug} {$ifdef debug}
WriteLn('LoadFontList: for charset=',CharSetToString(lf.lfcharset)); debugln('LoadFontList: for charset=',CharSetToString(lf.lfcharset));
{$endif} {$endif}
L := TStringList.create; L := TStringList.create;
@ -492,9 +492,9 @@ begin
{$ifdef debug} {$ifdef debug}
Write('LoadFamilyFonts: for family=', lbFamily.Items[i],' and Charset='); Write('LoadFamilyFonts: for family=', lbFamily.Items[i],' and Charset=');
if LoadingCharsets then if LoadingCharsets then
WriteLn('ALL_CHARSETS') debugln('ALL_CHARSETS')
else else
WriteLn(CharsetToString(byte(Charset))); debugln(CharsetToString(byte(Charset)));
{$endif} {$endif}
// at the moment only global fonts are enumerated // at the moment only global fonts are enumerated

View File

@ -112,9 +112,7 @@ end;
procedure TForm2.showURL(URL : String); procedure TForm2.showURL(URL : String);
begin begin
Show; Show;
//writeln ('ShowUrl ',ansiuppercase(URL));
URL := expandLocalHtmlFileName (URL); URL := expandLocalHtmlFileName (URL);
//writeln ('showURL: "',URL,'"');
IHP.OpenURL(URL); IHP.OpenURL(URL);
end; end;

View File

@ -1,20 +1,21 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="5"/>
<General> <General>
<Flags> <Flags>
<SaveOnlyProjectUnits Value="True"/> <SaveOnlyProjectUnits Value="True"/>
<LRSInOutputDirectory Value="False"/>
</Flags> </Flags>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<IconPath Value="./"/> <ActiveWindowIndexAtStart Value="0"/>
<TargetFileExt Value=""/>
<ActiveEditorIndexAtStart Value="0"/>
</General> </General>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
<IgnoreBinaries Value="False"/> <IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
@ -35,20 +36,25 @@
<Filename Value="listboxtest.pp"/> <Filename Value="listboxtest.pp"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="ListBoxTest"/> <UnitName Value="ListBoxTest"/>
<CursorPos X="1" Y="32"/> <IsVisibleTab Value="True"/>
<TopLine Value="1"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="113"/>
<CursorPos X="47" Y="143"/>
<UsageCount Value="20"/> <UsageCount Value="20"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit0> </Unit0>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="5"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<CodeGeneration> <Parsing>
<Generate Value="Faster"/> <SyntaxOptions>
</CodeGeneration> <UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Linking> <Linking>
<Options> <Options>
<Win32> <Win32>
@ -60,4 +66,5 @@
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<EditorMacros Count="0"/>
</CONFIG> </CONFIG>

View File

@ -23,7 +23,7 @@ program ListBoxTest;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
uses uses
Interfaces, Buttons, Classes, Forms, StdCtrls, SysUtils, Controls; Interfaces, Buttons, Classes, Forms, StdCtrls, SysUtils, Controls, LazLogger;
type type
TListBoxTestForm = class(TForm) TListBoxTestForm = class(TForm)
@ -140,7 +140,7 @@ var
X: PtrInt; X: PtrInt;
begin begin
X := PtrInt(ListBox.Items.Objects[ListBox.ItemIndex]); X := PtrInt(ListBox.Items.Objects[ListBox.ItemIndex]);
writeln('TListBoxTestForm.Button4Click ',X); DebugLn(['TListBoxTestForm.Button4Click ',X]);
end; end;
procedure TListBoxTestForm.FormResize(Sender: TObject); procedure TListBoxTestForm.FormResize(Sender: TObject);

View File

@ -32,7 +32,7 @@ Program MessagDialogs;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
uses Interfaces, Classes, Forms, Dialogs, Buttons, StdCtrls; uses Interfaces, Classes, Forms, Dialogs, Buttons, StdCtrls, LazLogger;
type type
TMainForm = class(TForm) TMainForm = class(TForm)
@ -70,7 +70,7 @@ end;
procedure TMainForm.Button1Click(Sender : TObject); procedure TMainForm.Button1Click(Sender : TObject);
begin begin
ShowMessage ('First simple test!'); ShowMessage ('First simple test!');
writeln('Go to second dialog'); DebugLn('Go to second dialog');
MessageDlg ('Caption', 'Two buttons now ...', mtError, [mbOK,mbCancel], 0); MessageDlg ('Caption', 'Two buttons now ...', mtError, [mbOK,mbCancel], 0);
MessageDlg ('Warning, not fully implemented', mtWarning, [mbYes, mbNo, mbOK,mbCancel], 0); MessageDlg ('Warning, not fully implemented', mtWarning, [mbYes, mbNo, mbOK,mbCancel], 0);
ShowMessageFmt ('The show will end now'+LineEnding+'%s'+LineEnding+'Good bye!!!', [MainForm.Caption]); ShowMessageFmt ('The show will end now'+LineEnding+'%s'+LineEnding+'Good bye!!!', [MainForm.Caption]);

View File

@ -275,26 +275,21 @@ end;
procedure TForm1.Button1Click(Sender: TObject); procedure TForm1.Button1Click(Sender: TObject);
begin begin
//writeln('Button 1 Clicked');
fNotebk.PageIndex := 0; fNotebk.PageIndex := 0;
end; end;
procedure TForm1.Button2Click(Sender: TObject); procedure TForm1.Button2Click(Sender: TObject);
begin begin
//writeln('Button 2 Clicked');
fNotebk.PageIndex := fNotebk.Pages.Count - 1; fNotebk.PageIndex := fNotebk.Pages.Count - 1;
end; end;
procedure TForm1.Button3Click(Sender: TObject); procedure TForm1.Button3Click(Sender: TObject);
begin begin
//writeln('Close Button Clicked');
Close; Close;
end; end;
procedure TForm1.Button4Click(Sender: TObject); procedure TForm1.Button4Click(Sender: TObject);
begin begin
//writeln('Show/Hide Tabs Button Clicked');
fNotebook.ShowTabs := not fNotebook.ShowTabs; fNotebook.ShowTabs := not fNotebook.ShowTabs;
if (fNotebook.ShowTabs) then if (fNotebook.ShowTabs) then
fButton4.Caption := 'Hide Tabs' fButton4.Caption := 'Hide Tabs'
@ -304,8 +299,6 @@ end;
procedure TForm1.Button5Click(Sender: TObject); procedure TForm1.Button5Click(Sender: TObject);
begin begin
//writeln('Delete Page Button Clicked');
if (fNotebook.PageCount > 1) then if (fNotebook.PageCount > 1) then
begin begin
// Make sure we don't delete the page with the delete button on it // Make sure we don't delete the page with the delete button on it
@ -318,8 +311,6 @@ end;
procedure TForm1.Button6Click(Sender: TObject); procedure TForm1.Button6Click(Sender: TObject);
begin begin
//writeln('Set Tab Position Button Clicked');
if fNotebook.TabPosition = tpTop then if fNotebook.TabPosition = tpTop then
fNotebook.TabPosition := tpRight fNotebook.TabPosition := tpRight
else if fNotebook.TabPosition = tpRight then else if fNotebook.TabPosition = tpRight then

View File

@ -1,24 +1,24 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="7"/> <Version Value="9"/>
<General> <General>
<Flags> <Flags>
<MainUnitHasCreateFormStatements Value="False"/> <MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/> <MainUnitHasTitleStatement Value="False"/>
<UseDefaultCompilerOptions Value="True"/>
</Flags> </Flags>
<SessionStorage Value="InIDEConfig"/> <SessionStorage Value="InIDEConfig"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=""/>
<ResourceType Value="res"/> <ResourceType Value="res"/>
<Icon Value="0"/>
</General> </General>
<VersionInfo> <VersionInfo>
<Language Value=""/> <Language Value=""/>
<CharSet Value=""/> <CharSet Value=""/>
<StringTable Comments="" CompanyName="" FileDescription="" FileVersion="" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<IgnoreBinaries Value="False"/> <IgnoreBinaries Value="False"/>
@ -59,19 +59,14 @@
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="11"/>
<Target> <Target>
<Filename Value="PascalStream1"/> <Filename Value="PascalStream1"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/"/> <IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="True"/>
</SyntaxOptions>
</Parsing>
<Other> <Other>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>

View File

@ -261,21 +261,21 @@ var
i: Integer; i: Integer;
Item: TMyCollectionItem; Item: TMyCollectionItem;
begin begin
writeln('TMyComponent.WriteDebugReport '); debugln('TMyComponent.WriteDebugReport ');
writeln(' MyDouble=',FMyDouble); debugln([' MyDouble=',FMyDouble]);
writeln(' MySingle=',FMySingle); debugln([' MySingle=',FMySingle]);
writeln(' MyEnum=',GetEnumName(TypeInfo(TMyEnum),ord(FMyEnum))); debugln([' MyEnum=',GetEnumName(TypeInfo(TMyEnum),ord(FMyEnum))]);
writeln(' MySet=',HexStr(Cardinal(FMySet),8)); debugln([' MySet=',HexStr(Cardinal(FMySet),8)]);
writeln(' MyString=',FMyString); debugln([' MyString=',FMyString]);
writeln(' MyWideString=',FMyWideString); debugln([' MyWideString=',FMyWideString]);
writeln(' MyInteger=',FMyInteger); debugln([' MyInteger=',FMyInteger]);
writeln(' MyInt64=',FMyInt64); debugln([' MyInt64=',FMyInt64]);
writeln(' MyCollection.Count=',FMyCollection.Count); debugln([' MyCollection.Count=',FMyCollection.Count]);
for i:=0 to FMyCollection.Count-1 do begin for i:=0 to FMyCollection.Count-1 do begin
Item:=TMyCollectionItem(FMyCollection.Items[i]); Item:=TMyCollectionItem(FMyCollection.Items[i]);
writeln(' ',i,' MyString=',Item.MyString); debugln([' ',i,' MyString=',Item.MyString]);
end; end;
//writeln(' MyStrings='+dbgstr(MyStrings.Text)); //debugln([' MyStrings='+dbgstr(MyStrings.Text)]);
end; end;
procedure TMyComponent.GetChildren(Proc: TGetChildProc; Root: TComponent); procedure TMyComponent.GetChildren(Proc: TGetChildProc; Root: TComponent);

View File

@ -90,7 +90,6 @@ var
procedure LineSample(txt:string); procedure LineSample(txt:string);
begin begin
tmp := Pt2Pix(PsCanvas.Font.Size) div 2; tmp := Pt2Pix(PsCanvas.Font.Size) div 2;
//WriteLn('LineSample: Y=',Y,' FontSize=', PsCanvas.Font.Size,' Pix=',tmp*2,' Spc= ',tmp,' Sy=',Sy(Tmp));
PsCanvas.Line(x+Sx(170),y+tmp,x+Sx(170+100),y+tmp); PsCanvas.Line(x+Sx(170),y+tmp,x+Sx(170+100),y+tmp);
PsCanvas.TextOut(x,y,txt); PsCanvas.TextOut(x,y,txt);
inc(y,tmp*3); inc(y,tmp*3);

View File

@ -34,7 +34,7 @@ program Scrollbar;
uses uses
Interfaces, Classes, StdCtrls, Forms, Buttons, Menus, ComCtrls, Interfaces, Classes, StdCtrls, Forms, Buttons, Menus, ComCtrls,
SysUtils, ExtCtrls, Controls; SysUtils, ExtCtrls, Controls, LazLogger;
type type
TForm1 = class(TFORM) TForm1 = class(TFORM)
@ -130,8 +130,8 @@ End;
Procedure TForm1.Button1Clicked(sender : tobject); Procedure TForm1.Button1Clicked(sender : tobject);
Begin Begin
Writeln('[Button1cvlikced]'); debugln('[Button1Clicked]');
if ScrollBar1.Kind = sbHorizontal then if ScrollBar1.Kind = sbHorizontal then
Scrollbar1.Kind := sbVertical else Scrollbar1.Kind := sbVertical else
Scrollbar1.kind := sbHorizontal; Scrollbar1.kind := sbHorizontal;
@ -161,7 +161,7 @@ End;
Procedure TForm1.Scrollbar1OnScroll(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer); Procedure TForm1.Scrollbar1OnScroll(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer);
Begin Begin
Writeln('.............Scrolled...............'); DebugLn('.............Scrolled...............');
End; End;
begin begin

View File

@ -24,7 +24,7 @@ program SpeedTest;
uses uses
Interfaces, Forms, SysUtils, Buttons, Classes, StdCtrls, LCLType, Interfaces, Forms, SysUtils, Buttons, Classes, StdCtrls, LCLType,
LCLIntf, Graphics; LCLIntf, Graphics, LazLogger;
type type
TForm1 = class(TForm) TForm1 = class(TForm)
@ -165,12 +165,12 @@ var
begin begin
WriteLN('------ INIT ------- '); debugln('------ INIT ------- ');
Application.Initialize; { calls InitProcedure which starts up GTK } Application.Initialize; { calls InitProcedure which starts up GTK }
WriteLN('------ CREATE ------- '); debugln('------ CREATE ------- ');
Application.CreateForm(TForm1, Form1); Application.CreateForm(TForm1, Form1);
WriteLN('------ RUN ------- '); debugln('------ RUN ------- ');
Application.Run; Application.Run;
WriteLN('------ DONE ------- '); DebugLn('------ DONE ------- ');
end. end.

View File

@ -101,7 +101,6 @@ begin
// paint first on the buffer // paint first on the buffer
// paint background // paint background
//writeln('TPlayGroundForm.UpdateImage A');
BufferImg.Canvas.CopyRect(Rect(0,0,BufferImg.Width,BufferImg.Height), BufferImg.Canvas.CopyRect(Rect(0,0,BufferImg.Width,BufferImg.Height),
BackgroundImg.Canvas,Rect(0,0,BackgroundImg.Width,BackgroundImg.Height)); BackgroundImg.Canvas,Rect(0,0,BackgroundImg.Width,BackgroundImg.Height));
// paint sprite // paint sprite
@ -110,16 +109,13 @@ begin
t:=Now*86400; t:=Now*86400;
x:=CenterX+round(cos(t)*CenterX*2/3)-(SpriteImg.Width div 2); x:=CenterX+round(cos(t)*CenterX*2/3)-(SpriteImg.Width div 2);
y:=CenterY+round(sin(t*0.7)*CenterY*2/3)-(SpriteImg.Height div 2); y:=CenterY+round(sin(t*0.7)*CenterY*2/3)-(SpriteImg.Height div 2);
//writeln('TPlayGroundForm.UpdateImage B ',x,',',y,' ',t);
BufferImg.Canvas.Draw(x, y, SpriteImg); BufferImg.Canvas.Draw(x, y, SpriteImg);
//writeln('TPlayGroundForm.UpdateImage C');
// copy to image // copy to image
DestImg:=PictureControl.Picture.Bitmap; DestImg:=PictureControl.Picture.Bitmap;
DestImg.Width:=BufferImg.Width; DestImg.Width:=BufferImg.Width;
DestImg.Height:=BufferImg.Height; DestImg.Height:=BufferImg.Height;
DestImg.Canvas.Draw(0,0,BufferImg); DestImg.Canvas.Draw(0,0,BufferImg);
//writeln('TPlayGroundForm.UpdateImage D');
end; end;
{ TPictureControl } { TPictureControl }

View File

@ -35,7 +35,7 @@ program Toolbar;
uses uses
Interfaces, Classes, StdCtrls, Forms, Buttons, Menus, ComCtrls, Interfaces, Classes, StdCtrls, Forms, Buttons, Menus, ComCtrls,
SysUtils, ExtCtrls, Controls; SysUtils, ExtCtrls, Controls, LazLogger;
type type
TForm1 = class(TFORM) TForm1 = class(TFORM)
@ -127,23 +127,23 @@ end;
Procedure TFORM1.Button1Click(Sender : TObject); Procedure TFORM1.Button1Click(Sender : TObject);
Begin Begin
Writeln('******************'); debugln('******************');
Writeln('Toolbar button 1 clicked!'); debugln('Toolbar button 1 clicked!');
Writeln('******************'); debugln('******************');
end; end;
Procedure TFORM1.Button2Click(Sender : TObject); Procedure TFORM1.Button2Click(Sender : TObject);
Begin Begin
Writeln('******************'); debugln('******************');
Writeln('Toolbar button 2 clicked!'); debugln('Toolbar button 2 clicked!');
Writeln('******************'); debugln('******************');
end; end;
Procedure TFORM1.Button3Click(Sender : TObject); Procedure TFORM1.Button3Click(Sender : TObject);
Begin Begin
Writeln('******************'); DebugLn('******************');
Writeln('Toolbar button 3 clicked!'); debugln('Toolbar button 3 clicked!');
Writeln('******************'); debugln('******************');
end; end;

View File

@ -1,28 +1,18 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<PathDelim Value="/"/> <Version Value="9"/>
<Version Value="5"/>
<General> <General>
<Flags> <Flags>
<SaveOnlyProjectUnits Value="True"/> <SaveOnlyProjectUnits Value="True"/>
<LRSInOutputDirectory Value="False"/>
</Flags> </Flags>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=""/> <ActiveWindowIndexAtStart Value="0"/>
<ActiveEditorIndexAtStart Value="0"/>
</General> </General>
<Units Count="1"> <BuildModes Count="1">
<Unit0> <Item1 Name="default" Default="True"/>
<CursorPos X="24" Y="26"/> </BuildModes>
<EditorIndex Value="0"/>
<Filename Value="trackbar.pp"/>
<IsPartOfProject Value="True"/>
<Loaded Value="True"/>
<TopLine Value="1"/>
<UnitName Value="Trackbar"/>
<UsageCount Value="20"/>
</Unit0>
</Units>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<IgnoreBinaries Value="False"/> <IgnoreBinaries Value="False"/>
@ -40,15 +30,32 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item1> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="1">
<Unit0>
<Filename Value="trackbar.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Trackbar"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="92"/>
<CursorPos X="16" Y="113"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit0>
</Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="5"/> <Version Value="11"/>
<SearchPaths> <SearchPaths>
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/> <SrcPath Value="$(LazarusDir)/lcl;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <Parsing>
<Generate Value="Faster"/> <SyntaxOptions>
</CodeGeneration> <UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Linking> <Linking>
<Options> <Options>
<Win32> <Win32>
@ -60,4 +67,5 @@
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<EditorMacros Count="0"/>
</CONFIG> </CONFIG>

View File

@ -40,7 +40,7 @@ program Trackbar;
uses uses
Interfaces, Classes, Forms, Buttons, StdCtrls, Menus, ComCtrls, Interfaces, Classes, Forms, Buttons, StdCtrls, Menus, ComCtrls,
SysUtils, Controls; SysUtils, Controls, LazLogger;
type type
TForm1 = class(TFORM) TForm1 = class(TFORM)
@ -102,7 +102,7 @@ End;
procedure TForm1.Button3Click(Sender : TObject); procedure TForm1.Button3Click(Sender : TObject);
Begin Begin
if assigned (Track1) then begin if assigned (Track1) then begin
writeln ('Setting new position'); debugln ('Setting new position');
Track1.Position := Track1.Position + 1; Track1.Position := Track1.Position + 1;
end; end;
End; End;
@ -110,7 +110,7 @@ End;
procedure TForm1.Button4Click(Sender : TObject); procedure TForm1.Button4Click(Sender : TObject);
Begin Begin
if assigned (Track1) then begin if assigned (Track1) then begin
writeln ('Setting new position for scale. Old:', ord (Track1.ScalePos)); debugln (['Setting new position for scale. Old:', ord (Track1.ScalePos)]);
case Track1.ScalePos of case Track1.ScalePos of
trLeft : Track1.ScalePos := trRight; trLeft : Track1.ScalePos := trRight;
trRight : Track1.ScalePos := trTop; trRight : Track1.ScalePos := trTop;
@ -123,7 +123,7 @@ End;
procedure TForm1.Button5Click(Sender : TObject); procedure TForm1.Button5Click(Sender : TObject);
Begin Begin
if assigned (Track1) then begin if assigned (Track1) then begin
writeln ('Toggling showing tickmarks'); debugln ('Toggling showing tickmarks');
if Track1.TickStyle = tsNone if Track1.TickStyle = tsNone
then Track1.TickStyle := tsAuto then Track1.TickStyle := tsAuto
else Track1.TickStyle := tsNone; else Track1.TickStyle := tsNone;
@ -139,7 +139,7 @@ End;
procedure TForm1.Button7Click(Sender : TObject); procedure TForm1.Button7Click(Sender : TObject);
Begin Begin
if assigned (Track1) then begin if assigned (Track1) then begin
writeln ('Incrementing LineSize'); debugln ('Incrementing LineSize');
Track1.LineSize := Track1.LineSize + 1; Track1.LineSize := Track1.LineSize + 1;
end; end;
End; End;
@ -147,7 +147,7 @@ End;
procedure TForm1.Button8Click(Sender : TObject); procedure TForm1.Button8Click(Sender : TObject);
Begin Begin
if assigned (Track1) then begin if assigned (Track1) then begin
writeln ('Incrementing PageSize'); debugln ('Incrementing PageSize');
Track1.PageSize := Track1.PageSize + 1; Track1.PageSize := Track1.PageSize + 1;
end; end;
End; End;
@ -155,7 +155,7 @@ End;
procedure TForm1.Track1Change(Sender : TObject); procedure TForm1.Track1Change(Sender : TObject);
begin begin
if assigned (Track1) then begin if assigned (Track1) then begin
writeln ('*** CALLBACK ONCHANGE!!!!! ***'); DebugLn ('*** CALLBACK ONCHANGE!!!!! ***');
Track1.PageSize := Track1.PageSize + 1; Track1.PageSize := Track1.PageSize + 1;
end; end;
end; end;

View File

@ -52,7 +52,7 @@ begin
with tv_eg1.Items.AddFirst( nil, 'Root' ) do with tv_eg1.Items.AddFirst( nil, 'Root' ) do
begin begin
Selected := true; Selected := true;
writeln('tv_eg1.Selected=',DbgS(tv_eg1.Selected)); debugln('tv_eg1.Selected=',DbgS(tv_eg1.Selected));
end; end;
end end
else begin else begin

View File

@ -367,21 +367,21 @@ var
i: Integer; i: Integer;
Item: TMyCollectionItem; Item: TMyCollectionItem;
begin begin
writeln('TMyComponent.WriteDebugReport '); debugln('TMyComponent.WriteDebugReport ');
writeln(' MyDouble=',MyDouble); debugln([' MyDouble=',MyDouble]);
writeln(' MySingle=',MySingle); debugln([' MySingle=',MySingle]);
writeln(' MyEnum=',GetEnumName(TypeInfo(TMyEnum),ord(MyEnum))); debugln([' MyEnum=',GetEnumName(TypeInfo(TMyEnum),ord(MyEnum))]);
writeln(' MySet=',HexStr(Cardinal(MySet),8)); debugln([' MySet=',HexStr(Cardinal(MySet),8)]);
writeln(' MyString=',MyString); debugln([' MyString=',MyString]);
writeln(' MyWideString=',MyWideString); debugln([' MyWideString=',MyWideString]);
writeln(' MyInteger=',MyInteger); debugln([' MyInteger=',MyInteger]);
writeln(' MyInt64=',MyInt64); debugln([' MyInt64=',MyInt64]);
writeln(' MyCollection.Count=',MyCollection.Count); debugln([' MyCollection.Count=',MyCollection.Count]);
for i:=0 to MyCollection.Count-1 do begin for i:=0 to MyCollection.Count-1 do begin
Item:=TMyCollectionItem(MyCollection.Items[i]); Item:=TMyCollectionItem(MyCollection.Items[i]);
writeln(' ',i,' MyString=',Item.MyString); debugln([' ',i,' MyString=',Item.MyString]);
end; end;
writeln(' MyStrings='+dbgstr(MyStrings.Text)); debugln([' MyStrings='+dbgstr(MyStrings.Text)]);
end; end;
{ TMyGroupBox } { TMyGroupBox }