summaryrefslogtreecommitdiff
path: root/examples/gui
diff options
context:
space:
mode:
authordrewski207 <drewski207@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-27 14:31:46 +0000
committerdrewski207 <drewski207@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-27 14:31:46 +0000
commit620298d7b7385357029c652acabb64b87bb6bcde (patch)
treee412b7a224abdc8013470650bb367a95ff3dc4e2 /examples/gui
parentd460287312276cd014a27a34abfadbe6478007b4 (diff)
downloadfpGUI-620298d7b7385357029c652acabb64b87bb6bcde.tar.xz
* New Implementation of memo lines. much faster. there is at least one bug left :)
* new testapp using the memo
Diffstat (limited to 'examples/gui')
-rw-r--r--examples/gui/memo/memotest.lpi54
-rw-r--r--examples/gui/memo/memotest.lpr108
2 files changed, 162 insertions, 0 deletions
diff --git a/examples/gui/memo/memotest.lpi b/examples/gui/memo/memotest.lpi
new file mode 100644
index 00000000..a6792148
--- /dev/null
+++ b/examples/gui/memo/memotest.lpi
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <PathDelim Value="/"/>
+ <Version Value="6"/>
+ <General>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <IconPath Value="./"/>
+ <TargetFileExt Value=""/>
+ </General>
+ <VersionInfo>
+ <ProjectVersion Value=""/>
+ </VersionInfo>
+ <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 Use="True" PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+ </local>
+ </RunParams>
+ <RequiredPackages Count="1">
+ <Item1>
+ <PackageName Value="fpgui_package"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="1">
+ <Unit0>
+ <Filename Value="memotest.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="memotest"/>
+ </Unit0>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Linking>
+ <Debugging>
+ <GenGProfCode Value="True"/>
+ </Debugging>
+ </Linking>
+ <Other>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+</CONFIG>
diff --git a/examples/gui/memo/memotest.lpr b/examples/gui/memo/memotest.lpr
new file mode 100644
index 00000000..c3e106a8
--- /dev/null
+++ b/examples/gui/memo/memotest.lpr
@@ -0,0 +1,108 @@
+program memotest;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Classes,
+ typinfo,
+ fpgfx,
+ gfxbase,
+ gui_form,
+ gui_button,
+ gui_label,
+ gui_memo;
+
+type
+
+ { TMainForm }
+
+ TMainForm = class(TfpgForm)
+ private
+ memo: TfpgMemo;
+ btnQuit: TfpgButton;
+ procedure btnQuitClick(Sender: TObject);
+ procedure HandleResize(awidth, aheight: TfpgCoord); override;
+ public
+ constructor Create(AOwner: TComponent); override;
+ end;
+
+{ TMainForm }
+
+procedure TMainForm.btnQuitClick(Sender: TObject);
+begin
+ Close;
+end;
+
+procedure TMainForm.HandleResize(awidth, aheight: TfpgCoord);
+begin
+ inherited HandleResize(awidth, aheight);
+ if Assigned(Memo) then
+ begin
+ Memo.SetPosition(Memo.Left, Memo.Top, awidth-20, aheight- Memo.Top - 10);
+ btnQuit.Left := awidth - btnQuit.Width - 10;
+ btnQuit.UpdateWindowPosition;
+ end;
+end;
+
+constructor TMainForm.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ WindowTitle := 'Memo test';
+ SetPosition(100, 100, 300, 300);
+
+ memo := CreateMemo(self, 10, 40, 280, 150);
+
+ memo.Lines.Add('Memo Test0');
+ memo.Lines.Add('Memo Test1');
+ //memo.Lines.Add('Memo Test2');
+ //memo.Lines.Add('Memo Test3');
+ //memo.Lines.Add('Memo Test4');
+ memo.Lines.Insert(1,'0 Before 1 after');
+ //memo.Lines.Delete(1);
+ //memo.Lines.Text := 'Dude'+LineEnding+'What''s mine say?'+LineEnding;;
+ //memo.Lines.Text := memo.Lines.Text + 'Sweet'+LineEnding;
+ //memo.lines.LoadFromFile('/home/andrew/programming/groupprojects/fpgui/src/gui/gui_memo.pas');
+ //memo.lines.LoadFromFile('/usr/share/dict/cracklib-small');
+ {memo.lines.Add(memo.lines.text);
+ memo.lines.Add(memo.lines.text);
+ memo.lines.Add(memo.lines.text);
+ memo.lines.Add(memo.lines.text);}
+ {memo.lines.Add(memo.lines.text);
+ memo.lines.Add(memo.lines.text);
+ memo.lines.Add(memo.lines.text);
+ memo.lines.Add(memo.lines.text);
+ memo.lines.Add(memo.lines.text);
+ memo.lines.Add(memo.lines.text);}
+ {memo.lines.Add(memo.lines.text);
+ memo.lines.Add(memo.lines.text);
+ memo.lines.Add(memo.lines.text);}
+ { memo.Lines.Text := memo.Lines.Text + memo.Lines.Text;
+ memo.Lines.Text := memo.Lines.Text + memo.Lines.Text;
+ memo.Lines.Text := memo.Lines.Text + memo.Lines.Text;
+ memo.Lines.Text := memo.Lines.Text + memo.Lines.Text;
+ memo.Lines.Text := memo.Lines.Text + memo.Lines.Text;
+ memo.Lines.Text := memo.Lines.Text + memo.Lines.Text; }
+ btnQuit := CreateButton(self, 210, 10, 80, 'Quit', @btnQuitClick);
+ btnQuit.ImageName := 'stdimg.quit';
+ btnQuit.ShowImage := True;
+
+ HandleResize(Width, Height);
+
+end;
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+ frm := TMainForm.Create(nil);
+ frm.Show;
+ fpgApplication.Run;
+ frm.Free;
+end;
+
+begin
+ MainProc;
+end.