PDA

View Full Version : GetScaledRect() for a button in a frame



avid
February 5th, 2005, 05:10 PM
Ben,

Should the value returned by GetScaledRect() be clipped by the rect of any enclosing frame?

This was the cause of a recent problem with LDJ. I have "fixed" it for the next AvidUtils release, but in principle it could affect any driver (e.g. consider a MediaBridge media tree control inside a too-small frame - admittedly a pretty unlikely case).

Brian

Ben S
February 7th, 2005, 09:07 PM
Should it? I don't think so. It -is- the scaled rect of the item. When NetRemote paints, it is properly clipped.

Perhaps you can get the scaled rect of the frame that the button is on in your paint routine, and clip to that?

The problem is although the item might be clipped, you still want it to be centered according to original rect, right?

avid
February 8th, 2005, 02:08 AM
Yes, you're right of course. And while my "fix" for now is OK for text (it will wrap to the clipped rectangle), I need to work out a more "correct" way of doing it.

I suppose it's just something else to worry about in a driver - if you create a new window to hold the button contents, then make sure that it can't be painted outside of the enclosing frame.

Thanks for putting me straight.

Brian

Ben S
February 8th, 2005, 10:39 PM
Thanks for putting me straight.

:)

Not a problem. I reread my post and thought perhaps my response was too terse. Sorry about that.



I suppose it's just something else to worry about in a driver - if you create a new window to hold the button contents, then make sure that it can't be painted outside of the enclosing frame.


NetRemote should handle frames as actual window objects, and I have that on the list for a future revision (hopefully not -super- far out - 6 months or so) which will make this work properly, so perhaps it's not a huge deal for now?