Adding to a PtRaw

I have a PtRaw widget and it has a draw function and that’s all working
fine. Now I want to add some graphics on top of the PtRaw from else where
in code. I.E. The user clicked on a button and I want to draw another object
on the screen. But nothing shows up that’s not drawn from the PtRaw draw
function.

Can I draw on top of my PtRaw from another widget’s call back?

If so, what am I missing?

If not, how is this normally done?

Wojtek Lerch <Wojtek_L@yahoo.ca> wrote:
WL > Bill Caroselli wrote:

I have a PtRaw widget and it has a draw function and that’s all working
fine. Now I want to add some graphics on top of the PtRaw from else where
in code. I.E. The user clicked on a button and I want to draw another object
on the screen. But nothing shows up that’s not drawn from the PtRaw draw
function.

Can I draw on top of my PtRaw from another widget’s call back?

WL > In theory, yes; but it involves a significant amount of setup that
WL > normally is done for you by the library before your PtRaw draw function
WL > is called. And it’s very easy to get something wrong when you’re trying
WL > to do it yourself. And it may depend on some undocumented details. And
WL > if you do it in a button’s callback, it’s not going to be done again
WL > when your window is exposed by a console switch or by dragging another
WL > window in front of it.

Well, I was aware that it wouldn’t get re-drawn automatically.

If so, what am I missing?

If not, how is this normally done?

WL > Normally, you damage the PtRaw (or a portion of it) after setting some
WL > flag that tells your draw function to additionally draw the extra stuff.

Yeah that’s kind of what I ws about to try on my own. Not what I wanted to
hear but I guess it will work for me.

WL > Or you could realize another PtRaw on to of the first one.

Thank for the quick reply Wojtek.

Bill Caroselli wrote:

I have a PtRaw widget and it has a draw function and that’s all working
fine. Now I want to add some graphics on top of the PtRaw from else where
in code. I.E. The user clicked on a button and I want to draw another object
on the screen. But nothing shows up that’s not drawn from the PtRaw draw
function.

Can I draw on top of my PtRaw from another widget’s call back?

In theory, yes; but it involves a significant amount of setup that
normally is done for you by the library before your PtRaw draw function
is called. And it’s very easy to get something wrong when you’re trying
to do it yourself. And it may depend on some undocumented details. And
if you do it in a button’s callback, it’s not going to be done again
when your window is exposed by a console switch or by dragging another
window in front of it.

If so, what am I missing?

If not, how is this normally done?

Normally, you damage the PtRaw (or a portion of it) after setting some
flag that tells your draw function to additionally draw the extra stuff.

Or you could realize another PtRaw on to of the first one.

Bill Caroselli wrote:

Wojtek Lerch <> Wojtek_L@yahoo.ca> > wrote:
WL > Bill Caroselli wrote:

I have a PtRaw widget and it has a draw function and that’s all working
fine. Now I want to add some graphics on top of the PtRaw from else where
in code. I.E. The user clicked on a button and I want to draw another object
on the screen. But nothing shows up that’s not drawn from the PtRaw draw
function.

Can I draw on top of my PtRaw from another widget’s call back?


WL > In theory, yes; but it involves a significant amount of setup that
WL > normally is done for you by the library before your PtRaw draw function
WL > is called. And it’s very easy to get something wrong when you’re trying
WL > to do it yourself. And it may depend on some undocumented details. And
WL > if you do it in a button’s callback, it’s not going to be done again
WL > when your window is exposed by a console switch or by dragging another
WL > window in front of it.

Well, I was aware that it wouldn’t get re-drawn automatically.

I didn’t mean to imply you weren’t; I just wanted to make sure that the
list of disadvantages was more or less full, and as long as possible,
just in case someone else was reading. :slight_smile:

If so, what am I missing?

If not, how is this normally done?


WL > Normally, you damage the PtRaw (or a portion of it) after setting some
WL > flag that tells your draw function to additionally draw the extra stuff.

Yeah that’s kind of what I ws about to try on my own. Not what I wanted to
hear but I guess it will work for me.

WL > Or you could realize another PtRaw on to of the first one.
^^^^^

On top. I meant “on top”.

Thank for the quick reply Wojtek.

No problem.

Wojtek Lerch <Wojtek_L@yahoo.ca> wrote:
WL > Bill Caroselli wrote:

Well, I was aware that it wouldn’t get re-drawn automatically.

WL > I didn’t mean to imply you weren’t; I just wanted to make sure that the
WL > list of disadvantages was more or less full, and as long as possible,
WL > just in case someone else was reading. :slight_smile:

Mission accomplished!

I now redraw all required objects in the main draw function and all is well.