[Lazarus] GTK2 behaviors

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Jan 9 09:58:36 CET 2010


On Sat, 9 Jan 2010 01:07:46 +0100
Kjow <antispammoni at gmail.com> wrote:

> Hi all,
> 
> I need some GTK2 behaviors in my Lazarus application, so I added
> "gtk2" unit to uses... but how to "link" (???) my form with
> "PGtkWindow"?
> 
> e.g. new lazarus application with two buttons on the form:
> _________________________
> 
> unit main;
> 
> {$mode objfpc}{$H+}
> 
> interface
> 
> uses
>    ..., ..., gtk2;
> 
> ...
> ...
> ...
> 
> var
>   Form1: TForm1;
>   window :  PGtkWindow;
> 
> implementation
> 
> { TForm1 }
> 
> procedure TForm1.FormCreate(Sender: TObject);
> begin
>    window :=  gtk_window_new (GTK_WINDOW_TOPLEVEL); ------> it returns
> PGtkWidget, not PGtkWindow
>    //I think I need something that link window to Form1, but I don't
> know how/what...
> end;
> 
> procedure TForm1.Button1Click(Sender: TObject);
> begin
>   gtk_window_fullscreen(window);
> end;
> 
> procedure TForm1.Button2Click(Sender: TObject);
> begin
>   gtk_window_unfullscreen(window);

If you want to make a form full screen under gtk, use:
uses gtkproc;

SetWindowFullScreen(Form1,true);


Mattias




More information about the Lazarus mailing list