Recent

Author Topic: ShowModal problems...  (Read 3314 times)

Mark-

  • New Member
  • *
  • Posts: 22
ShowModal problems...
« on: September 23, 2018, 07:05:55 pm »
Hello

Latest version of Lazarus and FPC, running on Debian (32) with Gnome (3.14.1).

I have a main form.
I create another from (form2) and display it using ShowModal.
1) Form2 is always centered on the main window regardless of the position property.
2) Setting the top or left property has not effect.
3) Selecting the title bar of form2 and moving the window also moves the main form. Too odd.  :o

Does the same while debugging or standalone.

Ideas?

Thanks,

Mark

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: ShowModal problems...
« Reply #1 on: September 23, 2018, 07:19:39 pm »
Attach a little compilable example that is problematic for you (Project->Publish Project), and see if anyone else can replicate the behaviour you see.

Mark-

  • New Member
  • *
  • Posts: 22
Re: ShowModal problems...
« Reply #2 on: September 23, 2018, 07:28:01 pm »
Hi,

Thanks for the response.
I was thinking to do that just to verify it is not something in my project.
And while I was creating the project, I selected the "save project as" menu item and the save dialog appear.

Guess what? Moving the dialog moves the Lazarus main top window (which is darkened).

Mark

Mark-

  • New Member
  • *
  • Posts: 22
Re: ShowModal problems...
« Reply #3 on: September 23, 2018, 07:55:09 pm »
OK.
Here is the test project.
The first time I ran it no problem.
Second time problem.
If the main window does not appear darker, no problem, when it does problem. Same for IDE.

Two screen capture of IDE with same issue.
https://ibb.co/d4bJhU
https://ibb.co/jTYW2U

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: ShowModal problems...
« Reply #4 on: September 23, 2018, 09:26:58 pm »
I can't reproduce your problems here (Linux Mint).
Either your Debian window manager has a bug, or perhaps some (Lazarus?) setting is activating a "snap to screen border" sort of effect on your system when you move a window?

Mark-

  • New Member
  • *
  • Posts: 22
Re: ShowModal problems...
« Reply #5 on: September 23, 2018, 10:25:38 pm »
Thanks for trying.

It is not snapping to the screen border.
It appears to be ignoring the positioning when ShowModal is used.
It does it when Lazarus is not running, so not Lazarus.

Mark-

  • New Member
  • *
  • Posts: 22
Re: ShowModal problems...
« Reply #6 on: September 23, 2018, 11:19:59 pm »
I added some code to see where it was changing.
So far after the bold line it is not correct.

FormCreate top:549 left:1291 width:334 height:240
FormResize top:549 left:1291 width:334 height:240
FormShow top:549 left:1291 width:334 height:240
FormActivate top:549 left:1291 width:334 height:240
FormConstrainedResize top:549 left:1291 width:334 height:240 <----
FormChangeBounds top:0 left:0 width:334 height:240
FormConstrainedResize top:0 left:0 width:334 height:240
FormChangeBounds top:412 left:673 width:334 height:240



Mark-

  • New Member
  • *
  • Posts: 22
Re: ShowModal problems...
« Reply #7 on: September 23, 2018, 11:45:07 pm »
OK the culprit.

bsDialog

That causes the main form to darken, the form called with showmodal to center on the main form, moving the showmodal form also moves the main window.

Arrrrggggghhhh.
 
Using bsSingle stops all the above but allows the main form to be moved.

I find it odd, moving the called form moves the calling form, regardless of the called form border style.

It appears modal means something different than what I expected and bsDialog is...odd...to me.

So, the "save as" dialogs in Lazarus have BorderStyle set to bsDialog.
I just used TSelectDirectory in my project and it darkens the calling form...same problems as the above description.
« Last Edit: September 24, 2018, 01:11:09 am by Mark- »

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: ShowModal problems...
« Reply #8 on: September 25, 2018, 10:16:02 am »
Obviously bsDialog is not intended to produce the behaviour you see.
AFAIK it is not happening on any other system, so it must be a bug specific to ConstrainedResize (perhaps) and your particular Linux window manager.

The monolithic Windows API means that at least Windows' window behaviour is largely consistent everywhere. Whereas Linux has a variety of window managers depending on your distro and preferences. I think it is difficult for volunteer Lazarus developers to test code comprehensively on all of them. Worth submitting a bug report on Mantis with exact steps to reproduce, and details of your set-up.

Mark-

  • New Member
  • *
  • Posts: 22
Re: ShowModal problems...
« Reply #9 on: September 25, 2018, 11:29:36 pm »
>Worth submitting a bug report on Mantis with exact steps to reproduce, and details of your set-up.

OK, will do.

 

TinyPortal © 2005-2018