[lazarus] writing GTK programs

dvortex dvortex at netcourrier.com
Mon May 1 20:43:32 EDT 2000



Well, if you know delphi, it is fairly straight forward.

type
  TMyForm = Class(TForm)
  private
   {private stuff}
  Public
   Constructor Create(AOwner: TObject);
    MyLabel: TLabel;
    MyEditBox: TEdit;
  end;

var MyForm: TMyForm

...

Constructor Create(AOwner: TObject);
Begin
  inherited Create(AOwner);

  MyLabel := TLabel.Create;
  MyLabel.Text := "My Label";
  MyLabel.left := 20;
  MyLabel.Top := 50;
  MyLabel.Show;

  MyEditBox := TEdit.Create;
  MyEditBox.Text := "edit me";
  MyEditBox.Left := 40;
  MyEditBox.Top := 70;
  MyEditBox.Show;

end;

...

and then, in the main project file, 

begin

  CreateForm(MyForm,TMyForm);
  Application.run;

end.


and that's it.. you have a form with a edit box and a label.
(well.. this one, if it compiles, would be UGLY ! )

but as an example, you can look at some of the "test" stuff.

Ho well.. i hope this helps :o)

PS: this code is bogus, i'm pretty sure it won't compile, but if you know
delphi, this should put you on the right track...

you can also look at the IDE code. it is a GOOD example .. and you might
even find a bug in there, and fix it,... who knows :o)

Good luck.. :)



On Mon, 1 May 2000, Chris Moody wrote:

> Hi,
> 
> Actually my question was more supposed to mean: Since Lazarus doesn't have a
> form editor, what commands do I use to create forms, put buttons on the
> form, ect.
> 
> I don't know GTK at all (being mainly a Winblowz person) and would like to
> increase my knowledge, but not sure where to start.
> 
> Chris
> ----- Original Message -----
> From: "dvortex" <dvortex at netcourrier.com>
> To: "Lazarus Mail" <lazarus at miraclec.com>
> Sent: Monday, May 01, 2000 4:37 PM
> Subject: Re: [lazarus] writing GTK programs
> 
> 
> > That is what lazarus is all about.
> >
> > code under one, run under all (TM) :o)
> >
> > Already, if you code some windowed application with lazarus under linux
> > for example, you can choose to compile it against GTK (gtk/win, GTK/lin,
> > qt, win32 --i'm not sure about that one, but i think it is on the way--,
> > or whatever is available. most of the code is already there, and if you
> > use only the component from the LCL, then it is full compliant with all
> > the supported Lazarus platforms...
> >
> > :o)
> >
> > Code once, use many, the ultimate Coding Tool... Lazarus...
> >
> > (sound good doesn't it ?)
> >
> >
> >
> > On Mon, 1 May 2000, Chris Moody wrote:
> >
> > > Hi all,
> > >
> > > I was wondering, has anyone written a file explaining how to write a GTK
> > > program in FPK? I suppose I could go thru the "How To" for C, and I'd
> prefer
> > > not to, if someone else has already done the work.
> > >
> > > Also, with out using GTK, or MOS, is there a way to write a Windowed
> program
> > > that would work in both Windows and Linux?
> > >
> > > Thanks,
> > >
> > > Chris
> > >
> > > _________________________________________________________________
> > >      To unsubscribe: mail lazarus-request at miraclec.com with
> > >                 "unsubscribe" as the Subject
> > >     archives at http://www.miraclec.com/list_archives/lazarus
> > >
> >
> > _________________________________________________________________
> >      To unsubscribe: mail lazarus-request at miraclec.com with
> >                 "unsubscribe" as the Subject
> >     archives at http://www.miraclec.com/list_archives/lazarus
> 
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>     archives at http://www.miraclec.com/list_archives/lazarus
> 






More information about the Lazarus mailing list