SFML community forums

Bindings - other languages => DotNet => Topic started by: Glenn on September 17, 2012, 08:39:02 pm

Title: SFML window blocking windows form
Post by: Glenn on September 17, 2012, 08:39:02 pm
Hi,

So as seen in this thread: http://en.sfml-dev.org/forums/index.php?topic=9141.0 I am using SFML2.0 .NET within windows forms.

What I have is a windows forms application with a picturebox in it that I use as the container for my SFML window.

A problem I have run into is that when I create a child form within the mainform, even if I set it as the topmost window, the sfml renderwindow will always block it.

Is there a way to make it so the new form will display on top of the render window?

Here is a small snippet of code I have:

           
            SFMLWindow = new RenderWindow(this.pictureBox1.Handle);

            form2 = new Form2();
            form2.MdiParent = this;
            form2.TopMost = true;
            form2.Show();
 

This will show:

(http://i.imgur.com/YP9uH.png)

The only way I have been able to see the child form is if I hide the sfml window

            SFMLWindow = new RenderWindow(this.pictureBox1.Handle);

            form2 = new Form2();
            form2.MdiParent = this;
            form2.TopMost = true;
            form2.Show();
            SFMLWindow.SetVisible(false);
 

This will show:
(http://i.imgur.com/fR2Ff.png)

I have also tried the form2.BringToFront() method, which also does not work.
Title: Re: SFML window blocking windows form
Post by: Laurent on September 17, 2012, 10:14:46 pm
Quote
Is there a way to make it so the new form will display on top of the render window?
I don't think so.
Title: Re: SFML window blocking windows form
Post by: Glenn on September 17, 2012, 11:10:24 pm
Well that's unfortunate.  :-\
Title: Re: SFML window blocking windows form
Post by: zsbzsb on September 19, 2012, 12:42:12 pm
Unfortunately this is not SFML's doing. Its the way MDI is designed to work. The best you can do is dock your holder for the SFML render window somewhere on the form and allow the MDI children to fill the rest of the space. See this (http://stackoverflow.com/questions/4808109/controls-in-container-form-come-over-child-form) for some more information.
Title: Re: SFML window blocking windows form
Post by: Acrobat on September 24, 2012, 11:47:56 am
Well that's unfortunate.  :-\
Create your window with IntPtr.Zero, and call updates in timer (without while loop)
Title: Re: SFML window blocking windows form
Post by: zsbzsb on September 24, 2012, 03:03:39 pm
Create your window with IntPtr.Zero, and call updates in timer (without while loop)
You missed the entire point of the thread..... The trouble is that MDI child forms are shown behind the parent window's forms. And nothing you can do will change that.