I have a problem in a project. Instead of simply asking as usual with a minimum code, I created a project and paste below the offending code.
Below is a screen shot of the window with the ToolBar (and a non visible Canvas, below the ToolBar). When one click in a Button, the corresponding image is loaded in the Canvas located below the ToolBar.
In the project archive, you will get the icons for the ToolBar (32 x32) and the images that will be loaded by a Button click.
What happens when one make successives click in buttons ?
The window height is resized down vertically and at last the window disappears.
This was not done before I added the Realbasic.Rect code. In that case, the window width and height was not resized at all.
Six clicks are enoug to resize the window to the point its height is nul or so. In fact, the image shrink by a factor of 78 pixels:
400, 322, 244, 166, 88, 10 and nothing
Those numbers are the height value after a click in a button / display an image
The project file is here.
What have I done wrong ?
[code]Sub Display_Image(The_Img As String, The_Canvas As Canvas)
// Dim the needed variables
Dim ImgFI As FolderItem
Dim TheWidth As Integer
Dim TheHeight As Integer
// To move the window to 0,0
Dim myBounds As New Realbasic.Rect
// Get a reference to the image to load
ImgFI = GetFolderItem(“Data”).Child(The_Img)
// demo: no error checking
// Load the image into the Canvas
The_Canvas.Backdrop = Picture.Open(ImgFI)
// Fills myBounds values
myBounds.Width = wMain.Width // The_Canvas.Width // Not better
myBounds.Height = wMain.Height // The_Canvas.Height // Not better
myBounds.Top = Screen(0).AvailableTop
myBounds.Left = 0
// Set wMain to topmost, Leftmost !
wMain.Bounds = myBounds
// Not better: the poblem exists too with that code instead of wMain.Width / wain.Heigth ![/code]
MacBook Pro 2011-11
OS X 10.9.5
By the way: I do not get that in my original project, but when the first image to be displayed in the original project, the window is corectly located to Leftmost / rightmost, but the window height is bad (does not display the image full height).