From 87791326d0da7a8bf46b1f06a9df425beb15f7bf Mon Sep 17 00:00:00 2001 From: bart <9132501-flyingsheep@users.noreply.gitlab.com> Date: Fri, 4 Mar 2016 15:05:52 +0000 Subject: [PATCH] Examples: Start completely rewrting the TestAll apllication. git-svn-id: trunk@51824 - --- .gitattributes | 1 + examples/testall.lpi | 78 +- examples/testallform.pp | 2721 +++------------------------ examples/testallform_include.inc | 314 ++++ examples/testtools.inc | 2971 ++---------------------------- 5 files changed, 715 insertions(+), 5370 deletions(-) create mode 100644 examples/testallform_include.inc diff --git a/.gitattributes b/.gitattributes index 1f12c4a406..6759fb2b62 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5603,6 +5603,7 @@ examples/taborder.pas svneol=native#text/pascal examples/testall.lpi svneol=native#text/plain examples/testall.pp svneol=native#text/pascal examples/testallform.pp svneol=native#text/pascal +examples/testallform_include.inc svneol=native#text/plain examples/testtools.inc svneol=native#text/pascal examples/toolbar.lpi svneol=native#text/plain examples/toolbar.pp svneol=native#text/pascal diff --git a/examples/testall.lpi b/examples/testall.lpi index ff446f3dea..1f453a791a 100644 --- a/examples/testall.lpi +++ b/examples/testall.lpi @@ -2,33 +2,42 @@ + - - - - - + + + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <Icon Value="0"/> </General> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> <BuildModes Count="2"> <Item1 Name="Debug" Default="True"/> <Item2 Name="Release"> <CompilerOptions> <Version Value="11"/> - <Parsing> - <SyntaxOptions> - <UseAnsiStrings Value="False"/> - </SyntaxOptions> - </Parsing> + <PathDelim Value="\"/> + <Target> + <Filename Value="testall"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> <CodeGeneration> - <SmartLinkUnit Value="True"/> <Optimizations> - <OptimizationLevel Value="3"/> + <OptimizationLevel Value="2"/> + <VariablesInRegisters Value="True"/> </Optimizations> </CodeGeneration> <Linking> <Debugging> <GenerateDebugInfo Value="False"/> + <UseLineInfoUnit Value="False"/> + <StripSymbols Value="True"/> </Debugging> <LinkSmart Value="True"/> <Options> @@ -42,14 +51,10 @@ </BuildModes> <PublishOptions> <Version Value="2"/> - <IgnoreBinaries Value="False"/> - <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"> @@ -57,27 +62,35 @@ <PackageName Value="LCL"/> </Item1> </RequiredPackages> - <Units Count="2"> + <Units Count="3"> <Unit0> - <Filename Value="testall.pp"/> + <Filename Value="testall.lpr"/> <IsPartOfProject Value="True"/> - <UnitName Value="TestAll"/> </Unit0> <Unit1> <Filename Value="testallform.pp"/> <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> <UnitName Value="TestAllForm"/> </Unit1> + <Unit2> + <Filename Value="testallform_include.inc"/> + <IsPartOfProject Value="True"/> + </Unit2> </Units> </ProjectOptions> <CompilerOptions> <Version Value="11"/> - <Parsing> - <SyntaxOptions> - <IncludeAssertionCode Value="True"/> - <UseAnsiStrings Value="False"/> - </SyntaxOptions> - </Parsing> + <PathDelim Value="\"/> + <Target> + <Filename Value="testall"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> <CodeGeneration> <Checks> <IOChecks Value="True"/> @@ -88,10 +101,21 @@ </CodeGeneration> <Linking> <Debugging> - <DebugInfoType Value="dsDwarf2Set"/> <UseHeaptrc Value="True"/> - <UseExternalDbgSyms Value="True"/> </Debugging> </Linking> </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> </CONFIG> diff --git a/examples/testallform.pp b/examples/testallform.pp index 8778b9fa7b..2a82476f4e 100644 --- a/examples/testallform.pp +++ b/examples/testallform.pp @@ -1,13 +1,4 @@ -{/*************************************************************************** - testallform.pp - ------------------- - Example application TestAll - Initial Revision : Fri Jul 14 20:00:00 PDT 2000 - Author : christer.t.johansson@se.abb.com - - - ***************************************************************************/ - +{ *************************************************************************** * * * This source is free software; you can redistribute it and/or modify * @@ -30,2492 +21,270 @@ unit TestAllForm; -{$mode objfpc} -{$H+} - +{$mode objfpc}{$H+} interface +uses + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, + Menus, Buttons, StdCtrls, LclProc, LCLType, ContNrs, -{$ASSERTIONS ON} - - -uses Classes, SysUtils, LazUTF8, Forms, Buttons, StdCtrls, Controls, Menus, - ExtCtrls, ComCtrls, GraphType, Graphics, Dialogs, Inifiles, Spin, ClipBrd, - LCLIntf, LResources; + Arrow; type - TForm1 = class(TForm) - private - Bevel1 : TBevel; - BitBtn1 : TBitBtn; - //Bitmap1 : TBitmap; - Button1 : Array[0..15] of TButton; - CheckBox1 : Array[1..35] of TCheckBox; - //ClipBoard1 : TClipBoard; - ColorDialog1 : TColorDialog; - ComboBox1 : TComboBox; - //DirectoryListBox1 : TDirectoryListBox; - //DrawGrid1 : TDrawGrid; - //DriveComboBox1 : TDriveComboBox; - Edit1 : TEdit; - //FileListBox1 : TFileListBox; - //FilterComboBox1 : TFilterComboBox; - //FindDialog1 : TFindDialog; - FontDialog1 : TFontDialog; - GroupBox1 : TGroupBox; - //Image1 : TImage; - IniFile1 : TIniFile; - Label1 : TLabel; - ListBox1, ListBox2 : TListBox; - MainMenu1 : TMainMenu; -//+++++++++++++++++++++++++++++ MenuItems +++++++++++++++++++++++++++++++++++++++++++ - File1, New1, Open1, Save1, Sep1, Quit1, Settings1, Comps1, Help1, About1 : TMenuItem; - EditM, Event2, Prop2, Sep3 : TMenuItem; - View1, Prop1, Event1 : TMenuItem; - Color1, Find1, Font1, Print1, PrintS1, Replace1, Copy1, Paste1, Cut1, Sep2 : TMenuItem; - AC1, DF1, GM1, NP1, QS1, TZ1 : TMenuItem; - TAppl, TBev, TBit, TBut, TCan, TChe, TClip, TClis, TCol, TCom : TMenuItem; - TDir, TDra, TDri, TEdi, TFile, TFilt, TFin, TFon, TFor : TMenuItem; - TGro, TIma, TIni, TLab, TLis, TMas, TMed, TMem, TMes : TMenuItem; - TNot, TOpe, TPag, TPai, TPan, TPop, TPriD, TPriS, TPro : TMenuItem; - TRadB, TRadG, TRep, TRic, TSav, TSCre, TScroBa, TScroBo, TSha, TSpee, TSpinB, TSpinE, TStat, TStri : TMenuItem; - TTabN, TTabC, TThre, TTim, TTog, TToo, TTrac, TUpD : TMenuItem; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - //MaskEdit1 : TMaskEdit; - //MediaPlayer1 : TMediaPlayer; - Memo1 : TMemo; - //MessageDialog1 : TMessageDialog; - //NoteBook1 : TNoteBook; - OpenDialog1 : TOpenDialog; - PageControl1 : TPageControl; - //TabSheet1, TabSheet2, TabSheet3 : TTabSheet; - PaintBox1 : TPaintBox; - Panel1 : TPanel; - PixMap1 : TPixMap; - PopupMenu1 : TPopupMenu; - Hello : TMenuItem; - Doctor : TMenuItem; - //FName: TMenuItem; - //Yesterday: TMenuItem; - //Tomorrow : TMenuItem; - //PrintDialog1 : TPrintDialog; - //PrinterSetupDialog1 : TPrinterSetupDialog; - ProgressBar1 : TProgressBar; - RadioButton1 : TRadioButton; - RadioGroup1 : TRadioGroup; - //ReplaceDialog1 : TReplaceDialog; - //RichEdit1 : TRichEdit; - SaveDialog1 : TSaveDialog; - ScrollBar1 : TScrollBar; - //ScrollBox1 : TScrollBox; - //Shape1 : TShape; - SpeedButton1, SpeedButton2, SpeedButton3, SpeedButton4 : TSpeedButton; - //SpinButton1 : TSpinButton; - SpinEdit1 : TSpinEdit; - StatusBar1 : TStatusBar; - //StringGrid1 : TStringGrid; - //TabbedNoteBook : TTabbedNoteBook; - //TabControl : TTabControl; - //Thread1 : TThread; - Timer1 : TTimer; - ToggleBox1 : TToggleBox; - ToolBar1 : TToolBar; - //ToolButton1 : TToolButton; - TrackBar1, TrackBar2 : TTrackBar; - //UpDown1 : TUpDown; -//+++++++++++++ TestTools +++++++++++++++++++++++++++++ - AboutForm : TForm; - BenchForm : Array[1..59] of TForm; - EventForm : TForm; - - procedure EventFormShow(Sender : TObject); - procedure EventOnMouseDown(Sender : TObject; Button : TMouseButton; Shift : TShiftState; X,Y : Integer); - procedure EventOnMouseUp(Sender : TObject; Button : TMouseButton; Shift : TShiftState; X,Y : Integer); - procedure EventOnMouseMove(Sender : TObject; Shift : TShiftState; X,Y : Integer); - procedure EventOnMouseEnter(Sender : TObject); - procedure EventOnMouseLeave(Sender : TObject); - procedure EventOnClick(Sender : TObject); - procedure EventOnResize(Sender : TObject); - procedure EventOnShow(Sender : TObject); - procedure EventOnChange(Sender : TObject); - procedure EventOnDblClick(Sender : TObject); - procedure EventOnKeyDown(Sender : TObject; var Key : Word; Shift : TShiftState); - procedure EventOnKeyUp(Sender : TObject; var Key : Word; Shift : TShiftState); - private -//+++++++++++++ TApplication ++++++++++++++++++++++++++ - lblExeName : TLabel; - rdbOk,rdbOkCancel,rdbAbortRetryIgnore,rdbYesNoCancel,rdbYesNo,rdbRetryCancel : TRadioButton; - btnShowBox : TBitBtn; - FBoxStyle : Integer; - procedure BoxStyle(Sender : TObject); - procedure ShowBox(Sender : TObject); - private -//+++++++++++++ TBevel ++++++++++++++++++++++++++++++++ - chbBevelStyle, - chbBevelShape : TRadiogroup; - procedure BevelSettings(Sender : TObject); - private -//+++++++++++++ TButton +++++++++++++++++++++++++++++++ - LCount : Integer; - btnCLRLotto : TBitBtn; - lblLResult : TLabel; - procedure LottoClear(Sender : TObject); - procedure Button1Click(Sender : TObject); - procedure ButtonTag(Sender : Integer); - private -//+++++++++++++ TBitBtn +++++++++++++++++++++++++++++++ - cbbKind, cbbAlign : TComboBox; - btnGlyph : TBitBtn; - procedure KindComboChange(Sender : TObject); - procedure AlignComboChange(Sender : TObject); - procedure LoadGlyph(Sender : TObject); - private -//+++++++++++++ TCanvas +++++++++++++++++++++++++++++++ - FPaint : Boolean; - Start1, Start2 : Integer; - cbbPaintType, cbbBrushStyle, cbbPenStyle : TComboBox; - btnCanvasClear, btnPenColor, btnBrushColor, btnGrad : TBitBtn; - lblPaintWhat, lblBrushStyle, lblPenStyle : TLabel; - procedure StyleSelect(Sender : TObject); - procedure PenStyleSelect(Sender : TObject); - procedure DrawRect(X1,Y1,X2,Y2 : Integer); - procedure ClearCanvas(Sender : TObject); - procedure GradCanvas(Sender : TObject); - private -//+++++++++++++ TCheckBox +++++++++++++++++++++++++++++ - lblPick, lblCount : TLabel; - RandCH, CHCount : Integer; - btnAgain : TBitBtn; - procedure CheckClick(Sender : TObject); - procedure AgainClick(Sender : Tobject); - private -//+++++++++++++ TColorDialog ++++++++++++++++++++++++++ - btnColorSelect : TBitBtn; - lblColorInt : TLabel; - procedure ColorSelect(Sender : TObject); - procedure SelectedColor(Sender : TObject); - private -//+++++++++++++ TComboBox +++++++++++++++++++++++++++++ - btnCbbAdd : TButton; - btnCbbRemove, btnMoveTo : TBitBtn; - edtCbbAdd : TEdit; - cbbMoveTo : TComboBox; - lblRemoved, lblIndex, lblSelLength, lblSelStart, lblSelText : TLabel; - procedure AddToCbb(Sender : TObject); - procedure RemoveCbb(Sender : TObject); - procedure MoveToCbb(Sender : TObject); - private -//+++++++++++++ TForm +++++++++++++++++++++++++++++++++ - lblWidth, lblHeight, lblCWidth, lblCHeight : TLabel; - cbbBorder, cbbPosition : TComboBox; - btnKeyDown : TBitBtn; - procedure FormBorder(Sender : TObject); - procedure FormPosition(Sender : TObject); - private -//+++++++++++++ TFontDialog +++++++++++++++++++++++++++ - lblWhatFont: TLabel; - //blFontSize: TLabel; - //lblFontStyle : TLabel; - btnShowFont : TBitBtn; - procedure SelectFont(Sender : TObject); - private -//+++++++++++++ TIniFile ++++++++++++++++++++++++++++++ - edtString, edtFloat, edtInteger, edtDate, edtTime : TEdit; - lblString, lblFloat, lblInteger, lblDate, lblTime : TLabel; - btnUpdate : TBitBtn; - procedure IniUpdate(Sender : TObject); - private -//+++++++++++++ TLabel ++++++++++++++++++++++++++++++++ - cbbAlignment : TComboBox; - procedure SelectAlignment(Sender : TObject); - private -//+++++++++++++ TListBox ++++++++++++++++++++++++++++++ - btnRight, btnLeft, btnAdd, btnCopyToMem, btnSaveFile : TBitBtn; - memAddTo : TMemo; - edtAddLis1, edtAddLis2 : TEdit; - Function AddNotDub(AList: TCustomListBox; nText: String):Boolean; - procedure ListBoxMove(Sender : TObject); - procedure CopyToMem(Sender : TObject); - procedure SaveFile(Sender : TObject); - private -//+++++++++++++ TMemo +++++++++++++++++++++++++++++++++ - btnNew, btnSave, btnOpen : TBitBtn; - procedure NewMemo(Sender : TObject); - procedure SaveMemoAs(Sender : TObject); - procedure OpenMemo(Sender : TObject); -//+++++++++++++ TOpenDialog +++++++++++++++++++++++++++ + { TForm1 } - private -//+++++++++++++ TPaintBox +++++++++++++++++++++++++++++ - pntCount : integer; -//+++++++++++++ TPanel ++++++++++++++++++++++++++++++++ - Panel2 : TPanel; - btPanelNorm : TButton; - rgPanelInBevel, - rgPanelOutBevel, - rgPanelAlign : TRadioGroup; - procedure PanelInBevelClick(Sender: TObject); - procedure PanelOutBevelClick(Sender: TObject); - procedure PanelAlignClick(Sender: TObject); - procedure PanelNormClick(Sender:TObject); - private -//+++++++++++++ TProgressBar ++++++++++++++++++++++++++ - chbProgText, chbProgDirect, chbProgOrient, chbProgEnable, chbSmooth : TCheckBox; - ProgTime : TTimer; - procedure ProgSettings(Sender : TObject); - procedure UpdateProgressBar(Sender : TObject); -//+++++++++++++ TRadioGroup +++++++++++++++++++++++++++ - procedure RadioGroupClick(Sender : TObject); - private -//+++++++++++++ TScreen +++++++++++++++++++++++++++++++ - lblScreenWidth, lblScreenHeight, lblPixels, lblFormCount : TLabel; -//+++++++++++++ TSpeedButton ++++++++++++++++++++++++++ - SpeedB : Array[0..8] of TSpeedButton; -//+++++++++++++ TSpinEdit +++++++++++++++++++++++++++++ - lblOnChange : TLabel; -//+++++++++++++ TTimer ++++++++++++++++++++++++++++++++ - lblTimeNow, lblHourMinSec, lblMSec : TLabel; - btnStart : TBitBtn; - MSec, Hour, Min, Sec : Integer; - FTrack : Boolean; - procedure Timer1OnTimer(Sender : TObject); - procedure TimeTrack(Sender : TObject); - private -//+++++++++++++ TToggleBox ++++++++++++++++++++++++++++ - lblChecked, lblState : TLabel; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++ - procedure CreateMainMenu; - procedure CreateTestTools; - procedure TestFormClose(Sender : TObject; var CloseAction : TCloseAction); - procedure CreateComponents; - procedure QuitClick(Sender : TObject); - procedure ShowTestForm(Sender : TObject); - procedure ShowMessage0(Sender : TObject); - procedure ShowMessage1(Sender : TObject); - protected -//+++++++++++++ Virtual MouseEnter/Leave ++++++++++++++ - FFocusControl : TControl; - procedure ApplicationIdle(Sender : TObject; var Done : Boolean); - procedure VirOnEnter(Sender: TObject); - procedure VirOnLeave(Sender: TObject); - protected -//+++++++++++++ About +++++++++++++++++++++++++++++++++ - lblAbout, lblAuthor : TMemo; - gbAbout : TGroupBox; - btnBigOk : TBitBtn; - procedure CloseAbout(Sender : TObject); - procedure Notification(AComponent: TComponent; Operation : TOperation);override; - public - lbEvents: TListBox; - FLeft : Integer; - procedure EventWatch; - Constructor Create(AOwner: TComponent); override; - Destructor Destroy; override; - end; + TForm1 = class(TForm) + BtnClear: TBitBtn; + BottomPnl: TPanel; + EventsLB: TListBox; + MainMenu1: TMainMenu; + mnuCompTZ: TMenuItem; + mnuCompQS: TMenuItem; + mnuCompNP: TMenuItem; + mnuCompGM: TMenuItem; + mnuCompDF: TMenuItem; + mnuCompAC: TMenuItem; + mnuComponents: TMenuItem; + mnuAbout: TMenuItem; + mnuFile: TMenuItem; + mnuFileExit: TMenuItem; + mnuDialogs: TMenuItem; + EventsPnl: TPanel; + TestPnl: TPanel; + procedure BtnClearClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure mnuAboutClick(Sender: TObject); + procedure mnuFileExitClick(Sender: TObject); + private + { private declarations } + FObjList: TFPObjectList; + procedure Clear; + + procedure CompMenuClick(Sender: TObject); + procedure DlgMenuClick(Sender: TObject); + procedure GenClick(Sender: TObject); + procedure GenDblClick(Sender: TObject); + procedure GenKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure GenKeyPress(Sender: TObject; var Key: char); + procedure GenKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure GenMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure GenMouseEnter(Sender: TObject); + procedure GenMouseLeave(Sender: TObject); + procedure GenMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure ShowEventFmt(const Fmt: String; const Args: array of const); + + procedure ConnectStandardEvents(AControl: TControl); + function VkToString(Key: Word): String; + procedure CreateMainMenu; + // Components tests + procedure TestArrow; + procedure TestBitBtn; + + public + { public declarations } + end; var - Form1 : TForm1; - S : TFileStream; + Form1: TForm1; + +{$i testallform_include.inc} implementation +{$R *.lfm} {$R ../images/laz_images.res} {$R ../images/components_images.res} -function LoadResource(ResourceName:string; PixMap: TPixmap): Boolean; -var - Bitmap: TCustomBitmap; +{ TForm1 } + +procedure TForm1.mnuFileExitClick(Sender: TObject); begin - Bitmap := CreateBitmapFromResourceName(HInstance, ResourceName); - Result := Assigned(Bitmap); - if Result then + Close; +end; + +procedure TForm1.Clear; +begin + FObjList.Clear; + EventsLB.Clear; +end; + +procedure TForm1.CompMenuClick(Sender: TObject); +var + mi: TMenuItem; + tg: PtrInt; + TagValid: Boolean; +begin + debugln('TForm1.CompMenuClick A'); + mi := Sender as TMenuItem; + tg := mi.Tag and not tagCompStart; + TagValid := ((mi.Tag and tagCompStart) = tagCompStart) and + (tg >= Ord(Low(taComponents))) and + (tg <= Ord(High(taComponents))); + if not TagValid then begin - PixMap.Assign(Bitmap); - Bitmap.Free; + DebugLn(['TForm1.CompMenuClick: Unexpected Tag from TMenuItem: [',mi.Name,']']); + Exit; + end; + case taComponents(tg) of + tacTarrow: TestArrow; + tacTbitbtn: TestBitBtn; + end; + debugln('TForm1.CompMenuClick End'); +end; + +procedure TForm1.DlgMenuClick(Sender: TObject); +begin + +end; + +procedure TForm1.GenClick(Sender: TObject); +begin + ShowEventFmt('%s.OnClick',[Sender.ClassName]); +end; + +procedure TForm1.GenDblClick(Sender: TObject); +begin + ShowEventFmt('%s.OnDblClick',[Sender.ClassName]); +end; + +procedure TForm1.GenKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); +begin + ShowEventFmt('%s.OnKeyDown [$%s]',[Sender.ClassName,VkToString(Key)]); +end; + +procedure TForm1.GenKeyPress(Sender: TObject; var Key: char); +begin + if Key in [#33..#127] then + ShowEventFmt('%s.OnKeyPress [%s]',[Sender.ClassName, Key]) + else + ShowEventFmt('%s.OnKeyPress [#%d]',[Sender.ClassName, Ord(Key)]) +end; + +procedure TForm1.GenKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); +begin + ShowEventFmt('%s.OnKeyUp [$%s]',[Sender.ClassName,VkToString(Key)]); +end; + +procedure TForm1.GenMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + ShowEventFmt('%s.OnMouseDown at (%d,%d)',[Sender.ClassName,X,Y]); +end; + +procedure TForm1.GenMouseEnter(Sender: TObject); +begin + ShowEventFmt('%s.OnMouseEnter',[Sender.ClassName]); +end; + +procedure TForm1.GenMouseLeave(Sender: TObject); +begin + ShowEventFmt('%s.OnMouseLeave',[Sender.ClassName]); +end; + +procedure TForm1.GenMouseUp(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + ShowEventFmt('%s.OnMouseUp at (%d,%d)',[Sender.ClassName,X,Y]); +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + FObjList := TFPObjectList.Create(True); + CreateMainMenu; + +end; + +procedure TForm1.BtnClearClick(Sender: TObject); +begin + Clear; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + FObjList.Clear; + FObjList.Free; +end; + +procedure TForm1.mnuAboutClick(Sender: TObject); +begin + MessageDlg(AppTitle, AboutMsg, mtInformation, [mbOK], 0); +end; + +procedure TForm1.ShowEventFmt(const Fmt: String; const Args: array of const); +begin + EventsLB.Items.Add(Fmt, Args); + EventsLB.ItemIndex := EventsLB.Count - 1; +end; + +type + THackControl = class(TControl); + +procedure TForm1.ConnectStandardEvents(AControl: TControl); +begin + THackControl(AControl).OnMouseDown := @GenMouseDown; + THackControl(AControl).OnMouseUp := @GenMouseUp; + THackControl(AControl).OnMouseEnter := @GenMouseEnter; + THackControl(AControl).OnMouseLeave := @GenMouseLeave; + AControl.OnClick := @GenClick; + THackControl(AControl).OnDblClick := @GenDblClick; + if (AControl is TWinControl) then TWinControl(AControl).OnKeyDown := @GenKeyDown; + if (AControl is TWinControl) then TWinControl(AControl).OnKeyUp := @GenKeyUp; + if (AControl is TCustomEdit) then TCustomEdit(AControl).OnKeyPress := @GenKeyPress; +end; + +function TForm1.VkToString(Key: Word): String; +begin + Result := DbgsVKCode(Key); + if (Pos('(', Result) > 0) and (Pos(')', Result) > 0) then + Result := '$' + IntToHex(Key,4); +end; + +procedure TForm1.CreateMainMenu; +var + tac: taComponents; + mi: TMenuItem; + aCaption: String; + tad: taDialogs; +begin + for tac := Low(taComponents) to High(taComponents) do + begin + mi := TMenuItem.Create(Self); + aCaption := taCompNames[tac]; + if (Upcase(aCaption[1]) = 'T') then aCaption[2] := UpCase(aCaption[2]); + mi.Caption := aCaption; + mi.Enabled := taCompImplemented[tac]; + mi.Name := 'mnu' + aCaption; + mi.Tag := tagCompStart or Ord(tac); + mi.OnClick := @CompMenuClick; + //mnuComponents.Add(mi); + case UpCase(aCaption[2]) of + 'A'..'C': mnuCompAC.Add(mi); + 'D'..'F': mnuCompDF.Add(mi); + 'G'..'M': mnuCompGM.Add(mi); + 'N'..'P': mnuCompNP.Add(mi); + 'Q'..'S': mnuCompQS.Add(mi); + 'T'..'Z': mnuCompTZ.Add(mi); + end; + end; + for tad := Low(taDialogs) to High(taDialogs) do + begin + mi := TMenuItem.Create(Self); + aCaption := taDlgNames[tad]; + //if (Upcase(aCaption[1]) = 'T') then aCaption[2] := UpCase(aCaption[2]); + mi.Caption := aCaption; + mi.Enabled := taDlgImplemented[tad]; + mi.Name := 'mnu' + aCaption; + mi.Tag := tagDlgStart or Ord(tad); + mi.OnClick := @DlgMenuClick; + mnuDialogs.Add(mi); end; end; {$I testtools.inc} - -//******** Create Form1.TForm1 ****************************************************** -constructor TForm1.Create(AOwner: TComponent); -begin - inherited CreateNew(AOwner, 1); - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - //OnMouseMove := @EventOnMouseMove; - OnClick := @EventOnClick; - //OnDestroy := @Destroy; - OnKeyDown := @EventOnKeyDown; - Height := 300; - - //Action - //ActiveControl := btnKeyDown; - Align := alNone; - //Anchors := Form1.Anchors+[akLeft,akTop]; //Unhandled exeption - //AutoScroll := True; - AutoSize := False; - //BiDiMode := Form1.BiDiMode+[bdLefToRight]; - //BorderIcons := Form1.BorderIcons+[biSystemMenu]; - BorderStyle := bsSizeable; - BorderWidth := 0; - Caption := 'Test All Components V 0.2'; - //ClientHeight := 333; - //ClientWidth := 534; - Color := clBtnFace; - //Constraints - //Cursor := crHandPoint; //Only crDefault - //DefaultMonitor := dmActiveForm; - //DockSite := False; - DragKind := dkDrag; - DragMode := dmManual; - //Enabled := True; //If set before MainMenu it disappers, before Height SpeedButton disappers, after Hint and it will not show - //Font.Charset := DEFAULT_CHARSET; - Font.Color := clBlack; - Font.Height := -11; - Font.Name := 'avantgarde'; - Font.Pitch := fpDefault; - Font.Size := 10; - //Font.Style := Form1.Font.Style+[fsBold]; //Access violation - FormStyle := fsNormal; - //Height := 300; - //HelpContext := 0; - //HelpFile - Hint := 'The TEST Station'; - //HorzScrollBars //Not been tested yet - //Icon //Not been tested yet - KeyPreview := True; - Left := 200; - //Menu := MainMenu1; - Name := 'Form1'; - //ObjectMenuItem := File1; - //ParentBiDiMode := False; - ParentFont := True; - //PixelsPerInch := 96; - PopupMenu := PopupMenu1; - Position := poScreenCenter; - //PrintScale := poProportional; - //Scaled := True; - //ShowHint := True; //Has to be set after Enabled - Tag := 9; - Top := 200; - //UseDockManager := False; - //VertScrollBar //Not been tested yet - //Visible := True; //2 X Access violation - Width := 403; - //WindowMenu := File1; - WindowState := wsNormal; - - Enabled := True; //Has to be set after SpeedButtons - ShowHint := True; //Has to be set after Enabled - - LCount := 0; - FPaint := False; - Randomize; - CreateMainMenu; - CreateComponents; - CreateTestTools; - - FFocusControl := nil; - Application.OnIdle := @ApplicationIdle; - -End; - -procedure TForm1.CreateMainMenu; -begin - MainMenu1 := TMainMenu.Create(Self); - MainMenu1.Name := 'MainMenu1'; - - Menu := MainMenu1; - - File1 := TMenuItem.Create(Self); - File1.Caption := '&File'; - MainMenu1.Items.Add(File1); - - New1 := TMenuItem.Create(Self); - New1.Caption := '&New'; - New1.OnClick := @NewMemo; - File1.Add(New1); - - Open1 := TMenuItem.Create(Self); - Open1.Caption := '&Open'; - Open1.OnClick := @OpenMemo; - File1.Add(Open1); - - Save1 := TMenuItem.Create(Self); - Save1.Caption := '&Save as ...'; - Save1.OnClick := @SaveMemoAs; - File1.Add(Save1); - - Sep1 := TMenuItem.Create(Self); - Sep1.Caption := '-'; - File1.Add(Sep1); - - Quit1 := TMenuItem.Create(Self); - Quit1.Caption := '&Quit'; - Quit1.OnClick := @QuitClick; - File1.Add(Quit1); - - EditM := TMenuItem.Create(Self); - EditM.Caption := '&Edit'; - MainMenu1.Items.Add(EditM); - - Copy1 := TMenuItem.Create(Self); - Copy1.Caption := 'C&opy Ctrl+C'; - Paste1 := TMenuItem.Create(Self); - Paste1.Caption := '&Paste Ctrl+V'; - Cut1 := TMenuItem.Create(Self); - Cut1.Caption := 'C&ut Ctrl+X'; - Sep2 := TMenuItem.Create(Self); - Sep2.Caption := '-'; - Find1 := TMenuItem.Create(Self); - Find1.Caption := '&Find'; - Replace1 := TMenuItem.Create(Self); - Replace1.Caption := '&Replace'; - EditM.Add(Copy1); - EditM.Add(Paste1); - EditM.Add(Cut1); - EditM.Add(Sep2); - EditM.Add(Find1); - EditM.Add(Replace1); - - View1 := TMenuItem.Create(Self); - View1.Caption := '&View'; - MainMenu1.Items.Add(View1); - - Prop1 := TMenuItem.Create(Self); - Prop1.Caption := '&Properties'; - - Event1 := TMenuItem.Create(Self); - Event1.Caption := '&EventSnoop'; - Event1.OnClick := @EventFormShow; - - View1.Add(Prop1); - View1.Add(Event1); - - Settings1 := TMenuItem.Create(Self); - Settings1.Caption := '&Settings'; - MainMenu1.Items.Add(Settings1); - - Event2 := TMenuItem.Create(Self); - Event2.Caption := 'E&ventSnoop'; - Prop2 := TMenuItem.Create(Self); - Prop2.Caption := 'P&roperties'; - Sep3 := TMenuItem.Create(Self); - Sep3.Caption := '-'; - Color1 := TMenuItem.Create(Self); - Color1.Caption := '&Color'; - Font1 := TMenuItem.Create(Self); - Font1.Caption := 'F&ont'; - Print1 := TMenuItem.Create(Self); - Print1.Caption := '&Print'; - PrintS1 := TMenuItem.Create(Self); - PrintS1.Caption := 'Printer &Setup'; - Settings1.Add(Event2); - Settings1.Add(Prop2); - Settings1.Add(Sep3); - Settings1.Add(Color1); - Settings1.Add(Font1); - Settings1.Add(Print1); - Settings1.Add(PrintS1); -//++++++++++++++++++++++++++++++++++++ Components +++++++++++++++++++++++++++++++++++ - Comps1 := TMenuItem.Create(Self); - Comps1.Caption := '&Components'; - MainMenu1.Items.Add(Comps1); - - AC1 := TMenuItem.Create(Self);//++++ A - C - AC1.Caption := 'A - C'; - Comps1.Add(AC1); - - TAppl := TMenuItem.Create(Self); - TAppl.Caption := 'TApplication'; - TAppl.OnClick := @ShowMessage1; - - TBev := TMenuItem.Create(Self); - TBev.Caption := 'TBevel'; - TBev.OnClick := @ShowMessage1; - - TBit := TMenuItem.Create(Self); - TBit.Caption := 'TBitBtn'; - TBit.OnClick := @ShowMessage1; - - TBut := TMenuItem.Create(Self); - TBut.Caption := 'TButton'; - TBut.OnClick := @ShowMessage1; - - TCan := TMenuItem.Create(Self); - TCan.Caption := 'TCanvas'; - TCan.OnClick := @ShowMessage1; - - TChe := TMenuItem.Create(Self); - TChe.Caption := 'TCheckBox'; - TChe.OnClick := @ShowMessage1; - - TClip := TMenuItem.Create(Self); - TClip.Caption := 'TClipBoard'; - TClip.OnClick := @ShowMessage1; - - TCol := TMenuItem.Create(Self); - TCol.Caption := 'TColorDialog'; - TCol.OnClick := @ShowMessage1; - - TCom := TMenuItem.Create(Self); - TCom.Caption := 'TComboBox'; - TCom.OnClick := @ShowMessage1; - - AC1.Add(TAppl); - AC1.Add(TBev); - AC1.Add(TBit); - AC1.Add(TBut); - AC1.Add(TCan); - AC1.Add(TChe); - AC1.Add(TClip); - AC1.Add(TCol); - AC1.Add(TCom); - - DF1 := TMenuItem.Create(Self);//++++ D - F - DF1.Caption := 'D - F'; - Comps1.Add(DF1); - - TDir := TMenuItem.Create(Self); - TDir.Caption := 'TDirectoryListBox'; - TDir.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TDra := TMenuItem.Create(Self); - TDra.Caption := 'TDrawGrid'; - TDra.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TDri := TMenuItem.Create(Self); - TDri.Caption := 'TDriveComboBox'; - TDri.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TEdi := TMenuItem.Create(Self); - TEdi.Caption := 'TEdit'; - TEdi.OnClick := @ShowMessage1; - - TFile := TMenuItem.Create(Self); - TFile.Caption := 'TFileListBox'; - TFile.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TFilt := TMenuItem.Create(Self); - TFilt.Caption := 'TFilterComboBox'; - TFilt.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TFin := TMenuItem.Create(Self); - TFin.Caption := 'TFindDialog'; - TFin.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TFon := TMenuItem.Create(Self); - TFon.Caption := 'TFontDialog'; - TFon.OnClick := @ShowMessage1; - - TFor := TMenuItem.Create(Self); - TFor.Caption := 'TForm'; - TFor.OnClick := @ShowMessage1; - - DF1.Add(TDir); - DF1.Add(TDra); - DF1.Add(TDri); - DF1.Add(TEdi); - DF1.Add(TFile); - DF1.Add(TFilt); - DF1.Add(TFin); - DF1.Add(TFon); - DF1.Add(TFor); - - GM1 := TMenuItem.Create(Self);//++++ G - M - GM1.Caption := 'G - M'; - Comps1.Add(GM1); - - TGro := TMenuItem.Create(Self); - TGro.Caption := 'TGroupBox'; - TGro.OnClick := @ShowMessage1; - - TIma := TMenuItem.Create(Self); - TIma.Caption := 'TImage'; - TIma.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TIni := TMenuItem.Create(Self); - TIni.Caption := 'TIniFile'; - TIni.OnClick := @ShowMessage1; - - TLab := TMenuItem.Create(Self); - TLab.Caption := 'TLabel'; - TLab.OnClick := @ShowMessage1; - - TLis := TMenuItem.Create(Self); - TLis.Caption := 'TListBox'; - TLis.OnClick := @ShowMessage1; - - TMas := TMenuItem.Create(Self); - TMas.Caption := 'TMaskEdit'; - TMas.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TMed := TMenuItem.Create(Self); - TMed.Caption := 'TMediaPlayer'; - TMed.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TMem := TMenuItem.Create(Self); - TMem.Caption := 'TMemo'; - TMem.OnClick := @ShowMessage1; - - TMes := TMenuItem.Create(Self); - TMes.Caption := 'TMessageDialog'; - TMes.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - GM1.Add(TGro); - GM1.Add(TIma); - GM1.Add(TIni); - GM1.Add(TLab); - GM1.Add(TLis); - GM1.Add(TMas); - GM1.Add(TMed); - GM1.Add(TMem); - GM1.Add(TMes); - - NP1 := TMenuItem.Create(Self);//++++ N - P - NP1.Caption := 'N - P'; - Comps1.Add(NP1); - - TNot := TMenuItem.Create(Self); - TNot.Caption := 'TNoteBook'; - TNot.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TOpe := TMenuItem.Create(Self); - TOpe.Caption := 'TOpenDialog'; - TOpe.OnClick := @ShowMessage1; - - TPag := TMenuItem.Create(Self); - TPag.Caption := 'TPageControl'; - TPag.OnClick := @ShowMessage1; - - TPai := TMenuItem.Create(Self); - TPai.Caption := 'TPaintBox'; - TPai.OnClick := @ShowMessage1; - - TPan := TMenuItem.Create(Self); - TPan.Caption := 'TPanel'; - TPan.OnClick := @ShowMessage1; - - TPop := TMenuItem.Create(Self); - TPop.Caption := 'TPopupMenu'; - TPop.OnClick := @ShowMessage1; - - TPriD := TMenuItem.Create(Self); - TPriD.Caption := 'TPrinterDialog'; - TPriD.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TPriS := TMenuItem.Create(Self); - TPriS.Caption := 'TPrinterSetupDialog'; - TPriS.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TPro := TMenuItem.Create(Self); - TPro.Caption := 'TProgressBar'; - TPro.OnClick := @ShowMessage1; - - NP1.Add(TNot); - NP1.Add(TOpe); - NP1.Add(TPag); - NP1.Add(TPai); - NP1.Add(TPan); - NP1.Add(TPop); - NP1.Add(TPriD); - NP1.Add(TPriS); - NP1.Add(TPro); - - QS1 := TMenuItem.Create(Self);//++++ Q - S - QS1.Caption := 'Q - S'; - Comps1.Add(QS1); - - TRadB := TMenuItem.Create(Self); - TRadB.Caption := 'TRadioButton'; - TRadB.OnClick := @ShowMessage1; - - TRadG := TMenuItem.Create(Self); - TRadG.Caption := 'TRadioGroup'; - TRadG.OnClick := @ShowMessage1; - - TRep := TMenuItem.Create(Self); - TRep.Caption := 'TReplaceDialog'; - TRep.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TRic := TMenuItem.Create(Self); - TRic.Caption := 'TRichEdit'; - TRic.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TSav := TMenuItem.Create(Self); - TSav.Caption := 'TSaveDialog'; - TSav.OnClick := @ShowMessage1; - - TScre := TMenuItem.Create(Self); - TScre.Caption := 'TScreen'; - TScre.OnClick := @ShowMessage1; - - TScroBa := TMenuItem.Create(Self); - TScroBa.Caption := 'TScrollBar'; - TScroBa.OnClick := @ShowMessage1; - - TScroBo := TMenuItem.Create(Self); - TScroBo.Caption := 'TScrollBox'; - TScroBo.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TSha := TMenuItem.Create(Self); - TSha.Caption := 'TShape'; - TSha.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TSpee := TMenuItem.Create(Self); - TSpee.Caption := 'TSpeedButton'; - TSpee.OnClick := @ShowMessage1; - - TSpinB := TMenuItem.Create(Self); - TSpinB.Caption := 'TSpinButton'; - TSpinB.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TSpinE := TMenuItem.Create(Self); - TSpinE.Caption := 'TSpinEdit'; - TSpinE.OnClick := @ShowMessage1; - - TStat := TMenuItem.Create(Self); - TStat.Caption := 'TStatusBar'; - TStat.OnClick := @ShowMessage1; - - TStri := TMenuItem.Create(Self); - TStri.Caption := 'TStringGrid'; - TStri.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - QS1.Add(TRadB); - QS1.Add(TRadG); - QS1.Add(TRep); - QS1.Add(TRic); - QS1.Add(TSav); - QS1.Add(TScre); - QS1.Add(TScroBa); - QS1.Add(TScroBo); - QS1.Add(TSha); - QS1.Add(TSpee); - QS1.Add(TSpinB); - QS1.Add(TSpinE); - QS1.Add(TStat); - QS1.Add(TStri); - - TZ1 := TMenuItem.Create(Self);//++++ T - Z - TZ1.Caption := 'T - Z'; - Comps1.Add(TZ1); - - TTabN := TMenuItem.Create(Self); - TTabN.Caption := 'TTabbedNoteBook'; - TTabN.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TTabC := TMenuItem.Create(Self); - TTabC.Caption := 'TTabControl'; - TTabC.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TThre := TMenuItem.Create(Self); - TThre.Caption := 'TThread'; - TThre.OnClick := @ShowMessage1; - - TTim := TMenuItem.Create(Self); - TTim.Caption := 'TTimer'; - TTim.OnClick := @ShowMessage1; - - TTog := TMenuItem.Create(Self); - TTog.Caption := 'TToggleBox'; - TTog.OnClick := @ShowMessage1; - - TToo := TMenuItem.Create(Self); - TToo.Caption := 'TToolBar'; - TToo.OnClick := @ShowMessage1; - - TTrac := TMenuItem.Create(Self); - TTrac.Caption := 'TTrackBar'; - TTrac.OnClick := @ShowMessage1; - - TUpD := TMenuItem.Create(Self); - TUpD.Caption := 'TUpDown'; - TUpD.OnClick := @ShowMessage0; //++ Do not exist yet ++ - - TZ1.Add(TTabN); - TZ1.Add(TTabC); - TZ1.Add(TThre); - TZ1.Add(TTim); - TZ1.Add(TTog); - TZ1.Add(TToo); - TZ1.Add(TTrac); - TZ1.Add(TUpD); -//++++++++++++++++++++++++++++++++++++ Help +++++++++++++++++++++++++++++++++++++++++ - Help1 := TMenuItem.Create(Self); - Help1.Caption := '&Help'; - MainMenu1.Items.Add(Help1); - - About1 := TMenuItem.Create(Self); - About1.Caption := '&About ...'; - About1.OnClick := @ShowTestForm; - Help1.Add(About1); -end; - -procedure TForm1.CreateComponents;//++ CREATE COMPONENTS ++++++++++++++++++++++++++++ -var -i, CHLeft, CHTop : Integer; -begin -CHLeft:= 25; -CHTop := 25; -CHCount := 0; -For i:=1 to 59 do -begin - BenchForm[i] := TForm.Create(Self); - With BenchForm[i] do - Begin - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnClick := @EventOnClick; - OnDblClick := @EventOnDblClick; - OnShow := @EventOnShow; - OnClose := @TestFormClose; - OnKeyDown := @EventOnKeyDown; - OnKeyUp := @EventOnKeyUp; - ClientHeight := 254; - ClientWidth := 392; - KeyPreview := True; - Height := 300; - Width := 400; - Caption := 'TestForm '+IntToStr(i); - Color := clBtnFace; - BorderStyle := bsDialog; - Position := poScreenCenter; - Left := 100; - Top := 100; - end; -end; -BenchForm[54].KeyPreview := True; -BenchForm[19].BorderStyle := bsSizeable; -BenchForm[19].OnMouseMove := @EventOnMouseMove; -BenchForm[5].OnMouseMove := @EventOnMouseMove; -BenchForm[19].OnResize := @EventOnResize; -BenchForm[19].ActiveControl := btnKeyDown; -//BenchForm[5].Canvas.Pen.Style := psDash; -//BenchForm[5].Canvas.Brush.Style := bsCross; -//++++++++++++++++++++++++++++++++++ TBevel +++++++++++++++++++++++++++++++++++++++++ -Bevel1 := TBevel.Create(Self); - with Bevel1 do - begin - Parent := BenchForm[2]; - OnClick := @EventOnClick; - OnDblClick := @EventOnDblClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - - Align := alNone; - Cursor := crArrow; - Height := 100; - Hint := 'Bevel1'; - Left := 10; - //Name := 'Hello'; - ParentShowHint := True; - Shape := bsBox; - ShowHint := True; - Style := bsLowered; - Tag := 0; - Top := 10; - Visible := True; - Width := 100; - end; -//++++++++++++++++++++++++++++++++++ TBitBtn1 +++++++++++++++++++++++++++++++++++++++ - -BitBtn1 := TBitBtn.Create(Self); - With BitBtn1 do - begin - OnClick := @EventOnClick; - OnDblClick := @EventOnDblClick; - OnMouseEnter := @EventOnMouseEnter; - OnMouseLeave := @EventOnMouseLeave; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - //OnMouseMove := @EventOnMouseMove; - Parent := BenchForm[3]; - width := 80; - left := 10; - height := 50; - top := 13; -// ******** Delphi 5 Properties ********* - //Action - Anchors := BitBtn1.Anchors + [akTop]-[akLeft]; - //BiDiMode := bdLeftToRight; //Identifier not found - //Cancel := False; //Identifier not found - Caption := 'Glyph'; - //Constraints := BitBtn1.Constraints//Identifier not found - Cursor := crHandPoint; //No function - Default := False; //Startup error - DragCursor := crDrag; - DragKind := dkDrag; - DragMode := dmManual; - Enabled := True; //No function - //Font.Charset := DEFAULT_CHARSET; //Identifier not found - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; //No function - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := BitBtn1.Font.Style+[fsBold]; - LoadGlyphFromResourceName(hInstance,'topendialog'); - //height := 28; Has to be set before Glyph - //HelpContext := 0; Identifier not found - Hint := 'Settings for BitBtn1 >>'; - kind := bkCustom; - layout := blGlyphLeft; - //left := 10; Has to be set before Kind - //Margin := -1; Identifier not found - ModalResult := mrNone; - Name := 'BitBtn1'; - //NumGlyphs := 1; Identifier not found - //ParentBiDiMode := False; Identifier not found - ParentFont := True; - ParentShowHint := False; - PopupMenu := PopupMenu1; - ShowHint := True; - Spacing := 2; - //Style := bsAutoDetect; Identifier not found - TabOrder := 0; - TabStop := True; - Tag := 0; - //top := 10; //Could not be here ?? - Visible := True; - //width := 80; Has to be set before Height - end; -//+++++++++++++++++++++++++++++++++++++ Button ++++++++++++++++++++++++++++++++++++++ -Button1[0] := TButton.Create(Self); - With Button1[0] do - begin - Parent := BenchForm[4]; - OnClick := @EventOnClick; - OnDblClick := @EventOnDblClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - //OnMouseMove := @EventOnMouseMove; - OnMouseEnter := @EventOnMouseEnter; - OnMouseLeave := @EventOnMouseLeave; - Top := 30; - Left := 30; - Height := 25; - Width := 25; - - - //Action:=nil - // Anchors := button1.Anchors+[akLeft]; - //BiDiMode := bdLeftToRight; //Identifier not found - //Cancel := False; //Identifier not found - Caption := ' '; - //Constraints := - Cursor := crHandPoint; - Default := True; - DragCursor := crDrag; - DragKind := dkDrag; - DragMode := dmManual; - Enabled := True; - //Font.Charset := DEFAULT_CHARSET //Identifier not found; - Font.Color := clRed; - Font.Height := -11; - Font.Name := 'adventure'; - Font.Pitch := fpDefault; - Font.Size := 6; - // Font.Style := Button1.Font.Style+[fsBold]; - //Height := 26; //Has to be set before "Enabled" - //HelpContext := 0; //Identifier not found - Hint := 'Lotto'; - //Left := 10; //Has to be set before "Default" - ModalResult := mrNone; - Name := 'Button1'; - //ParentBiDiMode := False; //Identifier not found - ParentFont := False; - ParentShowHint := False; - PopupMenu := PopupMenu1; - ShowHint := True; - TabOrder := 5; - TabStop := False; - Tag := 1; - //Top := 10; //Has to be set before "Default" - Visible := True; - //Width := 75; //Found out why it has to be set earlier - end; -For i:=1 to 15 do // the array of buttons -begin -Button1[i] := TButton.Create(Self); - With Button1[i] do - begin - Parent := BenchForm[4]; - OnClick := @EventOnClick; - OnDblClick := @EventOnDblClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - //OnMouseMove := @EventOnMouseMove; - OnMouseEnter := @EventOnMouseEnter; - OnMouseLeave := @EventOnMouseLeave; - If (i>3) and (i<8) then - begin - Top := Button1[0].Top+25; - Left := Button1[i-4].Left; - End else - begin - Top := 30; - Left := Button1[i-1].Left+25; - end; - If (i>7) and (i<12) then - begin - Top := Button1[0].Top+50; - Left := Button1[i-4].Left; - End; - If i>11 then - begin - Top := Button1[0].Top+75; - Left := Button1[i-4].Left; - End; - - Height := 25; - Width := 25; - - - //Action:=nil - // Anchors := button1.Anchors+[akLeft]; - //BiDiMode := bdLeftToRight; //Identifier not found - //Cancel := False; //Identifier not found - Caption := ' '; - //Constraints := - Cursor := crHandPoint; - Default := True; - DragCursor := crDrag; - DragKind := dkDrag; - DragMode := dmManual; - Enabled := True; - //Font.Charset := DEFAULT_CHARSET //Identifier not found; - Font.Color := clRed; - Font.Height := -11; - Font.Name := 'adventure'; - Font.Pitch := fpDefault; - Font.Size := 6; - // Font.Style := Button1.Font.Style+[fsBold]; - //Height := 26; //Has to be set before "Enabled" - //HelpContext := 0; //Identifier not found - Hint := 'Lotto'; - //Left := 10; //Has to be set before "Default" - ModalResult := mrNone; - //Name := 'Lotto'; - //ParentBiDiMode := False; //Identifier not found - ParentFont := False; - ParentShowHint := False; - PopupMenu := PopupMenu1; - ShowHint := True; - TabOrder := 5; - TabStop := False; - Tag := i+1; - //Top := 10; //Has to be set before "Default" - Visible := True; - //Width := 75; //Found out why it has to be set earlier -end; -end; -//+++++++++++++++++++++++++++++++++++++ TCheckBox +++++++++++++++++++++++++++++++++++ -For i:=1 to 35 do -Begin -CheckBox1[i] := TCheckBox.Create(Self); - with CheckBox1[i] do - begin - OnClick := @EventOnClick; - OnDblClick := @EventOnDblClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - //OnMouseMove := @EventOnMouseMove; - Parent := BenchForm[6]; - - //Action - //Alignment := taRigthJustify; - AllowGrayed := True; - Anchors := CheckBox1[i].Anchors + [akTop, akLeft]; - //BiDiMode := bdLeftToRight; - Caption := IntToStr(i); - Checked := False; - Color := clBlue; - //Constraints - Cursor := crDefault; //Error if not crDefault - DragCursor := crDrag; - DragKind := dkDrag; - DragMode := dmManual; - Enabled := True; - //Font.Charset := DEFAULT_CHARSET //Identifier not found; - Font.Color := clRed; - Font.Height := -11; - Font.Name := 'adventure'; - Font.Pitch := fpDefault; - Font.Size := 6; - Font.Style := CheckBox1[i].Font.Style+[fsBold]; - Height := 20; - //HelpContext := 0; - Hint := 'Maybe this one'; - Left := CHLeft; - Name := 'CheckBox1'+IntToStr(i); - //ParentBiDiMode := False; - ParentColor := True; - ParentFont := False; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowHint := True; - State := cbUnchecked; - TabOrder := 10; - Tag := 0; - Top := CHTop; - Visible := True; - Width := 35; - end; - CHLeft:=CHLeft+35; - If (i = 5) or (i = 10) or (i = 15) or (i = 20) or (i = 25) or (i = 30) then - begin - CHLeft:= 25; - CHTop:= CHTop + 20; - end; -RandCH := 0; -While RandCH < 1 do - RandCH := Random(35); -end; -//+++++++++++++++++++++++++++++++++++++ Clipboard1 ++++++++++++++++++++++++++++++++++ -//ClipBoard1 := TClipBoard.Create; //BenchForm[7] Donīt know how to use !?! -//+++++++++++++++++++++++++++++++++++++ CListBox1 +++++++++++++++++++++++++++++++++++ - -//+++++++++++++++++++++++++++++++++++++ ColorDialog1 ++++++++++++++++++++++++++++++++ -ColorDialog1 := TColorDialog.Create(Self); //BenchForm[9] -//+++++++++++++++++++++++++++++++++++++ ComboBox1 +++++++++++++++++++++++++++++++++++ -ComboBox1 := TComboBox.Create(Self); - with ComboBox1 do - begin - Parent := BenchForm[10]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - OnChange := @EventOnChange; - - Anchors := ComboBox1.Anchors + [akTop,akLeft]; - //BiDiMode := bdLeftToRight; //Identifier no found - Color := clRed; - //Constraints := //Identifier no found - Cursor := crDefault; //Only crDefault - DragCursor := crDrag; - DragKind := dkDrag; - DragMode := dmManual; - //DropDownCount := 8; - Enabled := True; - //Font.Charset := DEFAULT_CHARSET; //Identifier not found - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; //No function - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := ComboBox1.Font.Style+[fsItalic]; - Height := 32; - //HelpContext := 0; //Identifier not found - Hint := 'Components'; //Don't work... - //ImeMode := imDontCare; - //ImeName - //IntegralHeight := True; - //ItemHeight := 13; - Items.Add('HELLO'); - Items.Add('DOCTOR'); - Items.Add('YESTERDAY'); - Items.Add('TOMORROW'); - Items.Add('MY GOD!'); - Items.Add('ITīS FULL OF STARS !!'); - Items.Add('HAL9000 : ERROR'); - Left := 10; - Name := 'ComboBox1'; - //ParentBiDiMode := True; //Identifier not found - ParentColor := False; - ParentFont := True; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowHint := True; //Don't work... - Sorted := False; //If true Access violation - Style := csDropDown; - TabOrder := 0; - TabStop := False; - Tag := 9; - Text := 'Hello there !!'; - Top := 10; - Visible := True; - Width := 160; - end; -//+++++++++++++++++++++++++++++++++++++ DirectoryListBox1 +++++++++++++++++++++++++++ -{DirectoryListBox1 := TDirectoryListBox.Create(Self); - With DirectoryListBox1 do - begin - Parent := BenchForm[11]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - - Align := alNone; - //BiDiMode := bdLeftToRight; - Color := clRed; - //Columns := 0; - //Constraints := - //Ctl3D := True; - Cursor := crDefault; - //DirLabel := - DragCursor := crDrag; - DragMode := dmManual; - Enabled := True; - //FileList := - //Font.Charset := DEFAULT_CHARSET; - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := ListBox1.Font.Style+[fsItalic]; - Height := 196; - //HelpContext := 0; - Hint := 'DirectoryListBox1'; - //ImeMode := imDontCare; - //ImeName - //IntegralHeight := True; - //ItemHeight := 13; - Left := 10; - MultiSelect := True; - Name := 'DirectoryListBox1'; - //ParentBiDiMode := True; - ParentColor := False; - //ParnetCtl3D := True; - ParentFont := True; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowHint := True; - TabOrder := 0; - TabStop := False; - Tag := 9; - Top := 35; - Visible := True; - Width := 150; - end;} -//+++++++++++++++++++++++++++++++++++++ DrawGrid1 +++++++++++++++++++++++++++++++++++ -{DrawGrid1 := TDrawGrid.Create(Self); - With DrawGrid1 do - begin - Parent := BenchForm[12]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - - Align := alNone; - //BiDiMode := bdLeftToRight; - BorderStyle := bsSingle; - ColCount := 5; - Color := clWindow; - //Ctl3D := True; - Cursor := crDefault; - DefaultColWidth := 64; - DefaultDrawing := True; - DefaultRowHeight := 24; - DragCursor := crDrag; - DragMode := dmManual; - Enabled := True; - FixedColor := clBtnFace; - FixedCols := 1; - FixedRows := 1; - //Font.Charset := DEFAULT_CHARSET; - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := DrawGrid1.Font.Style+[fsItalic]; - GridLineWidth := 1; - Height := 196; - //HelpContext := 0; - Hint := 'DrawGrid1'; - Left := 10; - Name := 'DrawGrid1'; - //Options - ParentColor := False; - //ParentCtl3D := True; - ParentFont := True; - ParentShowHint := True; - PopupMenu := PopupMenu1; - RowCount := 5; - ScrollBars := ssBoth; - ShowHint := True; - TabOrder := 0; - TabStop := False; - Tag := 9; - Top := 10; - Visible := True; - Width := 300; - end;} -//+++++++++++++++++++++++++++++++++++++ DriveComboBox1 +++++++++++++++++++++++++++++++ -{DriveComboBox1 := TDriveComboBox.Create(Self); - with DriveComboBox1 do - begin - Parent := BenchForm[13]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - OnChange := @EventOnChange; - - //BiDiMode := bdLeftToRight; - Color := clWindow; - //Ctl3D := True; - //Constraints := - Cursor := crDefault; - //DirList := - DragCursor := crDrag; - DragMode := dmManual; - Enabled := True; - //Font.Charset := DEFAULT_CHARSET; - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := DriveComboBox1.Font.Style+[fsItalic]; - Height := 32; - //HelpContext := 0; - Hint := 'DriveComboBox1'; - //ImeMode := imDontCare; - //ImeName - Left := 10; - Name := 'DriveComboBox1'; - //ParentBiDiMode := True; - ParentColor := False; - //ParenCtl3D := True; - ParentFont := True; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowHint := True; - TabOrder := 0; - TabStop := False; - Tag := 9; - TextCase := tcLowerCase; - Top := 10; - Visible := True; - Width := 160; - end;} -//+++++++++++++++++++++++++++++++++++++ Edit1 +++++++++++++++++++++++++++++++++++++++ -Edit1 := TEdit.Create(Self); - With Edit1 do - begin - Parent := BenchForm[14]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - //OnMouseMove := @EventOnMouseMove; - OnKeyDown := @EventOnKeyDown; - - //AutoSelect := True; - AutoSize := True; - BorderStyle := bsSingle; - //CharCase := ecNormal; - Color := clRed; - //Ctl3D := True; - Cursor := crDefault; - DragCursor := crDrag; - DragMode := dmManual; - Enabled := True; - //Font.Charset := DEFAULT_CHARSET; - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := Edit1.Font.Style+[fsItalic]; - Height := 21; - //HelpContext := 0; - Hint := 'Edit1'; - //ImeMode := imDontCare; - //ImeName - Left := 10; - //MaxLength := 0; - Name := 'Edit1'; - //OEMConvert := False; - ParentColor := False; - ParentFont := True; - ParentShowHint := True; - //PasswordChar := #0; - PopupMenu := PopupMenu1; - ReadOnly := False; - ShowHint := True; - TabOrder := 0; - TabStop := False; - Tag := 9; - Top := 10; - Visible := True; - Width := 150; - end; -//+++++++++++++++++++++++++++++++++++++ FileListBox1 ++++++++++++++++++++++++++++++++ -{FileListBox1 := TFileListBox.Create(Self); - With FileListBox1 do - begin - Parent := BenchForm[15]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - - Align := alNone; - Anchors := FileListBox1.Anchors + [akTop,akLeft]; - BorderStyle := bsSingle; - Color := clWindow; - //Ctl3D := True; - Cursor := crDefault; - DragCursor := crDrag; - DragMode := dmManual; - Enabled := True; - ExtendedSelect := True; - FileEdit := Edit1; - FileType := FileListBox1.FileType + [ftNormal]; - Font.Charset := DEFAULT_CHARSET; - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := FileListBox1.Font.Style+[fsItalic]; - Height := 196; - HelpContext := 0; - Hint := 'FileListBox1'; - ImeMode := imDontCare; - ImeName - IntegralHeight := True; - ItemHeight := 13; - Left := 10; - Mask := '*.*'; - MultiSelect := True; - Name := 'FileListBox1'; - ParentColor := False; - //ParentCtl3D := True; - ParentFont := True; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowGlyphs := True; - ShowHint := True; - TabOrder := 0; - TabStop := False; - Tag := 9; - Top := 10; - Visible := True; - Width := 150; - end;} -//+++++++++++++++++++++++++++++++++++++ FilterComboBox1 +++++++++++++++++++++++++++++ -{FilterComboBox1 := TFilterComboBox.Create(Self); - with FilterComboBox1 do - begin - Parent := BenchForm[16]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - OnChange := @EventOnChange; - - Color := clWindow; - //Ctl3D := True; - Cursor := crDefault; - DragCursor := crDrag; - DragMode := dmManual; - Enabled := True; - FileList := FileListBox1; - Filter := 'All Files(*.*)|*.*'; - Font.Charset := DEFAULT_CHARSET; - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := FilterComboBox1.Font.Style+[fsItalic]; - Height := 32; - HelpContext := 0; - Hint := 'FilterDriveComboBox1'; - ImeMode := imDontCare; - ImeName - Left := 10; - Name := 'FilterComboBox1'; - ParentColor := False; - //ParenCtl3D := True; - ParentFont := True; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowHint := True; - TabOrder := 0; - TabStop := False; - Tag := 9; - TextCase := tcLowerCase; - Top := 10; - Visible := True; - Width := 160; - end;} -//+++++++++++++++++++++++++++++++++++++ FindDialog1 +++++++++++++++++++++++++++++++++ -//FindDialog1 := TFindDialog.Create(Self); //BenchForm[17] -//+++++++++++++++++++++++++++++++++++++ FontDialog1 +++++++++++++++++++++++++++++++++ -FontDialog1 := TFontDialog.Create(Self); //BenchForm[18] -//+++++++++++++++++++++++++++++++++++++ Form1 +++++++++++++++++++++++++++++++++++++++ -// Allready created !! BenchForm[19] -//+++++++++++++++++++++++++++++++++++++ GroupBox1 +++++++++++++++++++++++++++++++++++ -GroupBox1 := TGroupBox.Create(Self); - with GroupBox1 do - begin - Parent := BenchForm[20]; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - Left := 10; - Top := 10; - Width := 300; - Height := 150; - //Ctl3D := False; - Caption := 'GroupBox1'; - Visible := True; - end; -//++++++++++++++++++++++++++++++++++++++ Image1 +++++++++++++++++++++++++++++++++++++ -{Image1 := TImage.Create(Self); - With Image1 do - begin - Parent := BenchForm[21]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - - Align := alNone; - Anchors := Image1.Anchors + [akTop,akLeft]; - AutoSize := True; - Center := False; - Cursor := crDefault; - DragCursor := crDrag; - DragMode := dmManual; - Enabled := True; - Height := 196; - Hint := 'Image1'; - IncrementalDisplay := True; - Left := 10; - Name := 'Image1'; - ParentShowHint := True; - Picture := '../images/penguin.xpm'; - PopupMenu := PopupMenu1; - ShowHint := True; - Stretch := False; - Tag := 21; - Top := 10; - Transparent := False; - Visible := True; - Width := 150; - end;} -//++++++++++++++++++++++++++++++++++++++ Inifile1 +++++++++++++++++++++++++++++++++++ -IniFile1 := TIniFile.Create('./Settings.laz'); //BenchForm[22] -//++++++++++++++++++++++++++++++++++++++ Label1 +++++++++++++++++++++++++++++++++++++ -Label1 := TLabel.Create(Self); - With Label1 do - begin - Parent := BenchForm[23]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - Top := 10; - Left := 10; - - Align := alNone; - Alignment := taLeftJustify; - AutoSize := False; - Caption := 'Label1'; - Color := clBtnFace; - Cursor := crDefault; - DragCursor := crDrag; - DragMode := dmManual; - Enabled := True; - //FocusControl := nil; - //Font.Charset := DEFAULT_CHARSET; - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := Label1.Font.Style+[fsItalic]; - Height := 100; - Hint := 'Label1'; - Layout := tlTop; - //Left := 10; //Has to be set before Layout - Name := 'Label1'; - ParentColor := False; - ParentFont := True; - ParentShowHint := True; - PopupMenu := PopupMenu1; - //ShowAccelChar := True; - ShowHint := True; - Tag := 0; - //Top := 10; //Has to be set before Layout - //Transparent := False; - Visible := True; - Width := 150; - WordWrap := False; - end; -//++++++++++++++++++++++++++++++++++++++ ListBox1, ListBox2 +++++++++++++++++++++++++ -ListBox1 := TListBox.Create(Self); - With ListBox1 do - begin - Parent := BenchForm[24]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - - Align := alNone; - Anchors := ListBox1.Anchors + [akTop,akLeft]; - //BiDiMode := bdLeftToRight; //Identifier no found - BorderStyle := bsSingle; - Color := clRed; - //Columns := 0; //Identifier no found - //Ctl3D := False; - //Constraints := //Identifier no found - Cursor := crDefault; //Only crDefault - DragCursor := crDrag; - DragKind := dkDrag; - DragMode := dmManual; - Enabled := True; - ExtendedSelect := True; - //Font.Charset := DEFAULT_CHARSET; //Identifier not found - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; //No function - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := ListBox1.Font.Style+[fsItalic]; - Height := 148; - //HelpContext := 0; //Identifier not found - Hint := 'Components'; //Don't work... - //ImeMode := imDontCare; - //ImeName - //IntegralHeight := True; - //ItemHeight := 13; - Items.Add('BitBtn'); - Items.Add('Button'); - Items.Add('CheckBox'); - Items.Add('ColorDialog'); - Items.Add('ComboBox'); - Items.Add('Edit'); - Items.Add('Form'); - Items.Add('FontDialog'); - Items.Add('IniFile'); - Items.Add('Label'); - Items.Add('ListBox'); - Items.Add('MainMenu'); - Items.Add('Memo'); - Items.Add('NoteBook'); - Items.Add('OpenDialog'); - Items.Add('ProgressBar'); - Items.Add('RadioButton'); - Items.Add('RadioGroup'); - Items.Add('SaveDialog'); - Items.Add('SpeedButton'); - Left := 10; - MultiSelect := True; - Name := 'ListBox1'; - //ParentBiDiMode := True; //Identifier not found - ParentColor := False; - //ParentCtl3D := True; - ParentFont := True; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowHint := True; //Don't work... - Sorted := False; //If true Access violation - Style := lbStandard; - TabOrder := 0; - TabStop := False; - Tag := 9; - Top := 35; - Visible := True; - Width := 150; - end; - -ListBox2 := TListBox.Create(Self); - With ListBox2 do - begin - Parent := BenchForm[24]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - //OnMouseUp := @MUp; - - Anchors := ListBox2.Anchors + [akTop,akLeft]; - BorderStyle := bsSingle; - Color := clRed; - Cursor := crDefault; //Only crDefault - DragCursor := crDrag; - DragKind := dkDrag; - DragMode := dmManual; - Enabled := True; - ExtendedSelect := True; - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; //No function - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := ListBox2.Font.Style+[fsItalic]; - Height := 148; - Hint := 'Components'; //Don't work... - Left := 235; - MultiSelect := True; - Name := 'ListBox2'; - ParentColor := False; - ParentFont := True; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowHint := True; //Don't work... - Sorted := False; //If true Access violation - Style := lbStandard; - TabOrder := 0; - TabStop := False; - Tag := 9; - Top := 35; - Visible := True; - Width := 150; - end; -//+++++++++++++++++++++++++++++++++++++ MainMenu1 +++++++++++++++++++++++++++++++++++ -// Created in own procedure -//+++++++++++++++++++++++++++++++++++++ MaskEdit1 +++++++++++++++++++++++++++++++++++ -{MaskEdit1 := TMaskEdit.Create(Self); - With MaskEdit1 do - begin - Parent := BenchForm[25]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - - AutoSelect := True; - AutoSize := True; - BorderStyle := bsSingle; - CharCase := ecNormal; - Color := clWindow; - //Ctl3D := True; - Cursor := crDefault; - DragCursor := crDrag; - DragMode := dmManual; - EditMask - Enabled := True; - Font.Charset := DEFAULT_CHARSET; - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := MaskEdit1.Font.Style+[fsItalic]; - Height := 21; - HelpContext := 0; - Hint := 'MaskEdit1'; - ImeMode := imDontCare; - ImeName - Left := 10; - MaxLength := 0; - Name := 'MasEdit1'; - ParentColor := False; - //ParentCtl3D := True; - ParentFont := True; - ParentShowHint := True; - PasswordChar := #0; - PopupMenu := PopupMenu1; - ReadOnly := False; - ShowHint := True; - TabOrder := 0; - TabStop := False; - Tag := 9; - Text := 'MaskEdit1'; - Top := 10; - Visible := True; - Width := 150; - end;} -//+++++++++++++++++++++++++++++++++++++ MediaPlayer1 ++++++++++++++++++++++++++++++++ -{MediaPlayer1 := TMediaPlayer.Create(Self); - With MediaPlayer1 do - begin - Parent := BenchForm[26]; - - AutoEnable := True; - AutoOpen := False; - AutoRewind := True; - ColoredButtons := ColoredButtons + [btPlay, btStop]; - Cursor := crDefault; - DeviceType := dtAutoSelect; - Display := MediaPlayer1; - Enabled := True; - EnabledButtons := EnabledButtons + [btPlay, btStop]; - FileName := ''; - Height := 30; - HelpContext := 0; - Hint := 'MediaPlayer1'; - Left := 10; - Name := 'MediaPlayer1'; - ParentShowHint := True; - PopupMenu := PopupMenu1; - Shareable := False; - ShowHint := True; - TabOrder := 0; - TabStop := False; - Tag := 0; - Top := 10; - Visible := True; - VisibleButtons := VisibleButtons + [btPlay, btStop]; - Width := 57; - end;} -//+++++++++++++++++++++++++++++++++++++ Memo1 +++++++++++++++++++++++++++++++++++++++ -Memo1 := TMemo.Create(Self); - With Memo1 do - begin - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnChange := @EventOnChange; - Parent := Self; - - Align := alNone; - Anchors := Memo1.Anchors + [akLeft,akTop]; - //Alignment := taLeftJustify; - BorderStyle := bsSingle; - Color := clYellow; - //Ctl3D := False; - Cursor := crDefault; - DragCursor := crDrag; - DragMode := dmManual; - Enabled := True; - Font.Color := clBlue; - Font.Height := -11; - Font.Name := 'avantgarde'; //No function - Font.Pitch := fpDefault; - Font.Size := 10; - Font.Style := Memo1.Font.Style+[fsBold]; - Height := 200; - //HelpContext := 0; - //HideSelection := True; - Hint := 'Memo Component'; - //ImeMode := imDontCare; - //ImeName - Left := 10; - Lines.Text := #13#10+' WELCOME'+#13#10+ - 'You will find the component you want to test in the MainMenu'+ - ' "Components". 60 components are mentioned, but all do not exist yet.'+ - ' I hope this application will be useful...'+#13#10+'Chris'; - //MaxLength := 0; - Name := 'Memo1'; - //OEMConvert := False; - ParentColor := False; - //ParentCtl3D := False; - ParentFont := False; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ReadOnly := False; - ScrollBars := ssBoth; - ShowHint := True; - TabOrder := 0; - TabStop := False; - Tag := 0; - Top := 53; - Visible := True; - //WantReturns := True; - //WantTabs := False; - Width := 380; - WordWrap := True; - end; -//++++++++++++++++++++++++++++++++++++ MessageDialog1 +++++++++++++++++++++++++++++++ -//MessageDialog := TMessageDialog.Create(Self); -//++++++++++++++++++++++++++++++++++++ TNoteBook ++++++++++++++++++++++++++++++++++++ -{NoteBook1 := TNoteBook.Create(Self); // TODO : Add all properties - With NoteBook1 do - begin - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - Parent := BenchForm[29]; - Height := 190; - Left := 10; - Top := 10; - Width := 377; - Name := 'NoteBook1'; - Align := alNone; - if PageCount>0 then - Pages.Strings[0] := 'Page0' //Page 0 - else - Pages.Add('Page0'); - Pages.Add('Page1'); - Pages.Add('Page2'); - Pages.Add('Page3'); - PageIndex := 0; - PopupMenu := PopupMenu1; - Hint := 'NoteBook1'; - ShowHint := True; - Show; - end;} -//++++++++++++++++++++++++++++++++++++ OpenDialog1 ++++++++++++++++++++++++++++++++++ -OpenDialog1 := TOpenDialog.Create(Self); -//++++++++++++++++++++++++++++++++++++ PageControl ++++++++++++++++++++++++++++++++++ -PageControl1 := TPageControl.Create(Self); - with PageControl1 do - begin - OnClick := @EventOnClick; - OnDblClick := @EventOnDblClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - Parent := BenchForm[31]; - - Align := alNone; - Cursor := crDefault; - DragCursor := crDrag; - DragMode := dmManual; - Enabled := True; - //Font.Charset := DEFAULT_CHARSET //Identifier not found; - Font.Color := clRed; - Font.Height := -11; - Font.Name := 'adventure'; - Font.Pitch := fpDefault; - Font.Size := 6; - Font.Style := PageControl1.Font.Style+[fsBold]; - Height := 200; - HelpContext := 0; - Hint := 'PageControl1'; - Left := 10; - MultiLine := False; - Name := 'PageControl1'; - ParentFont := False; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowHint := True; - TabOrder := 0; - TabPosition := tpTop; - TabStop := True; - Tag := 0; - Top := 10; - Visible := True; - Width := 300; - for i:=1 to 3 do - with TTabSheet.Create(PageControl1) do - begin - PageControl := PageControl1; - Caption := 'TabSheet'+IntToStr(i); - end; - end; - -//++++++++++++++++++++++++++++++++++++ PaintBox1 ++++++++++++++++++++++++++++++++++++ -PaintBox1 := TPaintBox.Create(Self); //Gives Access violation !!! - with PaintBox1 do - begin - OnClick := @EventOnClick; - OnDblClick := @EventOnDblClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - Parent := BenchForm[32]; - - Align := alNone; - Color := clBlue; - Cursor := crDefault; - DragCursor := crDrag; - DragMode := dmManual; - Enabled := True; - //Font.Charset := DEFAULT_CHARSET //Identifier not found; - Font.Color := clRed; - Font.Height := -11; - Font.Name := 'adventure'; - Font.Pitch := fpDefault; - Font.Size := 6; - Font.Style := PaintBox1.Font.Style+[fsBold]; - Height := 100; - Hint := 'PaintBox1'; - Left := 10; - Name := 'PaintBox1'; - ParentColor := True; - ParentFont := False; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowHint := True; - Tag := 0; - Top := 10; - Visible := True; - Width := 100; - end; -//++++++++++++++++++++++++++++++++++++ Panel1 +++++++++++++++++++++++++++++++++++++++ -benchform[33].width := 550; -Panel1 := TPanel.Create (Form1); - with Panel1 do - begin - Parent := BenchForm[33]; - PanelNormClick (self); - end; -Panel2 := TPanel.Create (Form1); - with Panel2 do - begin - Parent := BenchForm[33]; - Align := alBottom; - Height := 150; - //Ctl3D := False; - Caption := 'Panel1'; - Visible := True; - end; -//++++++++++++++++++++++++++++++++++++ PopupMenu1 +++++++++++++++++++++++++++++++++++ -Hello := TMenuItem.Create(PopupMenu1); -Hello.Caption := 'Hello'; -Doctor := TMenuItem.Create(Hello); -Doctor.Caption := 'Doctor'; -Hello.Add(Doctor); - -PopupMenu1 := TPopupMenu.Create(Form1); - with PopupMenu1 do - begin - Parent := Form1; - //Alignment := paLeft; - AutoPopup := True; - //HelpContext := 0; - Items.Add(Hello); - Name := 'PopupMenu1'; - Tag := 0; - end; -//++++++++++++++++++++++++++++++++++++ PrintDialog1 +++++++++++++++++++++++++++++++++ -//PrintDialog1 := TPrintDialog.Create(Self); //BenchForm[35] -//++++++++++++++++++++++++++++++++++++ PrinterSetupDialog1 ++++++++++++++++++++++++++ -//PrinterSetupDialog1 := TPrinterSetupDialog.Create(Self); //BenchForm[36] -//++++++++++++++++++++++++++++++++++++ ProgressBar1 +++++++++++++++++++++++++++++++++ -ProgressBar1 := TProgressBar.Create(Self); - with ProgressBar1 do - begin - Parent := BenchForm[37]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - BarShowText := False; - Top := 28; - Left := 10; - Height := 100; - Width := 200; - Min := 0; - Max := 100; - Name := 'ProgressBar1'; - Smooth := True; - Orientation := pbHorizontal; - Position := 0; - PopupMenu := PopupMenu1; - Enabled := True; - Hint := 'ProgressBar1'; - ShowHint := True; - Visible := True; - end; -//++++++++++++++++++++++++++++++++++++ RadioButton1 +++++++++++++++++++++++++++++++++ -RadioButton1 := TRadioButton.Create(Self); - with RadioButton1 do - begin - OnClick := @EventOnClick; - OnDblClick := @EventOnDblClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - Parent := BenchForm[38]; - - //Alignment := taRigthJustify; //Identifier no found - AllowGrayed := True; - Anchors := RadioButton1.Anchors + [akTop, akLeft]; - //BiDiMode := bdLeftToRight; - Caption := 'RadioButton1'; - Checked := False; - Color := clBlue; - //Constraints - Cursor := crDefault; //Error if not crDefault - DragCursor := crDrag; - DragKind := dkDrag; - DragMode := dmManual; - Enabled := True; - //Font.Charset := DEFAULT_CHARSET //Identifier not found; - Font.Color := clRed; - Font.Height := -11; - Font.Name := 'adventure'; - Font.Pitch := fpDefault; - Font.Size := 6; - Font.Style := RadioButton1.Font.Style+[fsBold]; - Height := 20; - //HelpContext := 0; - Hint := 'RadioButton1'; - Left := 10; - Name := 'RadioButton1'; - //ParentBiDiMode := False; - ParentColor := True; - ParentFont := False; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowHint := True; - State := cbUnchecked; - TabOrder := 10; - Tag := 0; - Top := 10; - Visible := True; - Width := 100; - end; -//++++++++++++++++++++++++++++++++++++ RadioGroup1 ++++++++++++++++++++++++++++++++++ -RadioGroup1 := TRadioGroup.Create(Self); - with RadioGroup1 do - begin - Parent := BenchForm[39]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - top := 20; - left := 20; - Height := 200; - Width := 140; - Columns := 3; - Items.Add ('0'); - Items.Add ('1'); - Items.Add ('2'); - Items.Add ('3'); - Items.Add ('4'); - Items.Add ('5'); - Items.Add ('6'); - Items.Add ('7'); - Items.Add ('8'); - ItemIndex := 0; - Show; - Caption := ' Radio '+IntToStr(ItemIndex)+' Checked'; - end; -//++++++++++++++++++++++++++++++++++++ ReplaceDialog1 +++++++++++++++++++++++++++++++ -//ReplaceDialog1 := TReplaceDialog.Create(Self); //BenchForm[40] -//++++++++++++++++++++++++++++++++++++ RichEdit1 ++++++++++++++++++++++++++++++++++++ - -//++++++++++++++++++++++++++++++++++++ SaveDialog1 ++++++++++++++++++++++++++++++++++ -SaveDialog1 := TSaveDialog.Create(Self); //BenchForm[42] -//++++++++++++++++++++++++++++++++++++ Screen +++++++++++++++++++++++++++++++++++++++ -// Created in TForm... -//++++++++++++++++++++++++++++++++++++ ScrollBar1 +++++++++++++++++++++++++++++++++++ -ScrollBar1 := TScrollBar.Create(Self); - with ScrollBar1 do - begin - Parent := BenchForm[44]; - //OnMouseDown := @MDown; - //OnMouseMove := @MMove; - OnMouseMove := @EventOnMouseMove; - - //Ctl3D := False; - Cursor := crDefault; - DragCursor := crDrag; - DragMode := dmManual; - Enabled := true; - Height := 16; - //HelpContext := 0; - Hint := 'ScrollBar1'; - //Kind := sbHorizontal; - //LargeChange := 1; - Left := 10; - //Max := 100; - //Min := 0; - Name := 'ScrollBar1'; - //ParentCtl3D := True; - ParentShowHint := True; - PopupMenu := PopupMenu1; - //Position := 0; - //ScrollStyle := ssHorizontal; - ShowHint := True; - //SmallChange := 1; - TabOrder := 0; - TabStop := False; - Tag := 0; - Top := 28; - Visible := True; - width := 150; - end; -//++++++++++++++++++++++++++++++++++++ Shape1 +++++++++++++++++++++++++++++++++++++++ -{Shape1 := TShape.Create(Self); - with Shape1 do - begin - Parent := BenchForm[46]; - Pen.Color := clBlue; - Left := 10; - Top := 10; - Visible := True; - end;} -//++++++++++++++++++++++++++++++++++++ SpeedButton1..4 ++++++++++++++++++++++++++++++ -SpeedButton1 := TSpeedButton.Create(Self); - With SpeedButton1 do - begin - OnClick := @OpenMemo; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - - Parent := Self; - Enabled := True; - Cursor := crDefault; - Left := 10; - Top := 28; - Flat := False; - Hint := 'SpeedButton1'; - Color := clBtnFace; - ShowHint := True; - LoadGlyphFromResourceName(hInstance,'laz_open'); - Visible := True; - end; - - -SpeedButton2 := TSpeedButton.Create(Self); - With SpeedButton2 do - begin - OnClick := @SaveMemoAs; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - - Parent := Self; - Left := 35; - Top := 28; - Flat := False; - Hint := 'SpeedButton2'; - Color := clBtnFace; - ShowHint := True; - LoadGlyphFromResourceName(hInstance,'laz_save'); - Enabled := True; - Visible := True; - end; - -SpeedButton3 := TSpeedButton.Create(Self); - With SpeedButton3 do - begin - OnClick := @SelectFont; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - - Parent := Self; - Left := 60; - Top := 28; - Flat := False; - Hint := 'SpeedButton3'; - Color := clBtnFace; - ShowHint := True; - LoadGlyphFromResourceName(hInstance,'item_font'); - Enabled := True; - Visible := True; - end; - -SpeedButton4 := TSpeedButton.Create(Self); - With SpeedButton4 do - begin - OnClick := @ColorSelect; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - - Parent := Self; - Left := 85; - Top := 28; - Flat := False; - Hint := 'SpeedButton4'; - Color := clBtnFace; - ShowHint := True; - LoadGlyphFromResourceName(hInstance,'tcolordialog'); - Enabled := True; - Visible := True; - end; - -//++++++++++++++++++++++++++++++++++++ SpinButton1 ++++++++++++++++++++++++++++++++++ - -//++++++++++++++++++++++++++++++++++++ SpinEdit1 ++++++++++++++++++++++++++++++++++++ -SpinEdit1 := TSpinEdit.Create(Self); - with SpinEdit1 do - begin - Parent := BenchForm[49]; - //OnChange := @EventOnChange; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - //MaxValue := 10; - //MinValue := 1; - Top := 30; - Left := 10; - Width := 50; - Height := 20; - Value := 50; - Visible := True; - end; -//++++++++++++++++++++++++++++++++++++ StatusBar1 +++++++++++++++++++++++++++++++++++ -StatusBar1 := TStatusBar.Create(Self); - with StatusBar1 do - begin - Parent := BenchForm[50]; - OnClick := @EventOnClick; - - Align := alBottom; - Cursor := crDefault; - DragCursor := crDrag; - DragMode := dmManual; - Enabled := True; - //Font.Charset := DEFAULT_CHARSET //Identifier not found; - Font.Color := clRed; - Font.Height := -11; - Font.Name := 'adventure'; - Font.Pitch := fpDefault; - Font.Size := 6; - Font.Style := StatusBar1.Font.Style+[fsBold]; - Height := 19; - //HelpContext := 0; - Hint := 'You !'; - Left := 0; - Name := 'StatusBar1'; - //Panels - //ParentBiDiMode := False; - ParentColor := True; - ParentFont := False; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowHint := True; - //SimpelPanel := True; - SimpleText := 'Hello'; - //SizeGrip := False; - Tag := 0; - Top := 254; - Visible := True; - Width := 392; - end; -//++++++++++++++++++++++++++++++++++++ StringGrid1 ++++++++++++++++++++++++++++++++++ - -//++++++++++++++++++++++++++++++++++++ TabbedNoteBook1 ++++++++++++++++++++++++++++++ - -//++++++++++++++++++++++++++++++++++++ TabControl1 ++++++++++++++++++++++++++++++++++ - -//++++++++++++++++++++++++++++++++++++ Thread1 ++++++++++++++++++++++++++++++++++++++ - -//++++++++++++++++++++++++++++++++++++ Timer1 +++++++++++++++++++++++++++++++++++++++ -Timer1 := TTimer.Create(Self); - with Timer1 do - begin - OnTimer := @Timer1OnTimer; - Enabled := False; - Interval := 100; - end; -//++++++++++++++++++++++++++++++++++++ ToggleBox1 +++++++++++++++++++++++++++++++++++ -ToggleBox1 := TToggleBox.Create(Self); - with ToggleBox1 do - begin - Parent := BenchForm[56]; - OnClick := @EventOnClick; - OnDblClick := @EventOnDblClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - OnMouseMove := @EventOnMouseMove; - - //Action - //Alignment := taRigthJustify; - AllowGrayed := True; - Anchors := ToggleBox1.Anchors + [akTop, akLeft]; - //BiDiMode := bdLeftToRight; - Caption := 'Hello'; - Checked := False; - Color := clBlue; - //Constraints - Cursor := crDefault; //Error if not crDefault - DragCursor := crDrag; - DragKind := dkDrag; - DragMode := dmManual; - Enabled := True; - //Font.Charset := DEFAULT_CHARSET //Identifier not found; - Font.Color := clRed; - Font.Height := -11; - Font.Name := 'adventure'; - Font.Pitch := fpDefault; - Font.Size := 6; - Font.Style := ToggleBox1.Font.Style+[fsBold]; - Height := 35; - //HelpContext := 0; - Hint := 'Maybe this one'; - Left := 10; - Name := 'ToggleBox1'; - //ParentBiDiMode := False; - ParentColor := True; - ParentFont := False; - ParentShowHint := True; - PopupMenu := PopupMenu1; - ShowHint := True; - State := cbUnchecked; - TabOrder := 0; - Tag := 0; - Top := 10; - Visible := True; - Width := 50; - end; -//++++++++++++++++++++++++++++++++++++ ToolBar1/ToolButton1..2 ++++++++++++++++++++++ -ToolBar1 := TToolBar.Create(Self); - with ToolBar1 do - begin - Parent := BenchForm[57]; - Show; - end; -if Assigned(Toolbar1) then -begin -{ToolButton1 := TToolButton.Create(ToolBar1); - with ToolButton1 do - begin - parent := ToolBar1; - OnClick := @EventOnClick; - Caption := '1'; - Hint := 'ToolButton1'; - ShowHint := True; - Show; - end;} -//ToolButton2 := TToolButton.Create(ToolBar1); - //with ToolButton2 do - //begin - // DebugLn('Trace:SETTING PARENT'); - // parent := ToolBar1; - // OnClick := @EventOnClick; - //Show; - //end; -end; -//++++++++++++++++++++++++++++++++++++ TrackBar1..2 +++++++++++++++++++++++++++++++++ -TrackBar1 := TTrackBar.Create(Self); - with TrackBar1 do - begin - //OnChange := @TrackBarChange; - //OnClick := @WhenClick; - //OnMouseDown := @MDown; - //OnMouseUp := @MUp; - Parent := BenchForm[58]; - Top := 10; - Left := 20; - Height := 220; - Orientation := trVertical; - Position := 1; - Max := 204; - Min := 1; - Width := 15; - Name := 'TrackBar1'; - PopupMenu := PopupMenu1; - ScalePos := trTop; - TickMarks := tmBoth; - TickStyle := tsAuto; - Visible := True; - end; -TrackBar2 := TTrackBar.Create(Self); - with TrackBar2 do - begin - OnChange := @EventOnChange; - //OnClick := @WhenClick; - //OnMouseDown := @MDown; - //OnMouseUp := @MUp; - Parent := BenchForm[58]; - Top := 239; - Left := 50; - Height := 15; - Orientation := trHorizontal; - Position := 1; - Max := 194; - Min := 1; - Width := 220; - Name := 'TrackBar2'; - PopupMenu := PopupMenu1; - ScalePos := trTop; - TickMarks := tmBoth; - TickStyle := tsAuto; - Visible := True; - end; -//++++++++++++++++++++++++++++++++++++ UpDown1 ++++++++++++++++++++++++++++++++++++++ - -//++++++++++++++++++++++++++++++++++++ THE END ++++++++++++++++++++++++++++++++++++++ -END; - -END. +end. diff --git a/examples/testallform_include.inc b/examples/testallform_include.inc new file mode 100644 index 0000000000..fe53da275c --- /dev/null +++ b/examples/testallform_include.inc @@ -0,0 +1,314 @@ +{%mainunit testallform.pp} +{ + *************************************************************************** + * * + * This source is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This code 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. See the GNU * + * General Public License for more details. * + * * + * A copy of the GNU General Public License is available on the World * + * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also * + * obtain it by writing to the Free Software Foundation, * + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + *************************************************************************** +} + +const + AppTitle = 'Test Many (but not all) Components'; + AboutMsg = 'A little test suite to test many (but not all) components' + LineEnding + + 'of Lazarus.' + LineEnding + LineEnding + + 'This test suite aims neither to be complete, nor to be free of bugs.' + LineEnding + + LineEnding + + 'Feel free to report bugs and other shortcomings on the Lazarus bugtracker.'; +type + taComponents = ( + tacTarrow, + tacTbitbtn, + tacTbutton, + tacTbuttonpanel, + tacTcalcedit, + tacTcalendar, + tacTcheckbox, + tacTcheckcombobox, + tacTcheckgroup, + tacTchecklistbox, + tacTcolorbox, + tacTcolorbutton, + tacTcolorlistbox, + tacTcombobox, + tacTcomboboxex, + tacTcontrolbar, + tacTcoolbar, + tacTdateedit, + tacTdirectoryedit, + tacTedit, + tacTeditbutton, + tacTfilelistbox, + tacTfilenameedit, + tacTfiltercombobox, + tacTfloatspinedit, + tacTgroupbox, + tacTheadercontrol, + tacTimage, + tacTlabel, + tacTlabelededit, + tacTlistbox, + tacTlistview, + tacTmaskedit, + tacTmemo, + tacTnotebook, + tacTpagecontrol, + tacTpaintbox, + tacTpanel, + tacTprogressbar, + tacTradiobutton, + tacTradiogroup, + tacTshape, + tacTshelllistview, + tacTshelltreeview, + tacTspeedbutton, + tacTspinedit, + tacTsplitter, + tacTstacTictext, + tacTstatusbar, + tacTstringgrid, + tacTtabcontrol, + tacTtimeedit, + tacTtimer, + tacTtogglebox, + tacTtoolbar, + tacTtrackbar, + tacTtreeview, + tacTupdown, + tacTvaluelisteditor + ); + + taDialogs = ( + tadTcalculatordialog, + tadTcalendardialog, + tadTcolordialog, + tadTfinddialog, + tadTfontdialog, + tadTMessageDialog, + tadTopendialog, + tadTopenpicturedialog, + tadTreplacedialog, + tadTsavedialog, + tadTsavepicturedialog, + tadTselectdirectorydialog, + tadTQuesionDialog + ); + +const + tagCompStart = $1000; + tagDlgStart = $10000; + + taCompImplemented: Array[taComponents] of Boolean = ( + True, //tacTarrow, + True, //tacTbitbtn, + False, //tacTbutton, + False, //tacTbuttonpanel, + False, //tacTcalcedit, + False, //tacTcalendar, + False, //tacTcheckbox, + False, //tacTcheckcombobox, + False, //tacTcheckgroup, + False, //tacTchecklistbox, + False, //tacTcolorbox, + False, //tacTcolorbutton, + False, //tacTcolorlistbox, + False, //tacTcombobox, + False, //tacTcomboboxex, + False, //tacTcontrolbar, + False, //tacTcoolbar, + False, //tacTdateedit, + False, //tacTdirectoryedit, + False, //tacTedit, + False, //tacTeditbutton, + False, //tacTfilelistbox, + False, //tacTfilenameedit, + False, //tacTfiltercombobox, + False, //tacTfloatspinedit, + False, //tacTgroupbox, + False, //tacTheadercontrol, + False, //tacTimage, + False, //tacTlabel, + False, //tacTlabelededit, + False, //tacTlistbox, + False, //tacTlistview, + False, //tacTmaskedit, + False, //tacTmemo, + False, //tacTnotebook, + False, //tacTpagecontrol, + False, //tacTpaintbox, + False, //tacTpanel, + False, //tacTprogressbar, + False, //tacTradiobutton, + False, //tacTradiogroup, + False, //tacTshape, + False, //tacTshelllistview, + False, //tacTshelltreeview, + False, //tacTspeedbutton, + False, //tacTspinedit, + False, //tacTsplitter, + False, //tacTstacTictext, + False, //tacTstatusbar, + False, //tacTstringgrid, + False, //tacTtabcontrol, + False, //tacTtimeedit, + False, //tacTtimer, + False, //tacTtogglebox, + False, //tacTtoolbar, + False, //tacTtrackbar, + False, //tacTtreeview, + False, //tacTupdown, + False //tacTvaluelisteditor, + ); + + taDlgImplemented: Array[taDialogs] of Boolean = ( + False, //tadTcalculatordialog, + False, //tadTcalendardialog, + False, //tadTcolordialog, + False, //tadTfinddialog, + False, //tadTfontdialog, + False, //tadTMessageDialog, + False, //tadTopendialog, + False, //tadTopenpicturedialog, + False, //tadTreplacedialog, + False, //tadTsavedialog, + False, //tadTsavepicturedialog, + False, //tadTselectdirectorydialog, + False //tadTQuesionDialog + ); + + taCompNames: Array[taComponents] of String = ( + 'Tarrow', + //False, // //tacTbevel, + 'Tbitbtn', + //False, // //tacTbufdataset, + 'Tbutton', + 'Tbuttonpanel', + 'Tcalcedit', + 'Tcalendar', + 'Tcheckbox', + 'Tcheckcombobox', + 'Tcheckgroup', + 'Tchecklistbox', + 'Tcolorbox', + 'Tcolorbutton', + 'Tcolorlistbox', + 'Tcombobox', + 'Tcomboboxex', + 'Tcontrolbar', + 'Tcoolbar', + //False, // //tacTdatasource, + 'Tdateedit', + //False, // //tacTdbcalendar, + //False, // //tacTdbcheckbox, + //False, // //tacTdbcombobox, + //False, // //tacTdbedit, + //False, // //tacTdbdateedit, + //False, // //tacTdbgrid, + //False, // //tacTdbgroupbox, + //False, // //tacTdbimage, + //False, // //tacTdblistbox, + //False, // //tacTdblookupcombobox, + //False, // //tacTdblookuplistbox, + //False, // //tacTdbmemo, + //False, // //tacTdbnavigator, + //False, // //tacTdbradiogroup, + //False, // //tacTdbtext, + 'Tdirectoryedit', + //False, // //tacTdrawgrid, + 'Tedit', + 'Teditbutton', + //False, // //tacTeventlog, + 'Tfilelistbox', + 'Tfilenameedit', + 'Tfiltercombobox', + 'Tfloatspinedit', + //False, // //tacTflowpanel, + //False, // //tacTframe, + 'Tgroupbox', + 'Theadercontrol', + //False, // //tacThtmlbrowserhelpviewer, + //False, // //tacThtmlhelpdatabase, + //False, // //tacTidedialoglayoutstorage, + //False, // //tacTidletimer, + 'Timage', + //False, // //tacTimagelist, + //False, // //tacTinipropstorage, + 'Tlabel', + 'Tlabelededit', + //False, // //tacTlazcomponentqueue, + 'Tlistbox', + 'Tlistview', + //False, // //tacTmainmenu, + 'Tmaskedit', + 'Tmemo', + //False, // //tacTmouse, + 'Tnotebook', + 'Tpagecontrol', + 'Tpaintbox', + //False, // //tacTpairsplitter, + 'Tpanel', + //False, // //tacTpicture, + //False, // //tacTpopupmenu, + //False, // //tacTpopupnotifier, + //False, // //tacTprocess, + //False, // //tacTprocessutf8, + 'Tprogressbar', + 'Tradiobutton', + 'Tradiogroup', + //False, // //tacTscrollbar, + //False, // //tacTscrollbox, + //False, // //tacTservicemanager, + 'Tshape', + 'Tshelllistview', + 'Tshelltreeview', + //False, // //tacTsimpleipcclient, + //False, // //tacTsimpleipcserver, + 'Tspeedbutton', + 'Tspinedit', + 'Tsplitter', + 'TstacTictext', + 'Tstatusbar', + 'Tstringgrid', + 'Ttabcontrol', + 'Ttimeedit', + 'Ttimer', + 'Ttogglebox', + 'Ttoolbar', + 'Ttrackbar', + //False, // //tacTtrayicon, + 'Ttreeview', + 'Tupdown', + 'Tvaluelisteditor' + //False, // //tacTxmlconfig, + //False, // //tacTxmlpropstorage + ); + + taDlgNames: Array[taDialogs] of String = ( + 'CalculatorDialog', + 'CalendarDialog', + 'ColorDialog', + 'FindDialog', + 'FontDialog', + 'MessageDialog', + 'OpenDialog', + 'OpenpictureDialog', + 'ReplaceDialog', + 'SaveDialog', + 'SavepictureDialog', + 'SelectdirectoryDialog', + 'QuesionDialog' + ); + + diff --git a/examples/testtools.inc b/examples/testtools.inc index d035f7cca1..a5ef1a24a5 100644 --- a/examples/testtools.inc +++ b/examples/testtools.inc @@ -23,2884 +23,121 @@ //****************************************************************************** // TestTools.inc //****************************************************************************** -Const -Info : Array[0..5] of PChar = (' Do not exist yet... ', - ' This component is completed ! '+#13#10+' Minor errors could be at presence, '+#13#10+'report them to the Lazarus team.', - ' Almost completed, some procedures '+#13#10+' are missing in consideration to '+#13#10+' Delphi5 compatibility and some minor '+#13#10+' errors are at presence', - ' Basic code completed, finalization '+#13#10+' and cleanup is necessary. '+#13#10+' Errors are at presence. ', - ' A few procedures are completed, many errors are at presence. ', - ' Could crash/freeze your system! It will be created when you push this button. Try it on your own risk!'); -FileN : Array[0..8] of String =('tbitbtn','tlistbox','btn_newform','btn_newunit', - 'tnotebook','tmemo','btn_mouse','tcheckbox','btn_viewunits'); -//----------------------------------------------------------------------------------- -// CreateTestTools is a procedure -// that loads all test components -// and procedures -//----------------------------------------------------------------------------------- -procedure TForm1.CreateTestTools; +type + + { TArrDummy } + + TArrDummy = class + arr: TArrow; + procedure OnRgTypeClick(Sender: TObject); + procedure OnRgShadowClick(Sender: TObject); + end; + +procedure TArrDummy.OnRgTypeClick(Sender: TObject); +begin + if not Assigned(arr) then Exit; + arr.ArrowType := TArrowType(TRadioGroup(Sender).ItemIndex); +end; + +procedure TArrDummy.OnRgShadowClick(Sender: TObject); +begin + if not Assigned(arr) then Exit; + arr.ShadowType := TShadowType(TRadioGroup(Sender).ItemIndex); +end; + +procedure TForm1.TestArrow; var -i : Integer; + arr: TArrow; + dummy: TArrDummy; + rgtype, rgshadow: TRadioGroup; begin -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TApplication Tools +++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -rdbOk := TRadioButton.Create(Self); //RadioButton OK - FBoxStyle := 0; - With rdbOk do - begin - Checked := True; - Parent := BenchForm[1]; - OnClick := @BoxStyle; - Top := 10; - Left := 130; - Height := 20; - Width := 130; - Tag := 0; - Show; - Caption := 'OK'; - end; -rdbOkCancel := TRadioButton.Create(Self); //RadioButton OkCancel - With rdbOkCancel do - begin - Parent := BenchForm[1]; - OnClick := @BoxStyle; - Top := 30; - Left := 130; - Checked := False; - Height := 20; - Width := 130; - Tag := 1; - Show; - Caption := 'OK,Cancel'; - end; -rdbAbortRetryIgnore := TRadioButton.Create(Self); //RadioButton AbortRetryIgnore - With rdbAbortRetryIgnore do - begin - Parent := BenchForm[1]; - OnClick := @BoxStyle; - Top := 50; - Left := 130; - Checked := False; - Height := 20; - Width := 130; - Tag := 2; - Show; - Caption := 'Abort,Retry,Ignore'; - end; -rdbYesNoCancel := TRadioButton.Create(Self); //RadioButton YesNoCancel - With rdbYesNoCancel do - begin - Parent := BenchForm[1]; - OnClick := @BoxStyle; - Top := 70; - Left := 130; - Checked := False; - Height := 20; - Width := 130; - Tag := 2; - Show; - Caption := 'Yes,No,Cancel'; - end; -rdbYesNo := TRadioButton.Create(Self); //RadioButton YesNo - With rdbYesNo do - begin - Parent := BenchForm[1]; - OnClick := @BoxStyle; - Top := 90; - Left := 130; - Checked := False; - Height := 20; - Width := 130; - Tag := 2; - Show; - Caption := 'Yes,No'; - end; -rdbRetryCancel := TRadioButton.Create(Self); //RadioButton RetryCancel - With rdbRetryCancel do - begin - Parent := BenchForm[1]; - OnClick := @BoxStyle; - Top := 110; - Left := 130; - Checked := False; - Height := 20; - Width := 130; - Tag := 2; - Show; - Caption := 'Retry,Cancel'; - end; -btnShowBox := TBitBtn.Create(Self); //MessageBox show button - with btnShowBox do - begin - OnClick := @ShowBox; - Parent := BenchForm[1]; - Top := 10; - Left := 10; - Width := 85; - Height := 21; - Kind := bkCustom; - Caption := 'MessageBox'; - Hint := 'Show MessageBox style'; - ShowHint := True; - Visible := True; - end; -lblExeName := TLabel.Create(Self); //Label showing Application.ExeName - With lblExeName do - begin - Parent := BenchForm[1]; - Top := 130; - Left := 10; - Width := 200; - Height := 23; - Show; - Caption := 'ExeName: '+Application.ExeName; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TBevel Tools +++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - chbBevelStyle := TRadioGroup.Create (self); - with chbBevelStyle do - begin - Parent := BenchForm[2]; - OnClick := @BevelSettings; - Top := 10; - Left := 160; - Height := 60; - Width := 180; - Items.Add ('lowered'); - Items.Add ('raised'); - Hint := 'Change style (lowered/raised)'; - ShowHint := True; - ItemIndex := 0; - Show; - Caption := 'Bevel Styles'; - End; - chbBevelShape := TRadioGroup.Create (self); - with chbBevelShape do - begin - Parent := BenchForm[2]; - top := 80; - left := 160; - Height := 200; - Width := 180; - OnClick := @BevelSettings; - Items.Add ('bsBox'); - Items.Add ('bsFrame'); - Items.Add ('bsTopLine'); - Items.Add ('bsBottomLine'); - Items.Add ('bsLeftLine'); - Items.Add ('bsRightLine'); - ItemIndex := 0; - Show; - Caption := 'Bevel Shapes'; + debugln('TForm1.TestArrow'); + Clear; + arr := TArrow.Create(nil); + dummy := TArrDummy.Create; + dummy.arr := arr; + FObjList.Add(arr); + FObjList.Add(dummy); + ConnectStandardEvents(arr); + arr.Top := 5; + arr.Left := 5; + arr.Width := 30; + arr.Height := 30; + arr.Color := clRed; + arr.Parent := TestPnl; + rgtype := TRadioGroup.Create(nil); + FObjList.Add(rgtype); + rgtype.Items.AddStrings(['atUp', 'atDown', 'atLeft', 'atRight']); + rgtype.ItemIndex := Ord(arr.ArrowType); + rgtype.OnClick := @dummy.OnRgTypeClick; + rgtype.Left := arr.Left; + rgtype.Top := arr.Top + arr.Height + 20; + rgtype.Caption := 'ArrowType'; + rgtype.Parent := TestPnl; + rgtype.AutoSize := True; + rgshadow := TRadioGroup.Create(nil); + FobjList.Add(rgshadow); + rgshadow.Items.AddStrings(['stNone', 'stIn', 'stOut', 'stEtchedIn', 'stEtchedOut', 'stFilled']); + rgshadow.ItemIndex := Ord(arr.ShadowType); + rgshadow.OnClick := @dummy.OnRgShadowClick; + rgshadow.Left := rgtype.Left + rgtype.Width + 20; + rgshadow.Top := rgtype.Top; + rgshadow.Caption := 'ShadowType'; + rgshadow.Parent := TestPnl; + rgshadow.AutoSize := True; + +end; + +type + { TBBDummy } + TBBDummy = class + B: TBitBtn; + procedure OnRgKindClick(Sender: TObject); end; - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TBitBtn Tools ++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -cbbKind := TComboBox.Create(Self); - with cbbKind do - begin - OnChange := @KindComboChange; - Parent := BenchForm[3]; - Top := 10; - Left := 110; - Width := 105; - Height := 28; - Items.Add('bkOK'); - Items.Add('bkCancel'); - Items.Add('bkHelp'); - Items.Add('bkClose'); - Items.Add('bkAll'); - Items.Add('bkCustom'); - Show; - end; -cbbAlign := TComboBox.Create(Self); - with cbbAlign do - begin - OnChange := @AlignComboChange; - Parent := BenchForm[3]; - Top := 38; - Left := 110; - Width := 105; - Height := 28; - Items.Add('blGlyphTop'); - Items.Add('blGlyphBottom'); - Items.Add('blGlyphRight'); - Items.Add('blGlyphLeft'); - Show; - end; -btnGlyph := TBitBtn.Create(Self); - with btnGlyph do - begin - OnClick := @LoadGlyph; - Parent := BenchForm[3]; - Top := 70; - Left := 110; - Width := 45; - Height := 25; - Kind := bkCustom; - Caption := 'Glyph'; - Hint := 'Pick a Glyph (ONLY .xpm FILES)'; - ShowHint := True; - Visible := True; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TButton Tools ++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -btnClrLotto := TBitBtn.Create(Self); //Reset Lotto - with btnClrLotto do - begin - OnClick := @LottoClear; - Parent := BenchForm[4]; - Top := 140; - Left := 30; - Width := 45; - Height := 21; - Kind := bkCustom; - Caption := 'Again'; - Hint := 'Clear the Buttons'; - ShowHint := True; - Visible := True; - end; -lblLResult := TLabel.Create(Self); //Label Result - With lblLResult do - begin - Parent := BenchForm[4]; - Top := 3; - Left := 30; - Width := 400; - Height := 23; - Show; - Caption := 'Result: '; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TCanvas Tools ++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -cbbPaintType := TComboBox.Create(Self); //What to paint - with cbbPaintType do - begin - Parent := BenchForm[5]; - Top := 260; - Left := 10; - Width := 90; - Height := 28; - Items.Add('Rectangle'); - Items.Add('LineTo'); - Show; - end; -lblPaintWhat := TLabel.Create(Self); //Label Paint what - With lblPaintWhat do - begin - Parent := BenchForm[5]; - Top := 240; - Left := 10; - Width := 200; - Height := 23; - Show; - Caption := 'Paint what'; - end; -cbbBrushStyle := TComboBox.Create(Self); //Canvas.BrushStyle - with cbbBrushStyle do - begin - OnChange := @StyleSelect; - Parent := BenchForm[5]; - Top := 260; - Left := 105; - Width := 100; - Height := 28; - Items.Add('bsBDiagonal'); - Items.Add('bsClear'); - Items.Add('bsCross'); - Items.Add('bsDiagCross'); - Items.Add('bsFDiagonal'); - Items.Add('bsHorizontal'); - Items.Add('bsVertical'); - Items.Add('bsSolid'); - Show; - end; - -lblBrushStyle := TLabel.Create(Self); //Label Brush style - With lblBrushStyle do - begin - Parent := BenchForm[5]; - Top := 240; - Left := 105; - Width := 200; - Height := 23; - Show; - Caption := 'Brush style'; - end; - -cbbPenStyle := TComboBox.Create(Self); //Canvas.PenStyle - with cbbPenStyle do - begin - OnChange := @PenStyleSelect; - Parent := BenchForm[5]; - Top := 220; - Left := 10; - Width := 110; - Height := 28; - Items.Add('psClear'); - Items.Add('psDash'); - Items.Add('psDashDot'); - Items.Add('psDashDotDot'); - Items.Add('psDot'); - Items.Add('psSolid'); - Show; - end; - -lblPenStyle := TLabel.Create(Self); //Label Pen style - With lblPenStyle do - begin - Parent := BenchForm[5]; - Top := 200; - Left := 10; - Width := 200; - Height := 23; - Show; - Caption := 'Pen style'; - end; - -btnPenColor := TBitBtn.Create(Self); //PenColor select ColorDialog - with btnPenColor do - begin - OnClick := @ColorSelect; - Parent := BenchForm[5]; - Top := 263; - Left := 210; - Width := 45; - Height := 21; - Kind := bkCustom; - Caption := 'Pen'; - Hint := 'Pen Color'; - ShowHint := True; - Visible := True; - end; - -btnBrushColor := TBitBtn.Create(Self); //BrushColor select ColorDialog - with btnBrushColor do - begin - OnClick := @ColorSelect; - Parent := BenchForm[5]; - Top := 263; - Left := 260; - Width := 45; - Height := 21; - Kind := bkCustom; - Caption := 'Brush'; - Hint := 'Brush Color'; - ShowHint := True; - Visible := True; - end; - -btnGrad := TBitBtn.Create(Self); //Gradient Canvas - with btnGrad do - begin - OnClick := @GradCanvas; - Parent := BenchForm[5]; - Top := 263; - Left := 310; - Width := 45; - Height := 21; - Kind := bkCustom; - Caption := 'Grad'; - Hint := 'Gradient Canvas'; - ShowHint := True; - Visible := True; - end; - -btnCanvasClear := TBitBtn.Create(Self); //Clear Canvas - with btnCanvasClear do - begin - OnClick := @ClearCanvas; - Parent := BenchForm[5]; - Top := 5; - Left := 345; - Width := 45; - Height := 21; - Kind := bkCustom; - Caption := 'Clear'; - Hint := 'Clear the Canvas'; - ShowHint := True; - Visible := True; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TCheckBox Tools ++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -lblPick := Tlabel.Create(Self); //Label Pick a number - With lblPick do - begin - Parent := BenchForm[6]; - Top := 3; - Left := 25; - Width := 200; - Height := 20; - Show; - Caption := 'Pick a number !'; - end; -lblCount := Tlabel.Create(Self); //Label Count picks - With lblCount do - begin - Parent := BenchForm[6]; - Top := 165; - Left := 25; - Width := 200; - Height := 20; - Show; - Caption := 'Counter: '+IntToStr(CHCount); - end; -btnAgain := TBitBtn.Create(Self); - with btnAgain do - begin - OnClick := @AgainClick; - Parent := BenchForm[6]; - Top := 3; - Left:= 150; - Width := 45; - Height := 20; - Kind := bkCustom; - Caption := 'Again'; - Hint := 'Play one more time !'; - ShowHint := True; - Visible := True; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TClipboard Tools +++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD Clipboard CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TCListBox Tools ++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD CListBox CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TColorDialog Tool ++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -btnColorSelect := TBitBtn.Create(Self); - with btnColorSelect do - begin - OnClick := @SelectedColor; - Parent := BenchForm[9]; - Top := 10; - Left:= 10; - Width := 45; - Height := 20; - Kind := bkCustom; - Caption := 'Color'; - Hint := 'Color Dialog (Some repaint problem, move the form to se the effect !!)'; - ShowHint := True; - Visible := True; - end; -lblColorInt := Tlabel.Create(Self); //Label The Color in Integer; - With lblColorInt do - begin - Parent := BenchForm[9]; - Top := 8; - Left := 65; - Width := 200; - Height := 20; - Show; - Caption := 'Integer Color: '; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TComboBox Tools ++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -btnCbbAdd := TButton.Create(Self); - with btnCbbAdd do - begin - OnClick := @AddToCbb; - Height := 20; - Width := 55; - Parent := BenchForm[10]; - Top := 16; - Left:= 178; - Cursor := crDefault; - Enabled := True; - Hint := 'Add this to ComboBox1'; - ShowHint := True; - Caption := 'Add >'; - Name := 'btnCbbAdd'; - PopupMenu := PopupMenu1; - Visible := True; - end; -edtCbbAdd := TEdit.Create(Self); - with edtCbbAdd do - begin - Parent := BenchForm[10]; - Caption := ''; - Width := 145; - Height := 20; - Left := 240; - Top := 16; - Show; - end; -btnCbbRemove := TBitBtn.Create(Self); - with btnCbbRemove do - begin - OnClick := @RemoveCbb; - Parent := BenchForm[10]; - Top := 45; - Left:= 178; - Width := 55; - Height := 20; - Caption := 'Remove'; - Visible := True; - end; -lblRemoved := Tlabel.Create(Self); //Label ComboBox Removed - With lblRemoved do - begin - Parent := BenchForm[10]; - Top := 275; - Left := 10; - Width := 200; - Height := 20; - Show; - Caption := ' '; - end; -lblIndex := Tlabel.Create(Self); //Label ItemIndex - With lblIndex do - begin - Parent := BenchForm[10]; - Top := 255; - Left := 10; - Width := 200; - Height := 20; - Show; - Caption := 'ItemIndex: '; - end; -lblSelLength := Tlabel.Create(Self); //Label ItemIndex - With lblSelLength do - begin - Parent := BenchForm[10]; - Top := 235; - Left := 10; - Width := 200; - Height := 20; - Show; - Caption := 'SelLength: '; - end; -lblSelStart := Tlabel.Create(Self); //Label ItemIndex - With lblSelStart do - begin - Parent := BenchForm[10]; - Top := 215; - Left := 10; - Width := 200; - Height := 20; - Show; - Caption := 'SelStart: '; - end; -lblSelText := Tlabel.Create(Self); //Label ItemIndex - With lblSelText do - begin - Parent := BenchForm[10]; - Top := 195; - Left := 10; - Width := 200; - Height := 20; - Show; - Caption := 'SelText: '; - end; -cbbMoveTo := TComboBox.Create(Self); - with cbbMoveTo do - begin - OnChange := @EventOnChange; - Parent := BenchForm[10]; - Top := 70; - Left := 10; - Width := 160; - Height := 28; - Show; - end; -btnMoveTo := TBitBtn.Create(Self); - with btnMoveTo do - begin - OnClick := @MoveToCbb; - Parent := BenchForm[10]; - Top := 45; - Left:= 10; - Width := 130; - Height := 20; - Caption := 'Copy Sel to Combo2'; - Visible := True; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TDirectoryListBox Tools ++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD DirectoryListBox CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TDrawGrid Tools ++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD DrawGrid CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TDriveComboBox Tools +++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD DriveComboBox CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TEdit Tools ++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TFileListBox Tools +++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD FileListBox CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TFilterComboBox Tools ++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD FilterComboBox CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TFindDialog Tools ++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD FindDialog CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TFontDialog Tools ++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -btnShowFont := TBitBtn.Create(Self); //FontDialog show button - with btnShowFont do - begin - OnClick := @SelectFont; - Parent := BenchForm[18]; - Top := 10; - Left := 10; - Width := 50; - Height := 21; - Kind := bkCustom; - Caption := 'Select'; - Hint := 'Select Font'; - ShowHint := True; - Visible := True; - end; -lblWhatFont := TLabel.Create(Self); //Label showing Application.ExeName - With lblWhatFont do - begin - Parent := BenchForm[18]; - Top := 265; - Left := 10; - Width := 350; - Height := 23; - Show; - Caption := 'Font.Name:'; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TForm Tools ++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -lblWidth := Tlabel.Create(Self); //Label Form.Width - With lblWidth do - begin - Parent := BenchForm[19]; - Top := 10; - Left := 10; - Width := 200; - Height := 20; - Show; - Caption := 'Width: '+IntToStr(BenchForm[19].Width); - end; -lblHeight := Tlabel.Create(Self); //Label Form.Heigt - With lblHeight do - begin - Parent := BenchForm[19]; - Top := 30; - Left := 10; - Width := 200; - Height := 20; - Show; - Caption := 'Height: '+IntToStr(BenchForm[19].Height); - end; -lblCWidth := Tlabel.Create(Self); //Label Form.Width - With lblCWidth do - begin - Parent := BenchForm[19]; - Top := 50; - Left := 10; - Width := 200; - Height := 20; - Show; - Caption := 'ClientWidth: '+IntToStr(BenchForm[19].ClientWidth); - end; -lblCHeight := Tlabel.Create(Self); //Label Form.Heigt - With lblCHeight do - begin - Parent := BenchForm[19]; - Top := 70; - Left := 10; - Width := 200; - Height := 20; - Show; - Caption := 'ClientHeight: '+IntToStr(BenchForm[19].ClientHeight); - end; -cbbBorder := TComboBox.Create(Self); - with cbbBorder do - begin - OnChange := @FormBorder; - Parent := BenchForm[19]; - Top := 260; - Left := 10; - Width := 106; - Height := 28; - Items.Add('bsNone'); - Items.Add('bsSingle'); - Items.Add('bsDialog'); - Items.Add('bsToolWindow'); - Items.Add('bsSizeable'); - Show; - end; -cbbPosition := TComboBox.Create(Self); - with cbbPosition do - begin - OnChange := @FormPosition; - Parent := BenchForm[19]; - Top := 260; - Left := 126; - Width := 140; - Height := 28; - Items.Add('poOwnerFormCenter'); - Items.Add('poMainFormCenter'); - Items.Add('poDesktopCenter'); - Items.Add('poDefaultSizeOnly'); - Items.Add('poDefaultPosOnly'); - Items.Add('poDefault'); - Items.Add('poDesigned'); - Items.Add('poScreenCenter'); - Show; - end; -btnKeyDown := TBitBtn.Create(Self); //"keyDown" button - with btnKeyDown do - begin - Parent := BenchForm[19]; - Top := 10; - Left:= 325; - Width := 65; - Height := 21; - Kind := bkCustom; - Caption := 'KeyDown'; - Hint := 'For KeyDown to work'; - ShowHint := True; - Visible := True; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TGroupBox Tools ++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TImage Tools +++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD Image CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++++ TIniFile Tools +++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -If IniFile1.ReadString('INFORMATION','Project','NODATA')='NODATA' then +{ TBBDummy } +procedure TBBDummy.OnRgKindClick(Sender: TObject); begin -With IniFile1 do + if not assigned(B) then Exit; + B.Kind := TBitBtnKind(TRadioGroup(Sender).ItemIndex); + B.ModalResult := mrNone; + if (B.Kind = bkCustom) then begin - WriteString('INFORMATION','Project','Lazarus'); - WriteFloat('INFORMATION','Version',0.5); - WriteInteger('INFORMATION','Integer',1234567); - WriteDate('INFORMATION','Today',Now); - WriteTime('INFORMATION','AppStart',Now); + B.LoadGlyphFromResourceName(hInstance,'default'); + B.Caption := 'Custom'; end; end; -edtString := TEdit.Create(Self); - with edtString do - begin - Parent := BenchForm[22]; - Caption := Inifile1.ReadString('INFORMATION','Project','NODATA'); - Width := 150; - Height := 20; - Left := 50; - Top := 10; - Show; - end; - -lblString := TLabel.Create(Self); - With lblString do - begin - Parent := BenchForm[22]; - Top := 10; - Left := 5; - Width := 200; - Height := 17; - Show; - Caption := 'String'; - end; - -edtFloat := TEdit.Create(Self); - with edtFloat do - begin - Parent := BenchForm[22]; - Caption := Inifile1.ReadString('INFORMATION','Version','NODATA'); - Width := 150; - Height := 20; - Left := 50; - Top := 50; - Show; - end; - -lblFloat := TLabel.Create(Self); - With lblFloat do - begin - Parent := BenchForm[22]; - Top := 50; - Left := 5; - Width := 200; - Height := 17; - Show; - Caption := 'Float'; - end; - -edtInteger := TEdit.Create(Self); - with edtInteger do - begin - Parent := BenchForm[22]; - Caption := Inifile1.ReadString('INFORMATION','Integer','NODATA'); - Width := 150; - Height := 20; - Left := 50; - Top := 90; - Show; - end; - -lblInteger := TLabel.Create(Self); - With lblInteger do - begin - Parent := BenchForm[22]; - Top := 90; - Left := 5; - Width := 200; - Height := 17; - Show; - Caption := 'Integer'; - end; - -edtDate := TEdit.Create(Self); - with edtDate do - begin - Parent := BenchForm[22]; - Caption := Inifile1.ReadString('INFORMATION','Today','NODATA'); - Width := 150; - Height := 20; - Left := 50; - Top := 130; - Show; - end; - -lblDate := TLabel.Create(Self); - With lblDate do - begin - Parent := BenchForm[22]; - Top := 130; - Left := 5; - Width := 200; - Height := 17; - Show; - Caption := 'Date'; - end; - -edtTime := TEdit.Create(Self); - with edtTime do - begin - Parent := BenchForm[22]; - Caption := Inifile1.ReadString('INFORMATION','Appstart','NODATA'); - Width := 150; - Height := 20; - Left := 50; - Top := 170; - Show; - end; - -lblTime := TLabel.Create(Self); - With lblTime do - begin - Parent := BenchForm[22]; - Top := 170; - Left := 5; - Width := 200; - Height := 17; - Show; - Caption := 'Time'; - end; - -btnUpdate := TBitBtn.Create(Self); //"Update" button - with btnUpdate do - begin - OnClick := @IniUpdate; - Parent := BenchForm[22]; - Top := 200; - Left:= 50; - Width := 55; - Height := 21; - Kind := bkCustom; - Caption := 'Update'; - Hint := 'Adding your data'; - ShowHint := True; - Visible := True; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TLabel ++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -cbbAlignment := TComboBox.Create(Self); - with cbbAlignment do - begin - OnChange := @SelectAlignment; - Parent := BenchForm[23]; - Top := 10; - Left := 170; - Width := 105; - Height := 28; - Items.Add('taRightJustify'); - Items.Add('taCenter'); - Items.Add('taLeftJustify'); - Show; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TListBox ++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -btnRight := TBitBtn.Create(Self); //Button >>>>> - with btnRight do - begin - OnClick := @ListBoxMove; - Parent := BenchForm[24]; - Top := 60; - Left:= 173; - Width := 50; - Height := 21; - Kind := bkCustom; - Caption := ' >> '; - Hint := 'Move from ListBox1 to ListBox2'; - ShowHint := True; - Visible := True; - end; -btnLeft := TBitBtn.Create(Self); //Button <<<<< - with btnLeft do - begin - OnClick := @ListBoxMove; - Parent := BenchForm[24]; - Top := 100; - Left:= 173; - Width := 50; - Height := 21; - Kind := bkCustom; - Caption := ' << '; - Hint := 'Move from ListBox2 to ListBox1'; - ShowHint := True; - Visible := True; - end; -btnAdd := TBitBtn.Create(Self); //Button Add - with btnAdd do - begin - OnClick := @ListBoxMove; - Parent := BenchForm[24]; - Top := 10; - Left:= 173; - Width := 50; - Height := 21; - Kind := bkCustom; - Caption := ' Add '; - Hint := '^ Add to the ListBox ^'; - ShowHint := True; - Visible := True; - end; -btnCopyToMem := TBitBtn.Create(Self); //Button Add - with btnCopyToMem do - begin - OnClick := @CopyToMem; - Parent := BenchForm[24]; - Top := 200; - Left:= 173; - Width := 50; - Height := 21; - Kind := bkCustom; - Caption := ' Copy '; - Hint := 'Copy ListBox1 to Memo'; - ShowHint := True; - Visible := True; - end; -btnSaveFile := TBitBtn.Create(Self); //Button Add - with btnSaveFile do - begin - OnClick := @SaveFile; - Parent := BenchForm[24]; - Top := 162; - Left:= 173; - Width := 50; - Height := 21; - Kind := bkCustom; - Caption := ' Save '; - Hint := 'Save ListBox1 to file ./List.txt'; - ShowHint := True; - Visible := True; - end; -memAddTo := TMemo.Create(Self); - with memAddTo do - begin - Parent := BenchForm[24]; - Top := 200; - Left := 10; - Width := 150; - Height := 85; - ScrollBars := ssBoth; - Lines.Text := ' '; - Show; - end; -edtAddLis1 := TEdit.Create(Self); - with edtAddLis1 do - begin - Parent := BenchForm[24]; - Caption := ''; - Width := 150; - Height := 20; - Left := 10; - Top := 10; - Show; - end; -edtAddLis2 := TEdit.Create(Self); - with edtAddLis2 do - begin - Parent := BenchForm[24]; - Caption := ''; - Width := 150; - Height := 20; - Left := 235; - Top := 10; - Show; - end; - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TMaskEdit +++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD MaskEdit CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TMediaPlayer ++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD MediaPlayer CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TMemo Tools +++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -btnNew := TBitBtn.Create(Self); //Button New - with btnNew do - begin - OnClick := @NewMemo; - Parent := BenchForm[27]; - Top := 260; - Left:= 19; - Width := 50; - Height := 21; - Kind := bkCustom; - Caption := ' New '; - Hint := 'New Memo document'; - ShowHint := True; - Visible := True; - end; -btnSave := TBitBtn.Create(Self); //Button Save - with btnSave do - begin - OnClick := @SaveMemoAs; - Parent := BenchForm[27]; - Top := 260; - Left:= 70; - Width := 50; - Height := 21; - Kind := bkCustom; - Caption := ' Save '; - Hint := 'Save Memo as ...'; - ShowHint := True; - Visible := True; - end; -btnOpen := TBitBtn.Create(Self); //Button Open - with btnOpen do - begin - OnClick := @OpenMemo; - Parent := BenchForm[27]; - Top := 260; - Left:= 121; - Width := 50; - Height := 21; - Kind := bkCustom; - Caption := ' Open '; - Hint := 'Open File ...'; - ShowHint := True; - Visible := True; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TMessageDialog Tools ++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD MessageDialog CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TNoteBook Tools +++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD NoteBook CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TOpenDialog Tools +++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TPageControl Tools ++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD PageControl CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TPaintBox Tools +++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - pntCount := 0; -// ADD PaintBox CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TPanel Tools ++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - rgPanelOutBevel := TRadioGroup.Create (self); - with rgPanelOutBevel do - begin - Parent := Panel2; - OnClick := @PanelOutBevelClick; - Top := 10; - Left := 250; - Height := 100; - Width := 100; - Items.Add ('lowered'); - Items.Add ('raised'); - Items.Add ('none'); - Items.Add ('(!)space'); - Hint := 'Change style (lowered/raised..)'; - ShowHint := True; - ItemIndex := 1; - Show; - Caption := 'Outer-Bevel'; - End; - rgPanelInBevel := TRadioGroup.Create (self); - with rgPanelInBevel do - begin - Parent := Panel2; - OnClick := @PanelInBevelClick; - Top := 10; - Left := 140; - Height := 100; - Width := 100; - Items.Add ('lowered'); - Items.Add ('raised'); - Items.Add ('none'); - Items.Add ('(!)space'); - Hint := 'Change style (lowered/raised..)'; - ShowHint := True; - ItemIndex := 2; - Show; - Caption := 'Inner-Bevel'; - End; - rgPanelAlign := TRadioGroup.Create (self); - with rgPanelAlign do - begin - Parent := Panel2; - OnClick := @PanelAlignClick; - top := 10; - left := 10; - Height := 130; - Width := 120; - Items.Add ('alNone'); - Items.Add ('alBottom'); - Items.Add ('alClient'); - Items.Add ('alLeft'); - Items.Add ('alRight'); - Items.Add ('alTop'); - ItemIndex := 0; - Show; - Caption := 'Alignment'; - end; - btPanelNorm := TButton.Create(self); - with btPanelNorm do - begin - Parent := Panel2; - OnClick:= @PanelNormClick; - top := 10; - left := 360; - Height := 30; - Width := 50; - Show; - Caption := 'Norm'; - end; - - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TPopupMenu Tools ++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD PopupMenu CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TPrintDialog Tools ++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD PrinDialog CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TPrinterSetupDialog Tools +++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD PrinterSetupDialog CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TProgressBar Tools ++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -ProgTime := TTimer.Create(Self); - with ProgTime do - begin - OnTimer := @UpdateProgressBar; - Enabled := False; - Interval := 50; - Name := 'ProgTime'; - end; -chbProgEnable := TCheckBox.Create(Self); - with chbProgEnable do - begin - OnClick := @ProgSettings; - Parent := BenchForm[37]; - Top := 28; - Left := 220; - Height := 20; - Width := 70; - Caption := 'Run'; - Cursor := crHandPoint; - Hint := 'Run the ProgressBar'; - ShowHint := True; - Visible := True; - End; -chbProgOrient := TCheckBox.Create(Self); - with chbProgOrient do - begin - OnClick := @ProgSettings; - Parent := BenchForm[37]; - Top := 48; - Left := 220; - Height := 20; - Width := 70; - Caption := 'Vertical'; - Cursor := crHandPoint; - Hint := 'Change orientation'; - ShowHint := True; - Visible := True; - End; -chbProgDirect := TCheckBox.Create(Self); - with chbProgDirect do - begin - OnClick := @ProgSettings; - Parent := BenchForm[37]; - Top := 68; - Left := 220; - Height := 20; - Width := 70; - Caption := 'Direction'; - Cursor := crHandPoint; - Hint := 'Change direction'; - ShowHint := True; - Visible := True; - End; -chbProgText := TCheckBox.Create(Self); - with chbProgText do - begin - OnClick := @ProgSettings; - Parent := BenchForm[37]; - Top := 88; - Left := 220; - Height := 20; - Width := 70; - Caption := 'Text'; - Cursor := crHandPoint; - Hint := 'Show progress text'; - ShowHint := True; - Visible := True; - End; -chbSmooth := TCheckBox.Create(Self); - with chbSmooth do - begin - OnClick := @ProgSettings; - Parent := BenchForm[37]; - Top := 108; - Left := 220; - Height := 20; - Width := 70; - Caption := 'Smooth'; - Cursor := crHandPoint; - Hint := 'Show progress NOT smooth'; - ShowHint := True; - Visible := True; - End; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TRadioButton Tools ++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD RadioButton CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TRadioGroup Tools +++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD RadioGroup CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TReplaceDialog Tools ++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD ReplaceDialog CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TRichEdit Tools +++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD RichEdit CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TSaveDialog Tools +++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD SaveDialog CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TScreen Tools +++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -lblScreenWidth := TLabel.Create(Self); //Label showing Screen.Width - With lblScreenWidth do - begin - Parent := BenchForm[43]; - Top := 10; - Left := 10; - Width := 200; - Height := 23; - Show; - Caption := 'ScreenWidth: '+IntToStr(Screen.Width); - end; -lblScreenHeight := TLabel.Create(Self); //Label showing Screen.Height - With lblScreenHeight do - begin - Parent := BenchForm[43]; - Top := 35; - Left := 10; - Width := 200; - Height := 23; - Show; - Caption := 'ScreenHeight: '+IntToStr(Screen.Height); - end; -lblPixels := TLabel.Create(Self); //Label showing Screen.PixelsPerInch - With lblPixels do - begin - Parent := BenchForm[43]; - Top := 60; - Left := 10; - Width := 200; - Height := 23; - Show; - Caption := 'PixelsPerInch: '+IntToStr(Screen.PixelsPerInch); - end; -lblFormCount := TLabel.Create(Self); //Label showing Screen.PixelsPerInch - With lblFormCount do - begin - Parent := BenchForm[43]; - Top := 85; - Left := 10; - Width := 200; - Height := 23; - Show; - Caption := 'FormCount: '+IntToStr(Screen.FormCount); - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TScrollBar Tools ++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD ScrollBar CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TScrollBox Tools ++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD ScrollBox CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TShape Tools ++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD Shape CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TSpeedButton Tools ++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -FLeft := 10; -For i:= 0 to 8 do -begin - - Pixmap1:=TPixMap.Create; - Pixmap1.TransparentColor:=clBtnFace; - if not LoadResource(FileN[i],Pixmap1) then - begin - LoadResource('default',Pixmap1); - end; - - SpeedB[i] := TSpeedButton.Create(Self); - with SpeedB[i] do - begin - Parent := BenchForm[47]; - OnClick := @EventOnClick; - OnMouseDown := @EventOnMouseDown; - OnMouseUp := @EventOnMouseUp; - Left := SpeedButton1.Left + (i * 23); - Top := 20; - if (i > 4) then - begin - Flat := true; - Hint := FileN [i] + '(flat button)'; - end - else begin - Flat := false; - Hint := FileN [i] + '(normal buton)'; - end; - Color := clBtnFace; - Glyph.Assign(Pixmap1); - Enabled := True; - Visible := True; - ShowHint := true; - end; - FreeAndNil(Pixmap1); -end; - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TSpinButton Tools +++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD SpinButton CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TSpinEdit Tools +++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -lblOnChange := TLabel.Create(Self); //Label showing Screen.Width - With lblOnChange do - begin - Parent := BenchForm[49]; - Top := 50; - Left := 10; - Width := 200; - Height := 23; - Show; - Caption := 'Value: ';//+IntToStr(SpinEdit1.Value); - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TStatusBar Tools ++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD StatusBar CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TStringGrid +++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD StringGrid CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TTabbedNoteBook +++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD TabbedNoteBook CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TTabControl +++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD TabControl CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++ TThread +++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD Thread CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++ TTimer Tools +++++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -lblTimeNow := TLabel.Create(Self); //Label showing TimeNow - With lblTimeNow do - begin - Parent := BenchForm[55]; - Top := 10; - Left := 10; - Width := 200; - Height := 23; - Show; - Caption := 'TimeNow: '+TimeToStr(Now); - end; -lblHourMinSec := TLabel.Create(Self); //Label showing Hour Min Sec - With lblHourMinSec do - begin - Parent := BenchForm[55]; - Top := 35; - Left := 10; - Width := 85; - Height := 23; - Show; - Caption := 'Track: 00:00:00'; - end; -lblMSec := TLabel.Create(Self); //Label showing Milli Seconds - With lblMSec do - begin - Parent := BenchForm[55]; - Top := 35; - Left := 96; - Width := 20; - Height := 23; - Show; - Caption := ':00'; - end; -btnStart := TBitBtn.Create(Self); //Start Timetrack button - with btnStart do - begin - OnClick := @TimeTrack; - Parent := BenchForm[55]; - Top := 65; - Left := 10; - Width := 40; - Height := 21; - Kind := bkCustom; - Caption := 'Start'; - Hint := 'Start/Stop timetrack'; - ShowHint := True; - Visible := True; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++ TToggleBox Tools +++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -lblChecked := TLabel.Create(Self); - with lblChecked do - begin - Parent := BenchForm[56]; - Left := 10; - Top := 275; - Width := 100; - Height := 20; - Caption := 'Checked= '; - Show; - end; -lblState := TLabel.Create(Self); - with lblState do - begin - Parent := BenchForm[56]; - Left := 10; - Top := 255; - Width := 120; - Height := 20; - Caption := 'State= '; - Show; - end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++ TToolBar Tools +++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD ToolBar CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++ TTrackBar Tools ++++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD TrackBar CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++ TUpDown Tools ++++++++++++++++++++++++++++++++++++++ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// ADD UpDown CompTools HERE !!!!!!!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++ Universal TestTools ++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -AboutForm := TForm.Create(Self); - With AboutForm do - begin - OnClose := @TestFormClose;//+++++ ABOUT +++++++++++++ - Height := 300; //+++++++++++++++++++++++++ - Width := 420; - Caption := 'About'; - BorderStyle := bsDialog; - Left := Screen.Width div 2 - (AboutForm.Width div 2); - Top := 10; - end; -//++++++++++++++++++++++++++++++ EVENT SNOOPER +++++++++ -EventForm := TForm.Create(Self); - With EventForm do - Begin - Height := 294; - Width := 255; - Caption := 'Events'; - BorderStyle := bsDialog; - Left := 45; - Top := 100; - Show; - end; -lbEvents := TListBox.Create(Self); // The Event ListBox - with lbEvents do - begin - Parent := EventForm; - Align := alClient; - Show; - end; -//++++++++++++++++++++++++++++++++ About Comps ++++++++++ -gbAbout := TGroupBox.Create(Self); - with gbAbout do - begin - Parent := AboutForm; - Left := 5; - Top := 5; - Width := 407; - Height := 160; - //Ctl3D := False; - Caption := ' About this application '; - Visible := True; - end; -btnBigOk := TBitBtn.Create(Self); //Button Ok - with btnBigOk do - begin - OnClick := @CloseAbout; - Parent := AboutForm; - Top := 172; - Left:= 5; - Width :=406; - Height := 117; - Kind := bkCustom; - Caption := ' OK'; - Hint := 'Well....ehem... OK !'; - ShowHint := True; - Visible := True; - end; -lblAbout := TMemo.Create(Self); - with lblAbout do - begin - Parent := AboutForm; - Width := 386; - Height := 80; - Left := 15; - Top := 30; - Caption := 'This program is free software; you can redistribute it and/or modify it'+ - ' under the terms of the GNU General Public License as published '+ - 'by the Free Software Foundation; either version 2 of the License, or'+#13#10+ - '(at your option) any later version.'; - ReadOnly := True; - Visible := True; - WordWrap := True; - end; -lblAuthor := TMemo.Create(Self); - with lblAuthor do - begin - Parent := AboutForm; - Width := 386; - Height := 20; - Left := 15; - Top := 130; - Caption := 'Key-Pusher: christer.t.johansson@se.abb.com "Chris"'; - ReadOnly := True; - Visible := True; - WordWrap := True; - end; -END; -//++++++++++++++++++++++++++++++ Create TestTools END +++++++++++++++++++++++++++++++ -//*********************************************************************************** -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// TApplication Procedures -//................................................................................... -procedure TForm1.BoxStyle(Sender : TObject); -Begin - If Sender=rdbOk then - begin - FBoxStyle := 0; - lbEvents.Items.Add('MessageBox.[OK]'); - //DebugLn('Trace: MessageBox.[OK]'); - End Else if Sender = rdbOkCancel then - begin - FBoxStyle := 1; - lbEvents.Items.Add('MessageBox.[OK,Cancel]'); - //DebugLn('Trace: MessageBox.[OK,Cancel]'); - End Else if Sender = rdbAbortRetryIgnore then - begin - FBoxStyle := 2; - lbEvents.Items.Add('MessageBox.[Abort,Retry,Ignore]'); - //DebugLn('Trace: MessageBox.[Abort,Retry,Ignore]'); - End Else if Sender = rdbYesNoCancel then - begin - FBoxStyle := 3; - lbEvents.Items.Add('MessageBox.[Yes,No,Cancel]'); - //DebugLn('Trace: MessageBox.[Yes,No,Cancel]'); - End Else if Sender = rdbYesNo then - begin - FBoxStyle := 4; - lbEvents.Items.Add('MessageBox.[Yes,No]'); - //DebugLn('Trace: MessageBox.[Yes,No]'); - End Else If Sender = rdbRetryCancel then - begin - FBoxStyle := 5; - lbEvents.Items.Add('MessageBox.[Retry,Cancel]'); - //DebugLn('Trace: MessageBox.[Retry,Cancel]'); - End; - EventWatch; -end; -procedure TForm1.ShowBox(Sender : TObject); -begin - //DebugLn('Trace: >>>>>> MessageBoxShow'); - //DebugLn('Trace: ^^^^^^^^^^^^^^^^^^^^^'); - Case Application.MessageBox(' User information............. ','MessageBox',FBoxStyle) of - 1: lbEvents.Items.Add('MessageBoxClick.<OK>'); - 2: lbEvents.Items.Add('MessageBoxClick.<Cancel>'); - 3: lbEvents.Items.Add('MessageBoxClick.<Abort>'); - 4: lbEvents.Items.Add('MessageBoxClick.<Retry>'); - 5: lbEvents.Items.Add('MessageBoxClick.<Ignore>'); - 6: lbEvents.Items.Add('MessageBoxClick.<Yes>'); - 7: lbEvents.Items.Add('MessageBoxClick.<No>'); - End; - FFocusControl:=nil; - EventWatch; -end; -//++++++++++++++++++++++++++++++++++ TBitBtn ++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.KindComboChange(Sender : TObject); -begin - If cbbKind.Text='bkOK' then - begin - BitBtn1.Kind := bkOK; - lbEvents.Items.Add('BitBtn1.Kind:=bkOk'); - end else if cbbKind.Text='bkCancel' then - begin - BitBtn1.Kind := bkCancel; - lbEvents.Items.Add('BitBtn1.Kind:=bkCancel'); - end else if cbbKind.Text='bkHelp' then - begin - BitBtn1.Kind := bkHelp; - lbEvents.Items.Add('BitBtn1.Kind:=bkHelp'); - end else if cbbKind.Text='bkClose' then - begin - BitBtn1.Kind := bkClose; - lbEvents.Items.Add('BitBtn1.Kind:=bkClose'); - end else if cbbKind.Text='bkAll' then - begin - BitBtn1.Kind := bkAll; - lbEvents.Items.Add('BitBtn1.Kind:=bkAll'); - end else if cbbKind.Text='bkCustom' then - begin - BitBtn1.Kind := bkCustom; - lbEvents.Items.Add('BitBtn1.Kind:=bkCustom'); - end; - EventWatch; -end; -procedure TForm1.AlignComboChange(Sender : TObject); -begin - If cbbAlign.Text='blGlyphLeft' then - begin - BitBtn1.Layout := blGlyphLeft; - lbEvents.Items.Add('BitBtn1.Layout:=blGlyphLeft'); - end else If cbbAlign.Text='blGlyphTop' then - begin - BitBtn1.Layout := blGlyphTop; - lbEvents.Items.Add('BitBtn1.Layout:=blGlyphTop'); - end else If cbbAlign.Text='blGlyphBottom' then - begin - BitBtn1.Layout := blGlyphBottom; - lbEvents.Items.Add('BitBtn1.Layout:=blGlyphBottom'); - end else If cbbAlign.Text='blGlyphRight' then - begin - BitBtn1.Layout := blGlyphRight; - lbEvents.Items.Add('BitBtn1.Layout:=blGlyphRight'); - end; - EventWatch; -end; -procedure TForm1.LoadGlyph(Sender : TObject);// This thing don't work +procedure TForm1.TestBitBtn; var -FileName : String; + Btn: TBitBtn; + dummy: TBBDummy; + rg: TRadioGroup; begin - lbEvents.Items.Add('TBITBTN.OpenDialog'); - EventWatch; - lbEvents.Items.Add('Select a 16X16 .xpm file'); - EventWatch; - - //OpenDialog1 := TOpenDialog.Create(Self); - If OpenDialog1.Execute then - FileName := OpenDialog1.FileName; - - if FileName <> '' then - begin - lbEvents.Items.Add(FileName+' selected'); - EventWatch; - - S := TFileStream.Create(UTF8ToSys(FileName), fmOpenRead); - try - PixMap1 := TPixMap.Create; - Pixmap1.TransparentColor := clBtnFace; - PixMap1.LoadFromStream(S); - finally - S.Free; - end; - BitBtn1.Glyph.Assign(PixMap1); - FreeAndNil(PixMap1); - end; - - lbEvents.Items.Add('<<< WORKS WITH STREAM.PIXMAPS >>>'); - EventWatch; -end; -//++++++++++++++++++++++++++++++++ TButton ++++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.Button1Click(Sender : TObject); -var -i : Integer; -begin - for i := 0 to 15 do - If Sender=Button1[i] then - begin - lbEvents.Items.Add('Button1['+IntToStr(i)+'].Click'); - ButtonTag(i); - end; - - EventWatch; -end; - -procedure TForm1.ButtonTag(Sender : Integer); -begin - If Button1[Sender].Caption = ' ' then - begin - Button1[Sender].Caption := IntToStr(Random(100)); - Button1[Sender].Hint := 'Lotto# '+Button1[Sender].Caption; - lbEvents.Items.Add('Button1['+IntToStr(Sender)+'].Random '+Button1[Sender].Caption); - EventWatch; - lblLResult.Caption := lblLResult.Caption+Button1[Sender].Caption; - Inc(LCount); - If LCount<16 then - lblLResult.Caption := lblLResult.Caption+',' - Else If LCount=16 then - lblLResult.Caption := lblLResult.Caption+'.' - End; -end; -procedure TForm1.LottoClear(Sender : TObject); -var -i : Integer; -begin - For i := 0 to 15 do - Begin - Button1[i].Caption := ' '; - lblLResult.Caption := 'Result: '; - LCount := 0; - End; -end; -//++++++++++++++++++++++++++++++++ TCanvas ++++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.DrawRect(X1,Y1,X2,Y2 : Integer); -begin - BenchForm[5].Canvas.Rectangle(X1,Y1,X2,Y2); -end; - -procedure TForm1.StyleSelect(Sender : TObject); -begin - If cbbBrushStyle.Text = 'bsBDiagonal' then - BenchForm[5].Canvas.Brush.Style := bsBDiagonal - Else If cbbBrushStyle.Text = 'bsClear' then - BenchForm[5].Canvas.Brush.Style := bsClear - Else If cbbBrushStyle.Text = 'bsCross' then - BenchForm[5].Canvas.Brush.Style := bsCross - Else If cbbBrushStyle.Text = 'bsDiagCross' then - BenchForm[5].Canvas.Brush.Style := bsDiagCross - Else If cbbBrushStyle.Text = 'bsFDiagonal' then - BenchForm[5].Canvas.Brush.Style := bsFDiagonal - Else If cbbBrushStyle.Text = 'bsHorizontal' then - BenchForm[5].Canvas.Brush.Style := bsHorizontal - Else If cbbBrushStyle.Text = 'bsVertical' then - BenchForm[5].Canvas.Brush.Style := bsVertical - Else If cbbBrushStyle.Text = 'bsSolid' then - BenchForm[5].Canvas.Brush.Style := bsSolid; - - //DebugLn('Trace:CANVAS.BRUSH.STYLE='+cbbBrushStyle.Text); -end; -procedure TForm1.ClearCanvas(Sender : TObject); -begin - BenchForm[5].Close; - BenchForm[5].Show; -end; - -procedure TForm1.GradCanvas(Sender : TObject); //Gradient Canvas -var -FColor, i : Integer; -begin - FColor := clBlack; - For i := 0 to 300 do - Begin - BenchForm[5].Canvas.Pen.Color := FColor; - BenchForm[5].Canvas.LineTo(400,i); - BenchForm[5].Canvas.MoveTo(0,i); - If i > 40 then - FColor := FColor + 1; - End; -end; -procedure TForm1.PenStyleSelect(Sender : TObject); -begin - If cbbPenStyle.Text = 'psClear' then - BenchForm[5].Canvas.Pen.Style := psClear - Else If cbbPenStyle.Text = 'psDash' then - BenchForm[5].Canvas.Pen.Style := psDash - Else If cbbPenStyle.Text = 'psDashDot' then - BenchForm[5].Canvas.Pen.Style := psDashDot - Else If cbbPenStyle.Text = 'psDashDotDot' then - BenchForm[5].Canvas.Pen.Style := psDashDotDot - Else If cbbPenStyle.Text = 'psDot' then - BenchForm[5].Canvas.Pen.Style := psDot - Else If cbbPenStyle.Text = 'psSolid' then - BenchForm[5].Canvas.Pen.Style := psSolid; - - //DebugLn('Trace:CANVAS.PEN.STYLE='+cbbPenStyle.Text); -end; -//++++++++++++++++++++++++++++++++ TCheckBox ++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.CheckClick(Sender : TObject); -var -i : Integer; -begin - For i:= 1 to 35 do - begin - If Sender=CheckBox1[i] then - begin - lbEvents.Items.Add('CheckBox1['+IntToStr(i)+'].Click'); - EventWatch; - //DebugLn('Trace: CheckBox1['+IntToStr(i)+']Clicked'); - If i = RandCh then - begin - lblPick.Caption := 'Thatīs the one !!'; - CheckBox1[i].Hint := 'Thatīs the one !!'; - lbEvents.Items.Add('VICTORY !!'); - EventWatch; - //DebugLn('Trace: VICTORY !!'); - End Else - begin - lblPick.Caption := 'Nop, try again !!'; - CheckBox1[i].Hint := 'Already picked'; - lbEvents.Items.Add('NOP !!'); - EventWatch; - //DebugLn('Trace: NOP !!'); - end; - CHCount := CHCount + 1; - lblCount.Caption := 'Counter: '+IntToStr(CHCount); - end; - end; -end; -procedure TForm1.AgainClick(Sender : Tobject); -var -i : Integer; -begin - RandCH := 0; - While RandCH < 1 do - RandCH := Random(35); - For i := 1 to 35 do - If CheckBox1[i].Checked = True then - begin - CheckBox1[i].Checked:= not CheckBox1[i].Checked; - CheckBox1[i].Hint := 'Maybe this one'; - end; - - CHCount := 0; - lblCount.Caption := 'Counter: '+IntToStr(CHCount); - lblPick.Caption := 'Better luck this time !!'; - lbEvents.Items.Add('Donīt look, but itīs #'+IntToStr(RandCH)); - EventWatch; -end; -//++++++++++++++++++++++++++++++++ TColorDialog +++++++++++++++++++++++++++++++++++++ -procedure TForm1.ColorSelect(Sender : TObject); -begin - If ColorDialog1.Execute then - If Sender=btnPenColor then - Begin - BenchForm[5].Canvas.Pen.Color := ColorDialog1.Color; - //DebugLn('Trace: CANVAS.PEN.COLOR='+IntToStr(ColorDialog1.Color)); - End Else If Sender=btnBrushColor then - Begin - BenchForm[5].Canvas.Brush.Color := ColorDialog1.Color; - End Else If Sender=btnColorSelect then - Begin - BenchForm[9].Canvas.Brush.Color := ColorDialog1.Color; - BenchForm[9].Canvas.Pen.Color := ColorDialog1.Color; - lblColorInt.Caption := 'Integer Color: '+IntToStr(ColorDialog1.Color); - End; - lbEvents.Items.Add('TCOLOR.Selected='+IntToStr(ColorDialog1.Color)); - EventWatch; -End; - -procedure TForm1.SelectedColor(Sender : TObject); -begin - ColorSelect(Sender); - BenchForm[9].Canvas.Rectangle(10,35,53,70); -End; -//++++++++++++++++++++++++++++++++ TCombpoBox +++++++++++++++++++++++++++++++++++++++ -procedure TForm1.AddToCbb(Sender : TObject); -begin - If edtCbbAdd.Text <> '' then - begin - ComboBox1.Items.Add(edtCbbAdd.Text); - lbEvents.Items.Add('TCOMBOBOX.Items.Add('+edtCbbAdd.Text+')'); - EventWatch; - //DebugLn('Trace: TCOMBOBOX.Item.Add('+edtCbbAdd.Text+')'); - lblRemoved.Caption := edtCbbAdd.Text+' Added'; - edtCbbAdd.Text := ''; - end; -end; - -procedure TForm1.RemoveCbb(Sender : TObject); -begin - If ComboBox1.Items.Count>0 then - Begin - lblRemoved.Caption := ComboBox1.Items.Strings[ComboBox1.Items.Count-1]+' Removed'; - ComboBox1.Items.Delete(ComboBox1.Items.Count - 1); - end else - lblRemoved.Caption := ' '; -end; - -procedure TForm1.MoveToCbb(Sender : TObject); -begin - cbbMoveTo.Items.Add(ComboBox1.SelText); -end; -//++++++++++++++++++++++++++++++++ TFontDialog ++++++++++++++++++++++++++++++++++++++ -procedure TForm1.SelectFont(Sender : TObject); -begin - If FontDialog1.Execute then - begin - lblWhatFont.Caption := 'Font.Name: '+FontDialog1.Font.Name; - end; -end; -//++++++++++++++++++++++++++++++++ TForm ++++++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.FormBorder(Sender : TObject); -begin - If cbbBorder.Text='bsNone' then - BenchForm[19].BorderStyle := bsNone - else if cbbBorder.Text='bsSingle' then - BenchForm[19].BorderStyle := bsSingle - else if cbbBorder.Text='bsDialog' then - BenchForm[19].BorderStyle := bsDialog - else if cbbBorder.Text='bsToolWindow' then - BenchForm[19].BorderStyle := bsToolWindow - else if cbbBorder.Text='bsSizeable' then - BenchForm[19].BorderStyle := bsSizeable; - -end; -procedure TForm1.FormPosition(Sender : TObject); -begin - If cbbPosition.Text='poDesigned' then - BenchForm[19].Position := poDesigned - else if cbbPosition.Text='poDefault' then - BenchForm[19].Position := poDesigned - else if cbbPosition.Text='poDefaultPosOnly' then - BenchForm[19].Position := poDefaultPosOnly - else if cbbPosition.Text='poDefaultSizeOnly' then - BenchForm[19].Position := poDefaultSizeOnly - else if cbbPosition.Text='poScreenCenter' then - BenchForm[19].Position := poScreenCenter - else if cbbPosition.Text='poDesktopCenter' then - BenchForm[19].Position := poDesktopCenter - else if cbbPosition.Text='poMainFormCenter' then - BenchForm[19].Position := poMainFormCenter - else if cbbPosition.Text='poOwnerFormCenter' then - BenchForm[19].Position := poOwnerFormCenter; - -end; -//++++++++++++++++++++++++++++++++ TIniFile +++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.IniUpdate(Sender : TObject); -begin - with IniFile1 do - begin - WriteString('INFORMATION','Project',edtString.Text); - WriteFloat('INFORMATION','Version',StrToFloat(edtFloat.Text)); - WriteInteger('INFORMATION','Integer',StrToInt(edtInteger.Text)); - WriteDate('INFORMATION','Today',StrToDate(edtDate.Text)); - WriteTime('INFORMATION','Appstart',StrToTime(edtTime.Text)); - end; -end; -//++++++++++++++++++++++++++++++++ TLalel +++++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.SelectAlignment(Sender : TObject); -begin - If cbbAlignment.Text='taLeftJustify' then - Label1.Alignment := taLeftJustify - else if cbbAlignment.Text='taCenter' then - Label1.Alignment := taCenter - else if cbbAlignment.Text='taRightJustify' then - Label1.Alignment := taRightJustify; -end; -//++++++++++++++++++++++++++++++++ TListBox +++++++++++++++++++++++++++++++++++++++++ -Function TForm1.AddNotDub(AList: TCustomListBox; nText: String):Boolean; -begin - Result := AList.Items.IndexOf(nText)<0; - If Result then - AList.Items.Add(nText); -end; -procedure TForm1.ListBoxMove(Sender : TObject); -var -nItem : Integer; -begin - If Sender=btnRight then //Move from ListBox1 to ListBox2 - For nItem:=ListBox1.Items.Count-1 downto 0 do - If ListBox1.Selected[nItem] then - If AddNotDub(ListBox2,ListBox1.Items[nItem]) then //Check if exists - ListBox1.Items.Delete(nItem) - else - Application.MessageBox(' Do allready exist ','No',0); - If Sender=btnLEft then //Move from ListBox2 to ListBox1 - For nItem:=ListBox2.Items.Count-1 downto 0 do - If ListBox2.Selected[nItem] then - If AddNotDub(ListBox1,ListBox2.Items[nItem]) then //Check if exists - ListBox2.Items.Delete(nItem) - else - Application.MessageBox(' Do allready exist ','No',0); - If Sender=btnAdd then //Add from the Edits - begin - If edtAddLis1.Text<>'' then - If AddNotDub(ListBox1,edtAddLis1.Text) then //Check if exists - edtAddLis1.text := '' - else - Application.MessageBox(' Do allready exist ','No',0); - If edtAddLis2.Text<>'' then - If AddNotDub(ListBox2,edtAddLis2.Text) then //Check if exists - edtAddLis2.text := '' - else - Application.MessageBox(' Do allready exist ','No',0); - end; -end; -procedure TForm1.CopyToMem(Sender : TObject); -begin - memAddTo.Lines := ListBox1.Items; -end; - -procedure TForm1.SaveFile(Sender : TObject); -begin - ListBox1.Items.SaveToFile('./List.txt'); -end; -//++++++++++++++++++++++++++++++++ TMemo ++++++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.NewMemo(Sender : TObject); -begin - Memo1.Lines.Clear; -end; -procedure TForm1.SaveMemoAs(Sender : TObject); -begin - SaveDialog1.FileName := 'Untitled.txt'; - SaveDialog1.Filter := 'TextFiles|*.txt'; - If SaveDialog1.Execute then - Memo1.Lines.SaveToFile(UTF8ToSys(SaveDialog1.FileName)); - -end; -procedure TForm1.OpenMemo(Sender : TObject); -begin - OpenDialog1.Filter := 'TextFile|*.txt'; - If OpenDialog1.Execute then - Memo1.Lines.LoadFromFile(UTF8ToSys(OpenDialog1.FileName)); - -end; -//++++++++++++++++++++++++++++++++ TProgressBar +++++++++++++++++++++++++++++++++++++ -procedure TForm1.UpdateProgressBar(Sender : TObject); -begin - If ProgressBar1.Position > 99 then - ProgressBar1.Position := 0; - ProgressBar1.Position := ProgressBar1.Position + 1; - -end; -procedure TForm1.ProgSettings(Sender : TObject); -begin - If chbSmooth.State = cbChecked then - ProgressBar1.Smooth := False - Else ProgressBar1.Smooth := True; - - If chbProgEnable.State = cbChecked then - ProgTime.Enabled := True - Else ProgTime.Enabled := False; - - If chbProgOrient.State = cbChecked then - ProgressBar1.Orientation := pbVertical - Else ProgressBar1.Orientation := pbHorizontal; - - If (chbProgOrient.State = cbChecked) and (chbProgDirect.State = cbChecked) then - ProgressBar1.Orientation := pbTopDown - Else If (chbProgOrient.State = cbUnchecked) and (chbProgDirect.State = cbChecked) then - ProgressBar1.Orientation := pbRightToLeft; - - If chbProgText.State = cbChecked then - ProgressBar1.BarShowText := True - Else ProgressBar1.BarShowText := False; - + Clear; + Btn := TBitBtn.Create(nil); + dummy := TBBDummy.Create; + rg := TRadioGroup.Create(nil); + FObjList.Add(Btn); + FObjList.Add(dummy); + FObjList.Add(rg); + ConnectStandardEvents(Btn); + dummy.B := Btn; + Btn.Kind := bkOk; + Btn.ModalResult := mrNone; + Btn.AutoSize := True; + rg.Items.AddStrings(['bkCustom', 'bkOK', 'bkCancel', 'bkHelp', 'bkYes', 'bkNo', + 'bkClose', 'bkAbort', 'bkRetry', 'bkIgnore', 'bkAll', + 'bkNoToAll', 'bkYesToAll']); + rg.AutoSize := True; + rg.ItemIndex := Ord(Btn.Kind); + rg.OnClick := @dummy.OnRgKindClick; + Btn.Top := 10; + Btn.Left := 5; + rg.Top := Btn.Top + Btn.Height + 20; + rg.Left := Btn.Left; + Btn.Parent := TestPnl; + rg.Parent := TestPnl; end; -//++++++++++++++++++++++++++++++++ TPanel +++++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.PanelInBevelClick(Sender: TObject); -begin - case rgPanelInBevel.ItemIndex of - 0 : Panel1.BevelInner := bvLowered; - 1 : Panel1.BevelInner := bvRaised; - 2 : Panel1.BevelInner := bvNone; - 3 : Panel1.BevelInner := bvNone; - else - Panel1.BevelInner := bvNone; - end; - Panel1.Show; -end; - -procedure TForm1.PanelOutBevelClick(Sender: TObject); -begin - if rgPanelInBevel=nil then exit; - case rgPanelInBevel.ItemIndex of - 0 : Panel1.BevelOuter := bvLowered; - 1 : Panel1.BevelOuter := bvRaised; - 2 : Panel1.BevelOuter := bvNone; - 3 : Panel1.BevelOuter := bvNone; - else - Panel1.BevelOuter := bvNone; - end; - Panel1.Show; -end; - -procedure TForm1.PanelAlignClick(Sender: TObject); -begin - case rgPanelAlign.ItemIndex of - 0 : Panel1.Align := alNone; - 1 : Panel1.Align := alBottom; - 2 : Panel1.Align := alClient; - 3 : Panel1.Align := alLeft; - 4 : Panel1.Align := alRight; - 5 : Panel1.Align := alTop; - else - Panel1.Align := alNone; - end; - Panel1.Show; -end; - -procedure TForm1.PanelNormClick(Sender:TObject); -begin - with Panel1 do - begin - Left := 10; - Top := 10; - Width := 300; - Height := 100; - //Ctl3D := False; - Caption := 'Panel1'; - Visible := True; - Align := alNone; - BevelOuter := bvRaised; - BevelInner := bvNone; - end; -end; -//++++++++++++++++++++++++++++++++ TBevel +++++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.BevelSettings(Sender : TObject); -begin - if chbBevelShape=nil then exit; - case chbBevelShape.ItemIndex of - 0 : Bevel1.Shape := bsBox; - 1 : Bevel1.Shape := bsFrame; - 2 : Bevel1.Shape := bsTopLine; - 3 : Bevel1.Shape := bsBottomLine; - 4 : Bevel1.Shape := bsLeftLine; - 5 : Bevel1.Shape := bsRightLine; - end; - if chbBevelStyle=nil then exit; - if chbBevelStyle.ItemIndex = 0 - then Bevel1.Style := bsLowered - else Bevel1.Style := bsRaised -end; -//+++++++++++++++++++++++++++++++++ TRadioGroup +++++++++++++++++++++++++++++++++++++ -procedure TForm1.RadioGroupClick(Sender : TObject); -begin - RadioGroup1.Caption := ' Radio '+IntToStr(RadioGroup1.ItemIndex)+' Checked'; -end; -//+++++++++++++++++++++++++++++++++ TTimer ++++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.Timer1OnTimer(Sender : TObject); -begin -lblTimeNow.Caption := 'TimeNow: '+TimeToStr(Now); - If FTrack = True then - begin - MSec:=MSec+1; - If MSec>10 then - begin - Sec := Sec+1; - If Sec>59 then - begin - Min := Min+1; - lblHourMinSec.Caption:='Track: 00:0'+IntToStr(Min)+':00'; - Sec := 0; - end; - If Sec<10 then - lblHourMinSec.Caption:='Track: 00:0'+IntToStr(Min)+':0'+IntToStr(Sec) - else lblHourMinSec.Caption:='Track: 00:0'+IntToStr(Min)+':'+IntToStr(Sec); - MSec := 0; - end; - If MSec<10 then - lblMSec.Caption := ':0'+IntToStr(MSec) - Else lblMSec.Caption := ':'+IntToStr(MSec); - end; -end; -procedure TForm1.TimeTrack(Sender : TObject); -begin -Hour := 0; -Min := 0; -Sec := 0; -MSec := 0; - If FTrack = false then - begin - FTrack := True; - btnStart.Caption := 'Stop'; - end else - begin - FTrack := False; - btnStart.Caption := 'Start'; - lblHourMinSec.Caption := 'Track: 00:00:00'; - end; -end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//++++++++++++++++++++++++++++++++ Universal Tools ++++++++++++++++++++++++++++++++++ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.ShowTestForm(Sender : TObject); -begin - AboutForm.Show; -end; -//++++++++++++++++++++++++++++++++++++++++++++++++++ EVENTS ++++++++++++++++++ -procedure TForm1.EventFormShow(Sender : TObject); -begin - EventForm.Show; - //DebugLn('Trace: EventFormShow'); -end; - -procedure TForm1.EventOnMouseDown(Sender : TObject; Button : TMouseButton; Shift : TShiftState; X,Y : Integer); -begin - lbEvents.Items.Add(Sender.ClassName+'.MouseDown '+IntToStr(X)+','+IntToStr(Y)); - EventWatch; - //DebugLn('Trace:'+Sender.ClassName+'.EventOnMouseDown'); - If Sender = BenchForm[5] then - Begin - //DebugLn('Trace: CANVAS.PaintWhat='+cbbPaintType.Text); - If cbbPaintType.Text = 'LineTo' then - Begin - BenchForm[5].Canvas.MoveTo(X,Y); - lbEvents.Items.Add('TFORM.CANVAS.MoveTo: '+IntToStr(X)+','+IntToStr(Y)); - EventWatch; - End Else - Begin - Start1 := X; - Start2 := Y; - lbEvents.Items.Add('TFORM.CANVAS.RectStartPos: '+IntToStr(X)+','+IntToStr(Y)); - EventWatch; - end; - FPaint := True; - End; -end; - -procedure TForm1.EventOnMouseUp(Sender : TObject; Button : TMouseButton; Shift : TShiftState; X,Y : Integer); -begin - lbEvents.Items.Add(Sender.ClassName+'.MouseUp '+IntToStr(X)+','+IntToStr(Y)); - EventWatch; - //DebugLn('Trace:'+Sender.ClassName+'.EventOnMouseUp'); -//+++++++ TCanvas ++++++++++++++++++++++++ - If Sender = BenchForm[5] then - FPaint := False; - If Sender = ComboBox1 then - Begin - lblSelLength.Caption := 'SelLength: '+IntToStr(ComboBox1.SelLength); - lblSelStart.Caption := 'SelStart: '+IntToStr(ComboBox1.SelStart); - lblSelText.Caption := 'SelText: '+ComboBox1.SelText; - end; - If Sender=SpinEdit1 then - lblOnChange.Caption := 'Value: '+FloatToStr(SpinEdit1.Value); -end; - -procedure TForm1.EventOnMouseMove(Sender : TObject; Shift : TShiftState; X,Y : Integer); -begin - If Sender = BenchForm[5] then - Begin - If FPaint = True then - begin - If cbbPaintType.Text='LineTo' then - begin - BenchForm[5].Canvas.LineTo(X,Y); - lbEvents.Items.Add('TFORM.CANVAS.LineTo: '+IntToStr(X)+','+IntToStr(Y)); - EventWatch; - End else - begin - DrawRect(Start1,Start2,X,Y); - lbEvents.Items.Add('TFORM.CANVAS.Rectangle: '+IntToStr(X)+','+IntToStr(Y)); - EventWatch; - end; - end; - End Else - begin - lbEvents.Items.Add(Sender.ClassName+'.MouseMove '+IntToStr(X)+','+IntToStr(Y)); - EventWatch; - end; -end; - -procedure TForm1.EventOnMouseEnter(Sender : TObject); -begin - -end; - -procedure TForm1.EventOnMouseLeave(Sender : TObject); -begin - -end; - -procedure TForm1.EventOnClick(Sender : TObject); -begin - if lbEvents=nil then exit; - lbEvents.Items.Add(Sender.ClassName+'.Click'); - EventWatch; - //DebugLn('Trace:'+Sender.ClassName+'.EventOnClick'); - If Sender.ClassName='TBUTTON' then - Button1Click(Sender); - If Sender.ClassName='TRADIOGROUP' then - RadioGroupClick(Sender); - If Sender.ClassName='TCHECKBOX' then - CheckClick(Sender); - If Sender=ToggleBox1 then - Begin - If ToggleBox1.Checked = true then - lblChecked.Caption := 'Checked= True' - Else lblChecked.Caption := 'Checked= False'; - If ToggleBox1.State= cbChecked then - lblState.Caption := 'State= cbChecked' - Else lblState.Caption := 'State= cbUnchecked'; - end; - If Sender.ClassName='TPAINTBOX' then - begin - with TPaintBox(Sender).canvas do - begin - moveto (0,0); - inc (pntCount); - lineto (100, pntCount * 10); - end; - end; -end; - -procedure TForm1.EventOnDblClick(Sender : TObject); -begin - lbEvents.Items.Add(Sender.ClassName+'.DoubleClick'); - EventWatch; - //DebugLn('Trace: EventOnDblClick'); -end; - -procedure TForm1.EventOnResize(Sender : TObject); -begin - lbEvents.Items.Add('TFORM.Width: '+IntToStr(BenchForm[19].Width)); - lbEvents.Items.Add('TFORM.Height: '+IntToStr(BenchForm[19].Height)); - EventWatch; - //DebugLn('Trace: EventOnReSize'); - lblWidth.Caption := 'Width: '+IntToStr(BenchForm[19].Width); - lblWidth.Caption := 'Height: '+IntToStr(BenchForm[19].Height); -end; - -procedure TForm1.EventOnShow(Sender : TObject); -var -i : Integer; -begin - For i:=1 to 59 do - begin - If Sender=BenchForm[i] then - begin - lbEvents.Items.Add('TESTFORM['+IntToStr(i)+'].EventOnShow '+TimeToStr(Now)); - EventWatch; - //DebugLn('Trace:TESTFORM['+IntToStr(i)+'].EventOnShow'); - end; - end; -end; - -procedure TForm1.EventOnChange(Sender : TObject); -begin - if not (assigned (lbEvents)) then exit; - - lbEvents.Items.Add(Sender.ClassName+'.Change'); - EventWatch; - //DebugLn('Trace: EventOnChange'); - If Sender=ComboBox1 then - begin - lblIndex.Caption := 'ItemIndex: '+IntToStr(ComboBox1.ItemIndex); - lbEvents.Items.Add('ComboBox1.ItemIndex='+IntToStr(ComboBox1.ItemIndex)); - EventWatch; - //DebugLn('Trace: ComboBox1.ItemIndex='+IntToStr(ComboBox1.ItemIndex)); - end; - If Sender=TrackBar2 then - begin - TrackBar1.PageSize := TrackBar1.PageSize + 1; - end; -end; - -procedure TForm1.EventOnKeyDown(Sender : TObject; var Key : Word; Shift : TShiftState); -begin - If Sender=Edit1 then - begin - lbEvents.Items.Add(Sender.ClassName+'.Text='+Edit1.Text); - EventWatch; - //If Edit1.Modified = True then //To get Edit1.OnChange event - //EventOnChange(Sender); - end; - - lbEvents.Items.Add(Sender.ClassName+'.EventKeyDown'); - EventWatch; - //DebugLn('Trace:'+Sender.ClassName+'.EventKeyDown '+IntToStr(Key)); -end; - -procedure TForm1.EventOnKeyUp(Sender : TObject; var Key : Word; Shift : TShiftState); -begin - -end; -//+++++++++++++++++++++ Virtual MouseEnter/Leave ++++++++++++++++++++++++++++++++++++ -procedure TForm1.ApplicationIdle(Sender: TObject; var Done: Boolean); -var - CurControl: TControl; - P: TPoint; - F: TForm; - i: Integer; -begin - //Only perform OnIdle if either the mainform or one of the BenchForms is active - //e.g. if a ShowMessage is showing, FFocusControl may point to an aready - //destroyed component, thus crashing the application. - F := Screen.ActiveForm; - if not Assigned(F) then Exit; - if (F <> Self) then - begin - for i := Low(BenchForm) to High(BenchForm) do - if (BenchForm[i] = F) then Break; - //writeln('Not the MainForm or a BenchForm'); - Exit; - end; - GetCursorPos(P); - CurControl := FindControlAtPosition(P, True); - if FFocusControl <> CurControl then - begin - if FFocusControl <> nil then - VirOnLeave(FFocusControl); - FFocusControl := CurControl; - if FFocusControl <> nil then - VirOnEnter(FFocusControl); - end; -end; -procedure TForm1.VirOnEnter(Sender: TObject); -begin - lbEvents.Items.Add(Sender.ClassName+'.MouseEnter'); - EventWatch; - //DebugLn('Trace:'+Sender.ClassName+'.EventOnEnter'); -end; -procedure TForm1.VirOnLeave(Sender: TObject); -begin - lbEvents.Items.Add(Sender.ClassName+'.MouseLeave'); - EventWatch; - //DebugLn('Trace:'+Sender.ClassName+'.EventOnLeave'); -end; -//++++++++++++++++++++++ Event Watch ++++++++++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.EventWatch; -begin - If lbEvents.Items.Count>18 then - lbEvents.Items.Delete(0); -end; -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -procedure TForm1.TestFormClose(Sender : TObject; var CloseAction : TCloseAction); -var -i : Integer; -begin - For i:=1 to 59 do - begin - If Sender=BenchForm[i] then - begin - lbEvents.Items.Add('TESTFORM['+IntToStr(i)+'].EventOnClose '+TimeToStr(Now)); - EventWatch; - //DebugLn('Trace:TESTFORM['+IntToStr(i)+'].EventOnClose'); - End; - End; - - Form1.Visible := True; - //Form1.WindowState := wsNormal; - //Memo1.Parent:=Self; - Comps1.Enabled := True; - EventForm.Caption := 'Events'; - //Timer1.Enabled := False; -end; - -procedure TForm1.ShowMessage0(Sender : TObject); -begin - AppliCation.MessageBox(Info[0],'Status Information',0); //For future components -end; - -procedure TForm1.ShowMessage1(Sender : TObject); -begin - If Sender=TAppl then - begin - BenchForm[1].Show; - EventForm.Caption := EventForm.Caption+' TApplication'; - //DebugLn('Trace: >>> TApplication TEST'); - end; - If Sender=TBev then - begin - BenchForm[2].Show; - EventForm.Caption := EventForm.Caption+' TBevel'; - //DebugLn('Trace: >>> TBevel TEST'); - end; - If Sender=TBit then - Begin - BenchForm[3].Show; - EventForm.Caption := EventForm.Caption+' BitBtn1'; - //DebugLn('Trace: >>> TBitBtn TEST'); - end; - If Sender=TBut then - begin - BenchForm[4].Show; - EventForm.Caption := EventForm.Caption+' Button1[0..15]'; - //DebugLn('Trace: >>> TButton TEST'); - end; - If Sender=TCan then - begin - BenchForm[5].Show; - EventForm.Caption := EventForm.Caption+' TCanvas'; - //DebugLn('Trace: >>> TCanvas TEST'); - end; - If Sender=TChe then - begin - BenchForm[6].Show; - EventForm.Caption := EventForm.Caption+' CheckBox1[1..35]'; - //DebugLn('Trace: >>> TCheckBox TEST'); - end; - If Sender=TClip then - begin - BenchForm[7].Show; - EventForm.Caption := EventForm.Caption+' ClipBoard1'; - //DebugLn('Trace: >>> TClipBoard TEST'); - end; - If Sender=TCLis then - begin - BenchForm[8].Show; - EventForm.Caption := EventForm.Caption+' CListBox1'; - //DebugLn('Trace: >>> TCListBox TEST'); - end; - If Sender=TCol then - begin - BenchForm[9].Caption := BenchForm[9].Caption+' ++Move the form to se the Color-Selected <^>'; - BenchForm[9].Show; - EventForm.Caption := EventForm.Caption+' TColorDialog'; - //DebugLn('Trace: >>> TColorDialog TEST'); - //DebugLn('Trace: **********************************'); - //DebugLn('Trace: ******** MOVE THE FORM TO ********'); - //DebugLn('Trace: ******** TO SE THE COLOR ********'); - //DebugLn('Trace: ******** SELECTED !!! ********'); - //DebugLn('Trace: **********************************'); - end; - If Sender=TCom then - begin - BenchForm[10].Show; - EventForm.Caption := EventForm.Caption+' TComboBox'; - //DebugLn('Trace: >>> TComboBox TEST'); - end; - If Sender=TDir then - begin - BenchForm[11].Show; - EventForm.Caption := EventForm.Caption+' TDirectoryListBox'; - //DebugLn('Trace: >>> TDirectoryListBox TEST'); - end; - If Sender=TDra then - begin - BenchForm[12].Show; - EventForm.Caption := EventForm.Caption+' TDrawGrid'; - //DebugLn('Trace: >>> TDrawGrid TEST'); - end; - If Sender=TDri then - begin - BenchForm[13].Show; - EventForm.Caption := EventForm.Caption+' TDriveComboBox'; - //DebugLn('Trace: >>> TDriveComboBox TEST'); - end; - If Sender=TEdi then - begin - BenchForm[14].Show; - EventForm.Caption := EventForm.Caption+' TEdit'; - //DebugLn('Trace: >>> TEdit TEST'); - end; - If Sender=TFile then - begin - BenchForm[15].Show; - EventForm.Caption := EventForm.Caption+' TFileListBox'; - //DebugLn('Trace: >>> TFileListBox TEST'); - end; - If Sender=TFilt then - begin - BenchForm[16].Show; - EventForm.Caption := EventForm.Caption+' TFilterComboBox'; - //DebugLn('Trace: >>> TFilterComboBox TEST'); - end; - If Sender=TFin then - begin - BenchForm[17].Show; - EventForm.Caption := EventForm.Caption+' TFindDialog'; - //DebugLn('Trace: >>> TFindDialog TEST'); - end; - If Sender=TFon then - begin - BenchForm[18].Show; - EventForm.Caption := EventForm.Caption+' TFontDialog'; - //DebugLn('Trace: >>> TFontDialog TEST'); - end; - If Sender=TFor then - begin - BenchForm[19].Show; - EventForm.Caption := EventForm.Caption+' TForm'; - //DebugLn('Trace: >>> TForm TEST'); - end; - If Sender=TGro then - begin - BenchForm[20].Show; - EventForm.Caption := EventForm.Caption+' TGroupBox'; - //DebugLn('Trace: >>> TGoup TEST'); - end; - If Sender=TIma then - begin - BenchForm[21].Show; - EventForm.Caption := EventForm.Caption+' TImage'; - //DebugLn('Trace: >>> TImage TEST'); - end; - If Sender=TIni then - begin - BenchForm[22].Show; - EventForm.Caption := EventForm.Caption+' TIniFile'; - //DebugLn('Trace: >>> TIniFile TEST'); - end; - If Sender=TLab then - begin - BenchForm[23].Show; - EventForm.Caption := EventForm.Caption+' TLabel'; - //DebugLn('Trace: >>> TLabel TEST'); - end; - If Sender=TLis then - begin - BenchForm[24].Show; - EventForm.Caption := EventForm.Caption+' TListBox'; - //DebugLn('Trace: >>> TListBox TEST'); - end; - If Sender=TMas then - begin - BenchForm[25].Show; - EventForm.Caption := EventForm.Caption+' TMaskEdit'; - //DebugLn('Trace: >>> TMaskEdit TEST'); - end; - If Sender=TMed then - begin - BenchForm[26].Show; - EventForm.Caption := EventForm.Caption+' TMediaPlayer'; - //DebugLn('Trace: >>> TMediaPlayer TEST'); - end; - If Sender=TMem then - begin - Memo1.Parent := BenchForm[27]; - Memo1.Lines.Clear; - BenchForm[27].Show; - EventForm.Caption := EventForm.Caption+' TMemo'; - //DebugLn('Trace: >>> TMemo TEST'); - end; - If Sender=TMes then - begin - BenchForm[28].Show; - EventForm.Caption := EventForm.Caption+' TMessageDialog'; - //DebugLn('Trace: >>> TMessageDialog TEST'); - end; - If Sender=TNot then - begin - BenchForm[29].Show; - EventForm.Caption := EventForm.Caption+' TNoteBook'; - //DebugLn('Trace: >>> TNoteBook TEST'); - end; - If Sender=TOpe then - begin - BenchForm[30].Show; - EventForm.Caption := EventForm.Caption+' TOpenDialog'; - //DebugLn('Trace: >>> TOpenDialog TEST'); - end; - If Sender=TPag then - begin - BenchForm[31].Show; - EventForm.Caption := EventForm.Caption+' TPageControl'; - //DebugLn('Trace: >>> TPageControl TEST'); - end; - If Sender=TPai then - begin - BenchForm[32].Show; - EventForm.Caption := EventForm.Caption+' TPaintBox'; - //DebugLn('Trace: >>> TPaintBox TEST'); - end; - if Sender=TPan then - begin - BenchForm[33].Show; - EventForm.Caption := EventForm.Caption+' TPanel'; - //DebugLn('Trace: >>> TPanel TEST'); - end; - If Sender=TPop then - begin - BenchForm[34].Show; - EventForm.Caption := EventForm.Caption+' TPopupMenu'; - //DebugLn('Trace: >>> TPopupMenu TEST'); - end; - If Sender=TPro then - begin - BenchForm[37].Show; - EventForm.Caption := EventForm.Caption+' TProgressBar'; - //DebugLn('Trace: >>> TProgressBar TEST'); - end; - If Sender=TRadB then - begin - BenchForm[38].Show; - EventForm.Caption := EventForm.Caption+' TRadioButton'; - //DebugLn('Trace: >>> TRadioButton TEST'); - end; - If Sender=TRadG then - begin - BenchForm[39].Show; - EventForm.Caption := EventForm.Caption+' TRadioGroup'; - //DebugLn('Trace: >>> TRadioGroup TEST'); - end; - If Sender=TSav then - begin - BenchForm[42].Show; - EventForm.Caption := EventForm.Caption+' TSaveDialog'; - //DebugLn('Trace: >>> TSaveDialog TEST'); - end; - If Sender=TScre then - begin - BenchForm[43].Show; - EventForm.Caption := EventForm.Caption+' TScreen'; - //DebugLn('Trace: >>> TScreen TEST'); - end; - If Sender=TScroBa then - begin - BenchForm[44].Show; - EventForm.Caption := EventForm.Caption+' TScrollBar'; - //DebugLn('Trace: >>> TScrollBar TEST'); - end; - If Sender=TSha then - begin - BenchForm[46].Show; - //AppliCation.MessageBox(Info[3],'Status Information',0); - EventForm.Caption := EventForm.Caption+' TShape'; - //DebugLn('Trace: >>> TShape TEST'); - end; - If Sender=TSpee then - begin - BenchForm[47].Show; - //AppliCation.MessageBox(Info[3],'Status Information',0); - EventForm.Caption := EventForm.Caption+' TSpeedButton'; - //DebugLn('Trace: >>> TSpeedButton TEST'); - end; - If Sender=TSPinE then - begin - BenchForm[49].Show; - //AppliCation.MessageBox(Info[3],'Status Information',0); - EventForm.Caption := EventForm.Caption+' TSpinEdit'; - //DebugLn('Trace: >>> TSpinEdit TEST'); - end; - If Sender=TStat then - begin - BenchForm[50].Show; - //AppliCation.MessageBox(Info[3],'Status Information',0); - EventForm.Caption := EventForm.Caption+' TStatusBar'; - //DebugLn('Trace: >>> TStatusBar TEST'); - end; - If Sender=TThre then - begin - BenchForm[54].Show; - Timer1.Enabled := True; - EventForm.Caption := EventForm.Caption+' TThread'; - //DebugLn('Trace: >>> TThread TEST'); - end; - If Sender=TTim then - begin - BenchForm[55].Show; - Timer1.Enabled := True; - EventForm.Caption := EventForm.Caption+' TTimer'; - //DebugLn('Trace: >>> TTimer TEST'); - end; - If Sender=TTog then - begin - BenchForm[56].Show; - //AppliCation.MessageBox(Info[2],'Status Information',0); - end; - If Sender=TToo then - begin - BenchForm[57].Show; - EventForm.Caption := EventForm.Caption+' TToolBar'; - //DebugLn('Trace: >>> TToolBar TEST'); - end; - If Sender=TTrac then - begin - BenchForm[58].Show; - EventForm.Caption := EventForm.Caption+' TTrackBar'; - //DebugLn('Trace: >>> TTrackBar TEST'); - end; - //Comps1.Enabled := False; - Form1.Visible := False; -end; - -procedure TForm1.CloseAbout(Sender : TObject); -begin - AboutForm.Close; -end; - -procedure TForm1.Notification(AComponent: TComponent; Operation: TOperation); -begin - inherited Notification(AComponent, Operation); - if (AComponent=FFocusControl) and (Operation=opRemove) then - FFocusControl:=nil; -end; - -procedure TForm1.QuitClick(Sender : TObject); -begin - Close; -end; - -Destructor TForm1.Destroy; -begin - IniFile1.Free; - inherited Destroy; -end; -