comp.lang.ada
 help / color / mirror / Atom feed
* GTKAda drawing
@ 2009-10-08 22:55 RasikaSrinivasan@gmail.com
  2009-10-09  8:50 ` Srini -
  0 siblings, 1 reply; 2+ messages in thread
From: RasikaSrinivasan@gmail.com @ 2009-10-08 22:55 UTC (permalink / raw)


This I suspect could be a GtkAda related question:

I have this handler to paint.

   Currentcolor : Gdk.Color.Gdk_Color ;

   function Canvas_Paint(canvas : access
Gtk.Drawing_Area.Gtk_Drawing_Area_Record'Class) return Boolean  is
      Drawwin : Gdk.Window.Gdk_Window ;
      Gc : Gdk.Gc.Gdk_gc ;

   begin
      pragma Debug(Put_Line("Repaint canvas"));
      Drawwin := Canvas.Get_Window ;
      Gdk.Gc.Gdk_New(Gc,drawwin) ;
      Gdk.Gc.Set_foreground(Gc,Currentcolor) ;
      pragma Debug(Showcurrentcolor);
      Newx := Newx + 10 ;
      Newy := Newy + 10 ;
      Gdk.Gc.Set_Line_Attributes( Gc , 5 , Gdk.Gc.Line_Solid ,
Gdk.Gc.Cap_Butt , Gdk.gc.Join_Round ) ;
      Gdk.drawable.Draw_Line( Drawwin , Gc , newx , newy , 100 ,
100) ;
      return True;
   end Canvas_Paint ;

whatever be the "currentcolor" my line is always of the same color.
Perhaps this is not the way to choose the color of the pen to draw the
line (and other figures).

thanks for pointers.

srini



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: GTKAda drawing
  2009-10-08 22:55 GTKAda drawing RasikaSrinivasan@gmail.com
@ 2009-10-09  8:50 ` Srini -
  0 siblings, 0 replies; 2+ messages in thread
From: Srini - @ 2009-10-09  8:50 UTC (permalink / raw)


On Oct 8, 6:55 pm, "RasikaSriniva...@gmail.com"
<rasikasriniva...@gmail.com> wrote:
> This I suspect could be a GtkAda related question:
>
> I have this handler to paint.
>
>    Currentcolor : Gdk.Color.Gdk_Color ;
>
>    function Canvas_Paint(canvas : access
> Gtk.Drawing_Area.Gtk_Drawing_Area_Record'Class) return Boolean  is
>       Drawwin : Gdk.Window.Gdk_Window ;
>       Gc : Gdk.Gc.Gdk_gc ;
>
>    begin
>       pragma Debug(Put_Line("Repaint canvas"));
>       Drawwin := Canvas.Get_Window ;
>       Gdk.Gc.Gdk_New(Gc,drawwin) ;
>       Gdk.Gc.Set_foreground(Gc,Currentcolor) ;
>       pragma Debug(Showcurrentcolor);
>       Newx := Newx + 10 ;
>       Newy := Newy + 10 ;
>       Gdk.Gc.Set_Line_Attributes( Gc , 5 , Gdk.Gc.Line_Solid ,
> Gdk.Gc.Cap_Butt , Gdk.gc.Join_Round ) ;
>       Gdk.drawable.Draw_Line( Drawwin , Gc , newx , newy , 100 ,
> 100) ;
>       return True;
>    end Canvas_Paint ;
>
> whatever be the "currentcolor" my line is always of the same color.
> Perhaps this is not the way to choose the color of the pen to draw the
> line (and other figures).
>
> thanks for pointers.
>
> srini

found the answer. I need to use  Set_Rgb_Fg_Color instead of
Set_Foreground. srini



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-09  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-08 22:55 GTKAda drawing RasikaSrinivasan@gmail.com
2009-10-09  8:50 ` Srini -

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox