Recent

Author Topic: [SOLVED] Form shown with ShowModal cannot be moved  (Read 712 times)

bpranoto

  • New Member
  • *
  • Posts: 35
[SOLVED] Form shown with ShowModal cannot be moved
« on: June 16, 2019, 12:48:55 pm »
With Qt widgetet, a form showed with ShowModal cannot be moved. If I changed the widgetset to  Gtk2, the child form can be moved freely.

Is it a feature or a bug?

Code: Pascal  [Select]
  1.  
  2. procedure TForm1.Button1Click(Sender: TObject);
  3. var
  4.   F : TForm2;
  5. begin
  6.   F := TForm2.Create(Self);
  7.   try
  8.     F.ShowModal;
  9.   finally
  10.     F.Free;
  11.   end;
  12. end;
  13.  
« Last Edit: June 30, 2019, 02:53:59 pm by bpranoto »

bpranoto

  • New Member
  • *
  • Posts: 35
Re: Form shown with ShowModal cannot be moved
« Reply #1 on: June 16, 2019, 04:38:05 pm »
I  meant move the form with mouse

zeljko

  • Hero Member
  • *****
  • Posts: 1056
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Form shown with ShowModal cannot be moved
« Reply #2 on: June 21, 2019, 12:40:52 pm »
I've spotted that when using wayland instead of xorg. So, what's your  OS, window manager etc ?

bpranoto

  • New Member
  • *
  • Posts: 35
Re: Form shown with ShowModal cannot be moved
« Reply #3 on: June 28, 2019, 07:25:35 pm »
Ubuntu 18.04 64bits with defaut Desktop Manager (GNome3)

VTwin

  • Hero Member
  • *****
  • Posts: 775
  • Former Turbo Pascal 3 user
Re: Form shown with ShowModal cannot be moved
« Reply #4 on: June 28, 2019, 09:17:24 pm »
I noticed that with gkt2 a modal dialog can not be moved with respect to the calling form, the calling form moves with it. It sounds like you are seeing something different.

It seems to be new behavior, and is annoying, but I figured it was a Ubuntu change.
« Last Edit: June 28, 2019, 09:19:18 pm by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.13.6: Lazarus 2.0 fixes svn 61930 (64 bit Cocoa)
Ubuntu 18.04.3: Lazarus 2.0.4 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.4 (64 bit on VBox)
fpc 3.0.4

lucamar

  • Hero Member
  • *****
  • Posts: 2020
Re: Form shown with ShowModal cannot be moved
« Reply #5 on: June 28, 2019, 09:33:36 pm »
I noticed that with gkt2 a modal dialog can not be moved with respect to the calling form, the calling form moves with it. It sounds like you are seeing something different.

It seems to be new behavior, and is annoying, but I figured it was a Ubuntu change.

In which version of Ubuntu (or, rather, GTK) are you seeing that? I've never had that problem and I have used [K|L|X]Ubuntus from version 8 up to 17.04 (or 18.04, I don't remember ATM).

What I have noticed is that Qt applications don't always work quite right in Gnome (GTK) based systems, although they do under KDE.
« Last Edit: June 28, 2019, 09:41:02 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

bpranoto

  • New Member
  • *
  • Posts: 35
Re: Form shown with ShowModal cannot be moved
« Reply #6 on: June 29, 2019, 06:05:26 am »
I try make a simple example with Qt5.11.

The modal form in Qt application can move freely independently of the main form.

I'll make a bug report.

Code: C  [Select]
  1. void MainWindow::on_pushButton_clicked()
  2. {
  3.     QMessageBox MsgBox;
  4.     MsgBox.setWindowTitle("Error");
  5.     MsgBox.setIcon(QMessageBox::Warning);
  6.     MsgBox.setText("Konfirmasi");
  7.     MsgBox.setInformativeText("Yakin?");
  8.     MsgBox.setStandardButtons(QMessageBox::Ok|QMessageBox::Cancel);
  9.     MsgBox.setDefaultButton(QMessageBox::Ok);
  10.     MsgBox.exec();
  11.  
  12. }
  13.  
  14.  

bpranoto

  • New Member
  • *
  • Posts: 35

zeljko

  • Hero Member
  • *****
  • Posts: 1056
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Form shown with ShowModal cannot be moved
« Reply #8 on: June 29, 2019, 10:22:52 am »
I try make a simple example with Qt5.11.

The modal form in Qt application can move freely independently of the main form.

I'll make a bug report.

Code: C  [Select]
  1. void MainWindow::on_pushButton_clicked()
  2. {
  3.     QMessageBox MsgBox;
  4.     MsgBox.setWindowTitle("Error");
  5.     MsgBox.setIcon(QMessageBox::Warning);
  6.     MsgBox.setText("Konfirmasi");
  7.     MsgBox.setInformativeText("Yakin?");
  8.     MsgBox.setStandardButtons(QMessageBox::Ok|QMessageBox::Cancel);
  9.     MsgBox.setDefaultButton(QMessageBox::Ok);
  10.     MsgBox.exec();
  11.  
  12. }
  13.  
  14.  

Note that you don't use QWidget as form but QMessageDlg which have it's own event loop.

bpranoto

  • New Member
  • *
  • Posts: 35
Re: [SOLVED] Form shown with ShowModal cannot be moved
« Reply #9 on: June 30, 2019, 02:55:34 pm »
Fixed  in revision 61490.

Thank you very much Zeljko.