Re: Problem with table packing



Deekshit Mantampady <deekshit mantampady Wipro com> writes:

Hi,
  I have written on program to show a window with a menu bar in. I am
hereby sending the function also. I main program I am calling this
function. But when I execute it. The height of the window is more... ( I
am using a monitor of resoulution 1200x1000). The winodw goes even
beyond my botton border of monitor. Bu when I remove the lie
"gtk_table_attach_defaults" is is working properly, but without the menu
in it. Can any body hep me in this......


The code goes like this........

GtkWidget *menubar;
  mainwindow_ = gtk_window_new(GTK_WINDOW_TOPLEVEL);

  gtk_window_set_title(GTK_WINDOW(mainwindow_), "GTK View ");

  gtk_signal_connect (GTK_OBJECT (mainwindow_), "delete_event",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);

 gtk_window_set_default_size(GTK_WINDOW(mainwindow_), 800,600);

  maintable_ = gtk_table_new (800, 600, TRUE);
                                ^^^^^^^^

These are typically rows and columns, not pixels. 

You've said "800 rows, 600 columns, all the same size".

Typically, you'd use, say, 2 rows and 2 columns, and pass
FALSE for "homogenous"
 
  gtk_container_add (GTK_CONTAINER (mainwindow_), maintable_);


  get_main_menu (mainwindow_, &menubar);

  gtk_table_attach_defaults (GTK_TABLE(maintable_), menubar, 0, 599, 0,
20);

Here' you've put your menubar in the first 20 rows. This makes each
row 1/20 of the height of the menu bar, which will cause the remaining
780 rows to take up a lot of space.

I'd also advise never using gtk_table_attach_defaults(), since nobody
knows what the "defaults" are. (I don't, certainly)

Regards,
                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]