Recent

Author Topic: lazarus tools manual  (Read 6340 times)

hamza

  • Jr. Member
  • **
  • Posts: 52
lazarus tools manual
« on: March 16, 2015, 11:18:07 pm »
Hi to all

I need a manual that explain how to use lazarus pascal tools like updown switch....etc

Thank you and waiting your support.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4198
  • I like bugs.
Re: lazarus tools manual
« Reply #1 on: March 17, 2015, 12:55:14 am »
It cannot be used like an updown switch.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

hamza

  • Jr. Member
  • **
  • Posts: 52
Re: lazarus tools manual
« Reply #2 on: March 17, 2015, 01:03:18 pm »
Can u help me...i need example how to use updown tool in pascal???

Also i did not find pdf files that explain lazarus tools???

Eugene Loza

  • Hero Member
  • *****
  • Posts: 579
Re: lazarus tools manual
« Reply #3 on: March 17, 2015, 02:19:22 pm »
hamza, I don't know lazarus tools like updown switch...
I remember there was a kind of a switch in some ancient Delphi version (like 1.0) widgets. I even used it once or twice... But now I can't even find the picture of it in google.
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

tr_escape

  • Sr. Member
  • ****
  • Posts: 424
  • sector name toys | respect to spectre
    • Github:
Re: lazarus tools manual
« Reply #4 on: March 17, 2015, 02:49:37 pm »
Hello Hamza,

Do you mean you need a button or slider button to change some values?

If so lazarus has got some nice buttons you can look in the attach.


But if not could you please explain much more about your project or idea?

Also you can use your orginal/native language.

Best regards


hamza

  • Jr. Member
  • **
  • Posts: 52
Re: lazarus tools manual
« Reply #5 on: March 17, 2015, 09:02:03 pm »
yes you are correct...im trying to change the values from 0-10 using updown..pl see below pic
so.plz i need just an example.

howardpc

  • Hero Member
  • *****
  • Posts: 4118
Re: lazarus tools manual
« Reply #6 on: March 17, 2015, 11:26:54 pm »
Try this. Start a new Lazarus project. Double-click the main form to generate an OnCreate event handler, and complete the unit as follows:

Code: [Select]
unit mainUpDown;

{$mode objfpc}{$H+}

interface

uses
  Classes, Forms, ComCtrls, Spin;

type

  { TForm1 }

  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    spinEdit: TSpinEdit;
    upDown: TUpDown;
    procedure upDownChangingEx(Sender: TObject; var AllowChange: Boolean;
                               NewValue: SmallInt; Direction: TUpDownDirection);
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.FormCreate(Sender: TObject);
begin
  upDown:=TUpDown.Create(Self);
  upDown.Top:=10;
  upDown.Left:=10;
  upDown.OnChangingEx:=@updownChangingEx;
  upDown.Parent:=Self;

  spinEdit:=TSpinEdit.Create(Self);
  spinEdit.Top:=10;
  spinEdit.Left:=upDown.BoundsRect.Right + 10;
  spinEdit.Value:=5;
  spinEdit.Parent:=Self;

  Caption:='UpDown demo';
end;

procedure TForm1.updownChangingEx(Sender: TObject; var AllowChange: Boolean;
  NewValue: SmallInt; Direction: TUpDownDirection);
begin
  case Direction of
    updDown: spinEdit.Value:=spinEdit.Value-1;
    updUp:   spinEdit.Value:=spinEdit.Value+1;
  end;
end;

end.


Then press F9.

tr_escape

  • Sr. Member
  • ****
  • Posts: 424
  • sector name toys | respect to spectre
    • Github:
Re: lazarus tools manual
« Reply #7 on: March 18, 2015, 07:17:41 am »
Hello,

Create a form and put a UpDown component.

Double click to OnChangingEx event and write that code:

Code: [Select]
procedure TForm1.UpDown1ChangingEx(Sender: TObject; var AllowChange: Boolean;
  NewValue: SmallInt; Direction: TUpDownDirection);
begin
  case Direction of
    updUp: begin
             Edit1.Text := IntToStr(NewValue);
    end;
    updDown: begin
             Edit1.Text := IntToStr(NewValue);
    end;
  end;
end;


Also you can use FloatSpinEdit and SpinEdit for changing values without coding too.


hamza

  • Jr. Member
  • **
  • Posts: 52
Re: lazarus tools manual
« Reply #8 on: March 21, 2015, 12:42:10 am »
Mr. tr_escape and Mr. howardpc  thank you for your help.

 

TinyPortal © 2005-2018