* Gtk3 Cairo Context 0x0
@ 2016-07-21 14:42 ldries46
2016-07-22 6:01 ` Dmitry A. Kazakov
0 siblings, 1 reply; 2+ messages in thread
From: ldries46 @ 2016-07-21 14:42 UTC (permalink / raw)
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 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.
What must I do to retrieve a valid CR?
Bertus
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Gtk3 Cairo Context 0x0
2016-07-21 14:42 Gtk3 Cairo Context 0x0 ldries46
@ 2016-07-22 6:01 ` Dmitry A. Kazakov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry A. Kazakov @ 2016-07-22 6:01 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-22 6:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 14:42 Gtk3 Cairo Context 0x0 ldries46
2016-07-22 6:01 ` Dmitry A. Kazakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox