[SOLVED] Window movable without Controlbox

Answered Closed
0
0

Hi,

Is there a way to make a window (Form) movable with mouse drag if it has no ControlBox? I.e. by dragging somewhere on its surface (that may be covered, of course, by controls) ?

Best,
Alex

  • You must to post comments
Best Answer
0
0

Thank you. Found the issue – it will be fixed in the next update. Not really a bug – the move handler in qooxdoo was calling e.stop() to prevent the mouse down event from bubbling up instead of calling e.stopPropagation() because the mouse event class had a partial implementation of the stop method. In the wisej fork of qooxdoo the stop method is fixed, so the handler stopped the propagation and default behavior… It happened only when you used ShowDialog() because in that case the move handler processed the mouse before the focus manager. I don’t know why.

Thanks again,

Luca

  • You must to post comments
0
0

Hi Luca,

Now, if I say that I understood all this e.stopPropagation story, it will be a lie, but if you are satisfied, I am too ! 🙂 Thank you.

Alex

 

  • You must to post comments
0
0

🙂 You are right, but, unfortunately, I have even seen cases where it is reproduced on my machine and not on other people’s with the same code. The thing is that we depend on so many different parameters that we can never be sure (versions, themes, VS, browsers, add-ons, operating systems, antiviruses, popup blockers … to just list a few).  So, I hope you can see it too!

Having said that, I have come to believe that Wisej is very easy to debug (for its authors), which tells me that it is a good piece of software.

Alex

  • You must to post comments
0
0

Great, thanks. Once it’s reproduced it’s as good as fixed! 🙂

  • You must to post comments
0
0

Dear Luca,

The javascript is exactly the same. I modified the project you sent and it now shows the problem (attached). Press the button to open the dialog and then try to type in the textboxes. In fact, if you first drop the combobox and then click in the textbox and type, the typing goes to the combobox.

Best,
Alex

  • You must to post comments
0
0

That probably means that there is a javascript error somewhere – check with F12. See attached small test doing the same and working well.

I noticed that when tabbing from the controls on the form and the controls in the user control, the user control seems to “steal” a tab and get activated itself instead of passing it to the first child. Will log.

 

Best,

Luca

  • You must to post comments
0
0

Dear Luca,

With the implementation above for moving a dialog form without ControlBox, I just noticed that all controls in the UserControl contained in the form work OK, apart from TextBoxes! TextBoxes get the focus but I cannot type in them! If I remove the javascript, I can type again.

Best,
Alex

  • You must to post comments
0
0

Hi Luca,

Amazing! It works perfectly! For the record, I put it in a form I create at runtime,  like this. Best, Alex.

var uc = new MyUserControl();
uc.Dock = DockStyle.Fill;

var f = new Form();
f.Controls.Add(uc);
f.ControlBox = false;
f.StartPosition = FormStartPosition.CenterScreen;
f.Load += (s, e) => { ((Form)s).Eval(“this.setAllowMove(false);this.__moveHandle = null;this.setAllowMove(true);”); };
f.ShowDialog();

 

  • You must to post comments
0
0

Hi Alex,

Sorry for the delay, I could only try this today.

The user control is docked to fill so it’s normal that after moving it it snaps back into place. If you want a floating window that can be moved around by grabbing it anywhere you can add the following call in Window.OnLoad():

this.Eval("this.setAllowMove(false);this.__moveHandle = null;this.setAllowMove(true);");

The MMovable mixin allows only one widget to be selected as the movable handle. The qx.ui.window.Window class which is the base for wisej.web.Form, always registers the caption as the movable handle. The AllowMove property added by Wisej can only enable or disable the movable handle but cannot change it. The line above, first disables it, then clears the reference to the single movable handle, the re-register the movable handle but this time it will be the entire window.

I tried it and it works well. You can click and drag anywhere, even inside another widget if that widgets doesn’t handle the pointer.

HTH

Best,

Luca

  • You must to post comments
0
0

Hi Luca,

Thought you were on holidays! 😛

I have a popup form which contains a UserControl with its Dock property set to Fill. So, in the absence of the Form’s ControlBox, all the Form surface is covered by the UserControl.

I had set the Movable property of the form, but since its whole surface is covered by the contained UserControl, this does not fire. If I set the Movable on the UserControl, then this moves withing the form borders (and by the way, when I stop dragging, the UserControl moves back to its initial position), the form remaining at the same location. In such a scenario, where the whole form surface is covered by the UserControl it contains, we need somehow to propagate the moving of the content to the container. Maybe the easiest would  be to keep the ControlBox = true, but for small popup windows it looks ugly …

Best,
Alex

  • You must to post comments
0
0

That’s possible. I will post the javascript code to enable that later – I need to try it.

Moving widgets is managed by a mixin class called MMovable that hooks pointer events. For windows that happens only on the caption but it can be changed to work on the content pane. Try to set Movable=true on a button for example.

Best,

Luca

  • You must to post comments
Showing 11 results