Re: Problems with gtk_menu_popup



Hi,
    
evbox = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(hbox),evbox);

hboxe = gtk_hbox_new(FALSE,0);
 gtk_box_pack_start(GTK_BOX(hbox),hboxe,FALSE,FALSE,0);

   You have just added the hboxe and evbox in a single hbox..
"gtk_container_add(..,evbox)" actually takes up more amount of space
because it is equivalent to  gtk_box_pack_start (box, child, TRUE,
TRUE, 0);
 So, for "hboxe" only  less amount space will be allocated...

hbox2 = gtk_hbox_new(FALSE,0);
 gtk_box_pack_start(GTK_BOX(hboxe),hbox2,FALSE,FALSE,0);

    here, the hbox2 is being added to the hboxe... When you add a
button into it.. The entire packings will look like the following...

+------------------------------------------------hbox-----------------------------------------------------------+
| + ----------------------------------------------------------------------+
+-------hboxe----------------+   |
|  |                                                                  
     |  | + ------hbox2----------+  |    |
|  |         evbox                                                    
 |  |  |  +-------------------+  |   |    |
|  |                                                                  
     |  |  |  |   button        |   |   |    |
|  |                                                                  
     |  |  |  +------------------+   |   |    |
|  |                                                                  
     |  |  +--------------------------+  |   |
|  +----------------------------------------------------------------------+
+---------------------------------+  |
+------------------------------------------------------------------------------------------------------------------+

I think, now you have understood the concept... 

now i can add them horizontally but the problem is that when i add a
button it is placed at the right of the dashboard, an i want it at the
left...do you know how to do this?

To solve this problem... Just do this..

evbox = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(hbox),evbox);

hboxe = gtk_hbox_new(FALSE,0);
  //gtk_box_pack_start(GTK_BOX(hbox),hboxe,FALSE,FALSE,0);
  gtk_container_add (GTK_CONTAINER (evbox), hboxe);

Eventbox still receive the events... So don't have to worry about
it..If all the evbox space is occupied by the buttons (that you
dynamically add), then you will receive no more events..

-- 
Santhosh.
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
Project - http://eccvs.sf.net
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~



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