Zitat von SteveG <[EMAIL PROTECTED]>:

> Need some pointers on the way Laz/fpc handle gtkwidgets if possible.
>
> I am attempting (as a test) to get and then set the size and position of
> a Laz form using Gtk / Gdk - (not necessary I know, just leading to
> further things)

See in gtk intf:
procedure SetWindowSizeAndPosition


> The Form1.Handle is a pointer to a gtkwidget - saved as 'WinHandle'.
>  From this, I can retrieve its name, and so know I have the right pointer.

The type depends on various settings. But normallly a TForm is a
gtk_window_get_type.


> How can I alter the forms size / pos using the widget handle ?

You can only give suggestions, which are given by the gtk to the window manager
which decides what to do with them.


> TGtkWidget( PGtkWidget(Winhandle)^).allocation.width  - returns garbage

It's the last allocated width.

> gtk_widget_size_request(Winhandle, @GtkAllocation) - returns 0's

This tells gtk to compute a nice size (typically the minimum size). It can only
be computed after the window was realized and some other things have been done.


> Working on the theory that I have to use the GDKWindow instead,
> TGtkWidget( PGtkWidget(Winhandle)^).Window - returns a number (no idea
> if its correct)

The gdk_window exists only after it has been mapped. For top level widgets like
a normal gtk_window 'realized' and 'mapped' happen together.


> but trying to use it with any GDK_Window_ procedures gives various
> errors (depending on proc called)

And depending on the time of use.


> Even simply attempting to get the TopLevel windows seems beyond me -
> gList := gdk_window_get_toplevels();
> gdk_window_get_position( GDK_WINDOW(gList^.data), pXPos, pYPos);
>
> fails with 'GLib-GObject-CRITICAL - use IA__g_type_init() prior to this
> function
> though I can easily accept that my understanding of glists is built on
> shakey ground

See TGtkWidgetSet.GetActiveWindow for an example.


> I know that Laz/fpc can handle most of this 'internally' for its own
> forms/controls - I am wanting to extend programming control outside of
> my app itself
> eg - finding xcalc by name, moving / sizing / keystrokes / etc (not just
> xcalc obviously)
>
> Any suggestions appreciated, as its damned frustrating knowing whats
> possible using Gtk/Gdk/GScreen/etc - and its just out of reach :)

The gtk uses a different design than winapi/carbon/qt.
It is very modular, uses low level C with lots of object orientated sugar (low
learning curve), and uses for everything themes and rules. Fixed values are
only used as defaults if no rule exists. That means it is hard to '_only_
change the color or width of a widget to a fixed value', but it is easy to
create widgets that adapt to the target system.
It's more for programmers, than for designers.

Mattias

_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to