Fixed Window Position?

Hi,
Is it possible to make a plain box window be permanently positioned in the top right corner of the main window?

I have looked at the usual top, left, right, bottom properties, but I have no idea how to retrieve the MainWindow’s position, in order to adjust the plain box’s position?

Any help would be appreciated.

Thank you all in advance.

Hi Richard,

if you want to do this manually, what speaks against checking the window.resize event, read the left and top position of the main window and position the box window appropriately? (Or maybe I misunderstood your question?)

On the other hand, have you looked into the childwindow methods in MacOSLib or MBS? OS X allows you to do the repositioning automatically by adding the plain box as a child to your mainwindow, if I remember correctly.

Ulrich,
regarding your first explanation:

In the plain box’s window.open event, and also in the resize event - I should obtain the main window’s top and left positions, and put them into integer variables - then position the plain box window based on those positions?

Something like:

Dim mainX As Integer = MainWindow.Left Dim mainY As Integer = MainWindow.Top

Then position the plain box window like this:

PlainBoxWindow.Left = mainX + 50 PlainBoxWindow.Top = mainY + 50

Did I understand that correctly?

Thanks.

Yes, I think I had done that in a project I cannot find right now and it worked quite well (until I found the childwindows). I am unsure if another call in the mainwindow.resized event was necessary. But basically it should do.

And oh, MacOSLib doesn’t run currently? As far as I know Charles is busy updating it.

Thanks Ulrich - I will try that later when I am back at my iMac.

[quote=198808:@Richard Summers]Is it possible to make a plain box window be permanently positioned in the top right corner of the main window?

I have looked at the usual top, left, right, bottom properties, but I have no idea how to retrieve the MainWindow’s position, in order to adjust the plain box’s position?

[/quote]

As you seem to imply the small corner window will be there all the time and possibly never move, why don’t you use a ContainerControl instead ? In terms of design, there is no difference with a window. Actually, you can change the Super of a window to ContainerControl and shazam.

Then you place the Container Control on the corner of your main window, with the code you posted last and you’re in business…

You may want to check Rubberviews.com to have all your controls taken care of when the window is resized.

Thanks Michel - I will also look into that :slight_smile: