enhanced examples, stoppok

git-svn-id: trunk@16 -
This commit is contained in:
lazarus 2000-07-23 19:04:42 +00:00
parent 77a1bb679d
commit 7c2504eb94
2 changed files with 81 additions and 18 deletions

View File

@ -34,6 +34,8 @@ type
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Edit1 : TEdit;
mnuMain: TMainMenu;
itmFileQuit: TMenuItem;
@ -50,6 +52,8 @@ type
procedure Button2CLick(Sender : TObject);
procedure Button3CLick(Sender : TObject);
procedure Button4CLick(Sender : TObject);
procedure Button5CLick(Sender : TObject);
procedure Button6CLick(Sender : TObject);
procedure ComboOnChange (Sender:TObject);
procedure ComboOnClick (Sender:TObject);
end;
@ -90,6 +94,34 @@ Begin
then ComboBox1.Enabled := not ComboBox1.Enabled;
End;
procedure TForm1.Button5Click(Sender : TObject);
var
i : integer;
Begin
if assigned (ComboBox1) then
begin
i := 0;
while i < ComboBox1.Items.Count do
begin
if assigned (Memo1)
then Memo1.Lines.Add (ComboBox1.Items[i]);
inc (i);
end;
end;
End;
procedure TForm1.Button6Click(Sender : TObject);
var
s : shortstring;
Begin
if assigned (ComboBox1) then
begin
s := Format ('%x', [ComboBox1.ItemIndex]);
if assigned (Memo1)
then Memo1.Lines.Add (s);
end;
End;
procedure TForm1.ComboOnChange (Sender:TObject);
var
s : shortstring;
@ -172,6 +204,26 @@ begin
Button4.Caption := 'Enabled On/Off';
Button4.OnClick := @Button4Click;
Button5 := TButton.Create(Self);
Button5.Parent := Self;
Button5.Left := 50;
Button5.Top := 200;
Button5.Width := 120;
Button5.Height := 30;
Button5.Show;
Button5.Caption := 'Dump';
Button5.OnClick := @Button5Click;
Button6 := TButton.Create(Self);
Button6.Parent := Self;
Button6.Left := 50;
Button6.Top := 240;
Button6.Width := 120;
Button6.Height := 30;
Button6.Show;
Button6.Caption := 'Index ?';
Button6.OnClick := @Button6Click;
{ Create a label for the edit field }
label1 := TLabel.Create(Self);
@ -208,6 +260,7 @@ begin
label2.Enabled:= true;
label2.Show;
label2.Caption := 'Combo (unsorted)';
label2.Enabled:= true;
{ Create the menu now }
@ -216,14 +269,13 @@ begin
mnuMain := TMainMenu.Create(Self);
Menu := mnuMain;
itmFile := TMenuItem.Create(Self);
itmFile.Caption := 'File';
itmFile.Caption := '&File';
mnuMain.Items.Add(itmFile);
itmFileQuit := TMenuItem.Create(Self);
itmFileQuit.Caption := 'Quit';
itmFileQuit.Caption := '&Quit';
itmFileQuit.OnClick := @mnuQuitClicked;
itmFile.Add(itmFileQuit);
ComboBox1 := TComboBox.Create (self);
with ComboBox1 do
begin
@ -303,6 +355,9 @@ end.
{
$Log$
Revision 1.2 2000/07/23 19:04:42 lazarus
enhanced examples, stoppok
Revision 1.1 2000/07/13 10:28:20 michael
+ Initial import

View File

@ -46,8 +46,8 @@ type
Button8: TButton;
Track1 : TTRackBar;
Track2 : TTRackBar;
mnuBarMain: TMenuBar;
mnuFile: TMenu;
mnuMain: TMainMenu;
itmFile: TMenuItem;
itmFileQuit: TMenuItem;
constructor Create(AOwner: TComponent); override;
procedure LoadMainMenu;
@ -62,6 +62,7 @@ type
procedure Button6CLick(Sender : TObject);
procedure Button7CLick(Sender : TObject);
procedure Button8CLick(Sender : TObject);
procedure Track1Change(Sender : TObject);
end;
var
@ -141,6 +142,14 @@ Begin
end;
End;
procedure TForm1.Track1Change(Sender : TObject);
begin
if assigned (Track1) then begin
writeln ('*** CALLBACK ONCHANGE!!!!! ***');
Track1.PageSize := Track1.PageSize + 1;
end;
end;
{------------------------------------------------------------------------------}
procedure TForm1.FormKill(Sender : TObject);
@ -167,6 +176,7 @@ begin
Track1.Height := 140;
Track1.Min := 0;
Track1.Max := 100;
Track1.OnChange := @Track1Change;
Track1.Show;
{ Setting up vertical trackbar }
@ -264,19 +274,17 @@ begin
Button8.Show;
{ create a menubar }
mnuFile := TMenu.Create(nil);
mnuMain := TMainMenu.Create(Self);
Menu := mnuMain;
itmFileQuit := TMenuItem.Create(nil);
itmFileQuit.Caption := 'Quit';
itmFileQuit.OnClick := @mnuQuitClicked;
mnuFile.Items.Add (itmFileQuit);
mnuBarMain := TMenuBar.Create(self);
// mnuBarMain.Align := alTop;
mnuBarMain.AddMenu('File',mnuFile);
mnuBarMain.Show;
itmFile := TMenuItem.Create(Self);
itmFile.Caption := 'File';
Menu.Items.Add(itmFile);
itmFileQuit := TMenuItem.Create(Self);
itmFileQuit.Caption := 'Quit';
itmFileQuit.OnClick := @mnuQuitClicked;
itmFile.Add(itmFileQuit);
end;
{------------------------------------------------------------------------------}
@ -293,8 +301,8 @@ begin
end.
{
$Log$
Revision 1.1 2000/07/13 10:28:21 michael
+ Initial import
Revision 1.2 2000/07/23 19:04:42 lazarus
enhanced examples, stoppok
Revision 1.3 2000/06/18 08:07:18 lazarus
Enhanced trackbar example. stoppok