comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Gtk3 Cairo Context 0x0
Date: Fri, 22 Jul 2016 08:01:25 +0200
Date: 2016-07-22T08:01:25+02:00	[thread overview]
Message-ID: <nmscs1$s6j$1@gioia.aioe.org> (raw)
In-Reply-To: 5790df74$0$32235$e4fe514c@news.kpn.nl

On 2016-07-21 16:42, ldries46 wrote:
> I am creating a new Drawing_Area.
> I have packed the drawing Area in a Viewport which is packed in a
> scrolled window.
> Now have the program line:
> CR := Create(Get_Window (MainWindow.DrawingArea));
> where MainWindow.DrawingArea is type Gtk_Drawing_Area with the value
> 0x4694f98 (meaning the value is no null)
> created with Gtk_New (MainWindow.DrawingArea);
> The Cairo context CR has however a value 0x0 which finally results when
> using Save(CR);
> in:
> Program received signal SIGSEGV, Segmentation fault.
> cairo_save (cr=0x0) at ../../src/src/cairo.c:409
> 409 ../../src/src/cairo.c: No such file or directory.
> Current language: auto
> The current source language is "auto; currently c".
>
> In the version 2015 of GtkAda from AdaCore the create function  worked
> and was positioned after the creation of the Drawing Area but before the
> connection to the "draw" event.
> On the Gtkada group I do get only the answer that only in the handler

That is right.

[There are rare cases when memory-mapped contexts used, but drawing area 
presumes a normal window's drawing context.]

> I can get the context but that means that I cannot create a framework
> within the area before any work with on the area because therefore I
> need the cairo context f.i. to set s line color.

Which framework?

Whatever you might do with a context is useless if the context is not 
the one used for drawing onto the actual window. That one you get in the 
handler. When initialization is needed do it upon the first call.

> What must I do to retrieve a valid CR?

It does not work this way, you must reconsider your design.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

      reply	other threads:[~2016-07-22  6:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-21 14:42 Gtk3 Cairo Context 0x0 ldries46
2016-07-22  6:01 ` Dmitry A. Kazakov [this message]
replies disabled

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