center AGW ToasterBox on parent?

I think I may want to have status alerts using the AGW ToasterBox
popping up in the center of the current window (its parent), where I
think it would be most noticed, but the .CenterOnParent() doesn't seem
to work with it.

I also couldn't find any wxWindow method like .GetCenter() or such,
and am just trying to use GetRect() and such and figure it out myself,
but I just wanted to check that there wasn't a simpler way.

Thanks,
Che

I think I may want to have status alerts using the AGW ToasterBox
popping up in the center of the current window (its parent), where I
think it would be most noticed, but the .CenterOnParent() doesn't seem
to work with it.

Probably because it is resetting its position as it scrolls open or closed.

I also couldn't find any wxWindow method like .GetCenter() or such,
and am just trying to use GetRect() and such and figure it out myself,
but I just wanted to check that there wasn't a simpler way.

Did you see the SetPopupPosition method?

···

On 11/26/10 5:40 PM, C M wrote:

--
Robin Dunn
Software Craftsman

I also couldn't find any wxWindow method like .GetCenter() or such,
and am just trying to use GetRect() and such and figure it out myself,
but I just wanted to check that there wasn't a simpler way.

Did you see the SetPopupPosition method?

Thanks. Yes, I was using that originally with getting the mouse click
position and popping it up there, but now I need to get the center of
the parent position, and so I think I have to do this:

        screenrect = self.GetScreenRect() #here self = the parent of
the toasterbox
        toast_width, toast_height = (180, 110)
        x = screenrect.GetX()
        y = screenrect.GetY()
        width = screenrect.GetWidth()
        height = screenrect.GetHeight()
        pos = wx.Point( (x + (width/2) - (toast_width/2) ), (y +
(height/2) - (toast_height/2) ) )
        tb.SetPopupPosition(pos)

I would have used tb.GetSizeTuple() or .GetSize(), or even just
tb.width and tb.height, but those methods/attributes don't work on
ToasterBox, either. Same is true for .GetParent(), which also doesn't
work with the ToasterBox--not sure why that is.

Andrea, do you think something like the code above could/should be
added to ToasterBox to add a CenterOnParent method?

Thanks,
Che

A method like tb.CenterOnParent() might be a good addition

Hi Che,

I also couldn't find any wxWindow method like .GetCenter() or such,
and am just trying to use GetRect() and such and figure it out myself,
but I just wanted to check that there wasn't a simpler way.

Did you see the SetPopupPosition method?

Thanks. Yes, I was using that originally with getting the mouse click
position and popping it up there, but now I need to get the center of
the parent position, and so I think I have to do this:

   screenrect = self\.GetScreenRect\(\)  \#here self = the parent of

the toasterbox
toast_width, toast_height = (180, 110)
x = screenrect.GetX()
y = screenrect.GetY()
width = screenrect.GetWidth()
height = screenrect.GetHeight()
pos = wx.Point( (x + (width/2) - (toast_width/2) ), (y +
(height/2) - (toast_height/2) ) )
tb.SetPopupPosition(pos)

I would have used tb.GetSizeTuple() or .GetSize(), or even just
tb.width and tb.height, but those methods/attributes don't work on
ToasterBox, either. Same is true for .GetParent(), which also doesn't
work with the ToasterBox--not sure why that is.

Andrea, do you think something like the code above could/should be
added to ToasterBox to add a CenterOnParent method?

A method like tb.CenterOnParent() might be a good addition

I think so as well, I'll try to find some time in the next few days to
look at this issue as well. I believe it would be better if you could
open a bug report on this on wxTrac so that it doesn't get lost in the
maze of my e-mail account.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

==> Never *EVER* use RemovalGroup for your house removal. You'll
regret it forever.
The Doomed City: Removal Group: the nightmare <==

···

On 27 November 2010 23:39, C M wrote:

I think so as well, I'll try to find some time in the next few days to
look at this issue as well. I believe it would be better if you could
open a bug report on this on wxTrac so that it doesn't get lost in the
maze of my e-mail account.

I filed the bug report. Thanks.

Che