Regarding Displaying pixmap
- From: Jyothi <jyothi ncoretech com>
- To: gtk-list gnome org
- Subject: Regarding Displaying pixmap
- Date: Thu, 03 Jan 2002 16:24:07 +0530
Hi,
I have a problem in displaying the drawing area. I create a window and
in that I create a Drawing area and put it in a box and then In that
Drawing area I am drawing some rectangles and connect a signal handler
for event "button-press-event". Finally I call gtk_widget_show_all(
GTK_WIDGET( Window ) ). Only the Window is coming up but the rectangles
are not coming up. But when I click on that Drawing Area, I am getting
the button_press_event. So I feel the rectangles are not been shown. How
to show that ?? . I am attaching my code here. Please tell me where I am
going wrong.
void Applauncher( )
{
GtkWidget * Window, *box , *DrawingArea;
int i ;
Window = CreateWindow( "Applauncher" ) ;
gtk_widget_show( GTK_WIDGET( Window ) ) ;
box = gtk_vbox_new( FALSE, 0 ) ;
gtk_container_add( GTK_CONTAINER( Window ), box ) ;
DrawingArea = gtk_drawing_area_new( ) ;
gtk_drawing_area_size( GTK_DRAWING_AREA( DrawingArea ), 20, 20 ) ;
gtk_signal_connect( GTK_OBJECT( DrawingArea ), "button_press_event",
GTK_SIGNAL_FUNC( GetPixmapData ), DrawingArea ) ;
gtk_widget_set_events( DrawingArea, GDK_BUTTON_PRESS_MASK ) ;
gtk_box_pack_end( GTK_BOX( box ), DrawingArea, GTK_FILL, GTK_FILL, 0
) ;
for( i = 0 ; i <= 220 ; i=i+20 )
{
gdk_draw_rectangle( DrawingArea->window,
DrawingArea->style->black_gc , FALSE, i+2, 302 , 16, 16 );
}
gtk_widget_show_all( GTK_WIDGET( Window ) ) ;
}
Thanks in Advance,
Jyothi.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]