Re: align drawing area in vbox or hbox

I found the problem, I forgot to call gtk_widget_show(align). Thanks again,
it's working now.


yanxin wrote:

Here is my source code:

Note: psImage is my struct

  /* Create the raw drawing area. */
  psImage->psDrawingArea = psDrawingArea = gtk_drawing_area_new();
  gtk_drawing_area_size (GTK_DRAWING_AREA(psDrawingArea),
   psImage->iWidthScaled, psImage->iHeightScaled );

  /* Show the image, this routine invokes the 'expose' event and draw the
picture */
  igmain_bImageUpdateForState( psImage, psImage->eImageState );
  gtk_widget_show( psDrawingArea );

  /* Handle the alignment */
  if( psImage->eTextAlignment == align_Left )
   /* Put icon and text into a hbox */
  else if( psImage->eTextAlignment == align_Top )
   GtkWidget *align;
   align = gtk_alignment_new (0.5, 0.5, 0, 0);
   /* Put icon and text into a vbox */
   vbox = gtk_vbox_new (FALSE, 0);
   gtk_widget_show( vbox );
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
   if( psImage->pzText )
    label = gtk_label_new (psImage->pzText);
    gtk_widget_show( label );
    gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
    gtk_misc_set_padding (GTK_MISC (label), 10, 0);
   gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_container_add (GTK_CONTAINER (align), psDrawingArea);



Olexiy Avramchenko wrote:

yanxin wrote:

Do anyone know how to align a drawing area in the middle of a vbox or
hbox? I tried to use GtkAlignment but the draing area does not show up.

I've used GtkAlignment for that purpose without any problem.
Didnt you forget to:
1. Add drawing area to alignment (gtk_container_add() function) ?
2. Show the widget/s ?

Btw, can you post the code example ?


gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

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