[Fwd: size]
- From: Martin Oberzalek <oberzalek chello at>
- To: "gnome-list-devel gnome org" <gnome-devel-list gnome org>
- Subject: [Fwd: size]
- Date: Tue, 18 Jan 2000 14:01:43 +0000
Greg Suing wrote:
>
> Here's what I use to get the size of my main window... it seems to
> work:
>
> GtkWidget *app;
> int w, h;
>
> ...
>
> w = GTK_WIDGET(GNOME_APP(app)->contents)->allocation.width;
> h = GTK_WIDGET(GNOME_APP(app)->contents)->allocation.height;
>
> Martin Oberzalek wrote:
> >
> > How can I get the current size of a widget?
Yes I tried the same, but I have a little bit other problem:
GtkWidget *window;
GtkWidget *scrolled_win;
GtkWidget *vbox;
int w,h;
scrolled_win added to window and vbox added to scrolled_win.
Now, I added some buttons,... to vbox.
When my programm start's up the window should be large enought
that the scrollbars are not needed and not visible.
So I tried it that way:
gtk_widget_show_all( window );
w = vbox->allocation.width;
h = vbox->allocation.height;
w = w + GTK_CONTAINER( vbox )->border_width * 2;
h = h + GTK_CONTAINER( vbox )->border_width * 2;
w = w +
GTK_WIDGET(GTK_SCROLLED_WINDOW(scrolled_win)->vscrollbar).allocation.width
h = h +
GTK_WIDGET(GTK_SCROLLED_WINDOW(scrolled_win)->hscrollbar).allocation.width
gtk_window_set_default_size( GTK_WINDOW( window ), w, h);
This works, but if the border_width of vbox is less then 4, the
window is'nt big enought, and the scrollbars are still visible.
Is there a better way?
--
2 Pi || ! 2 Pi <- == ?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]