Forum Discussion

jkard's avatar
jkard
Visitor
14 years ago

Centering An Image On roImageCanvas

I'm working with the roImageCanvas for the first time today, and am using it as a "Screen Facade" as recommended in the Developer Guidelines handbook. I'd like to center an image on the roImageCanvas, but am having issues getting it to do this.

    screenFacade = CreateObject("roImageCanvas")
screenFacade.SetLayer(0,{Color:"#FF000000", CompositionMode:"Source"})
canvasItems = [
{
url:"pkg:/images/Splash/Splash.png"
TargetRec:{x:390, y:357, w:400, h:200}
}
{
Text:"Loading..."
TextAttrs:{
Color:"#FF0000",
Font:"Medium",
HAlign:"HCenter",
VAlign:"VCenter",
Direction:"LeftToRight"
}
}
]

screenFacade.SetRequireAllImagesToDraw(true)
screenFacade.SetLayer(1,canvasItems)
screenFacade.Show()


No matter what I set in the "TargetRec" for my image, it is always displaying in the upper left corner of the monitor. What am I doing wrong and how do I center it?

Thanks all!!
Jay

2 Replies

  • Ahh!! Great, silly mistake on my part. I was thinking wrong on how the "TargetRect" was used, thanks for the great catch Mark!

    Best
    Jay