REALbasic.Rect

Hi all,

this is my last conversation on the same problem: ths use of REALbasic.Rect…

The used code displays a selected image in a window that have a ToolBar. All use native Xojo code. The code fails in the image Height (wrong value) and eventually image Width (also wrong value).

The code below never works:

[code] // Get the image
TempPict = Picture.Open(mFileIO.gImageFI)

// Get image size
ImgHeight = TempPict.Height
ImgWidth = TempPict.Width

// Set the Window backdrop
cImg.Backdrop = TempPict

// Clear it, I do not need it anymore
TempPict = Nil

// Set the window size
wImg.Height = ImgHeight
wImg.Width = ImgWidth

// Just in case it is needed
wImg.Refresh

// Store data in myBounds
myBounds.Top = 0 + Screen(0).AvailableTop
myBounds.Left = 0
myBounds.Height = ImgHeight // The problem appears here
myBounds.Width = ImgWidth // and here too

// Set wImg to window’s 0,0…
wImg.Bounds = myBounds[/code]

BUT: adding the lines below set the correct heigfht (and width) of the window:

// Set the window size wImg.Height = ImgHeight wImg.Width = ImgWidth
BTW: the first piece of code is incomplete (here), but it works (compile and does not crash), but the window does not display the correct image height.

For me, this is a bug. But this is only me, my opinion.

The ball is in your garden: I found a workaround that fit my needs.

Merry Christmas and Happy New Year.

Apples and Oranges. The Bounds of a window includes the stuff outside the user area. The Height and Width is just the user area. The bug is in your use of Bounds.