Window Maximizing oddly

Hey all, I am currently in the middle of building my UI. When trying to maximize my main window it is doing the following…

When I maximize the window it is not filling the screen, it is staying central at the top of the window and maximizing to the bottom? Also, there seems to be quite a bit of flickering when I maximize or move the window using the drag event.

in my Canvas Button key down event i have the following code.

Static fs As Boolean = False
If fs Then
  MainDashboard.Restore
  fs = False
Else
  MainDashboard.Maximize
  fs = True
End If

If anyone could offer any help it would be greatly appreciated!

Robin

Hi Robin,

you don’t specify it, but it looks like Linux. Can you please tell which distribution and the version ?

Did you have a look at the samples included in Xojo ? There could be one that shows an example.

Apologies, it is Windows 10, I am using Canvas’s to get the look of Linux. Also using xojo 2021.r1.1

I looked through the examples but did not locate what I needed.

have you any positioning in other events/methods?

Hi Markus, The only other one I would have would be in a Rectangle’s MouseDrag event.

if buttonDown then
  MainDashboard.left = MainDashboard.left + (X - lastX)
  MainDashboard.top = MainDashboard.top + (Y - lastY)
end if

if you create a new project and put this in a button action it works

Static fs As Boolean = False
If fs Then
  Self.Restore
  fs = False
Else
  Self.Maximize
  fs = True
End If

you could add System.DebugLog CurrentMethodName in the events/methods to see what your app is doing. maybe it give you a hint.

1 Like

I did what you said and created a new project. it is now working.

Thank you Markus!

and you found the real cause?

Unfortunately no, i created a new project and copied the exact code to my new window.

The only code I had was the maximize and restore, and also a mousedrag event in a rectangle acting as the title bar to allow the window to be dragged.

It has really pickled me.

1 Like

Why not use Windows as it is and behaves ? As you can see creating your own Window object can be quite complicated.

1 Like

I have resorted to doing this, I was feeling adventurous and wanted to make it look a bit better. Realised it looks better as is (to me anyways).

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.