[fpc-pascal] Linux : Using SDL with GTK2 ?

Andrew Haines AndrewD207 at aol.com
Fri Nov 16 20:42:05 CET 2007

T.Guilleminot wrote:
> 1. I'm unsure of chronology of things to do in the program body. Is the
> following correct :
>    a) Create GTK stuff
>    c) SDL_INIT
>    d) Show GTK widgets

Yes that's right. With the only exception being that you have to use
gtk_widget_realize on whatever gtk widget you are using for sdl so that
the x11 window will be allocated.

> 2. You mentioned "this is for gtk1 only. gtk2 is similar but different".
> What to do for GTK2 ?

I've attached a simple program that will compile for gtk1 or gtk2. you
can change a define at the top of the source to switch between gtk 1 or 2.

> 3. Which kind of GTK Object "APanel" can be ?
> 4. FPC complains on "handle". What's wrong ?

Sorry I thought you were using the LCL and so my example was for that. I
attached an example program that doesn't use the LCL.

> Thanks Again.
> Tom

It's worth noting that you cannot have more than one sdl window per
application. It's a limitation of sdl.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: project1.lpr
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20071116/d2fbd7c9/attachment.ksh>

More information about the fpc-pascal mailing list