Window behavior

Hi there,

i have a question about the window behavior with positions. I open another window like this: options.ShowModalWithin(main)

So main is the calling window, but options seems to be only centered on the screen, but it should be centered over the window main. The window options is set to “movable modal” and the placement is set so “parent window” So what is wrong here?

I had the same experience 3 years ago when I started with Xojo. (MS Windows.) Did not test on Mac. Seems the placemt setting is just not working and nobody is complaining. The first bugreport in Feedback dates 2008 (Real Basic)
But there are workarounds. A simple one is just passing the parent’s reference and use that to position the child window. The sophisticated one is using introspection in the open event of the second window to obtain the reference of the parent without any coding on the parent itself.

OSX ? Win ? Linux?

from LR:

[quote]
ShowModalWithin is designed to display Sheet and Drawer windows within a specific parent (Mac OS X only).
If it is used to display a Document window, it displays it as a non-modal dialog.[/quote]

oh its windows… i tried it with showmodal too but dont work.
Hm dunno how i should workaround this standard feature in the code :-/ but it seems on mac the windows are not on the parent, it just block the parents.

On Visual-Studio this works as Form.ShowDialog()

Okay i did this now and put it in my main window:

Public Sub ShowDialog(form As Window, parent As Window) form.Left = parent.Left+(parent.Width-form.Width) / 2 form.Top = parent.Top+(parent.Height-form.Height) / 2 form.ShowModal End Sub

Hi Sascha,
I’ve prepared you a small demo project which does what you want to achieve. You can get it here.

Oh thank you xD i did the same thing with my method thing … seems to be the same code :smiley: