Forum > LCL

Problem with TForm.ShowModal on Linux

(1/6) > >>

This is my first message on this forum, so, first of all, I'd like to say 'hello' to all of you  :)

Recently I've come across some strange behavior of LCL and I can't say if it is a bug or feature ;) My application consists of two forms - main one with size equal to screen size, BorderStyle set to bsNone and FormStyle set to fsSystemStayOnTop (in other words - it's full-screen window always staying on the foreground). The second one is created dynamically and showed with ShowModal. On Windows everything works just fine, but problem/unwanted behavior occurs on Linux.

When I try to display the second form by ShowModal, the new window goes behind the main window, which becomes disabled. I am not able to show the second form on top of the main window, even Alt+Tab can't bring it to the foreground, Form2.BringToFront also fails. Everything works OK when I use Form2.Show instead of ShowModal.

I've noticed, that this happens only when the main form has no border. When I leave BorderStyle set to bsNormal, I can ShowModal the second form and everything works like I expect: new form is shown on the foreground, the main form in the background is disabled and I can't switch to the main form as long, as Form2 is opened.

Please - check if you can you reproduce this situation and let me know about results. Firstly I'd like to find out, what is the reason of such application behavior, is it my mistake (and if it is - how can I fix it?) or is it something about the way LCL is implemented on Linux. I am using Linux Mint 19.1 MATE and Lazarus 1.8.4.

Try upgrading to the latest laz.

If that does not work create a small example and present it to the bug page, it sounds like a widget issue...

I also think this may be a bug, but that is why I wanted you to try to reproduce this by yourselves. If people would be able to get the same behavior, it would suggest that it's not my mistake, but some issue with LCL.

For now I don't want to show you my code, because I don't want to mislead anyone and make them repeat my mistakes (in case that it's not problem with Lazarus, but caused by me).

In Lazarus 2.0.0 it works as expected for me.

--- Code: Pascal  window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button1Click(Sender: TObject);begin    Form2.Showmodal;end; procedure TForm1.FormCreate(Sender: TObject);begin    BorderStyle := bsNone;    FormStyle := fsSystemStayOnTop;    width := 1900;    height := 1000;end; procedure TForm1.Button2Click(Sender: TObject);begin    close;end;           
I did not bother to set width and height to exactly what it should be but thats not (IMHO) likely to be a factor.


@dbannon - you didn't tell which OS you are using. As I wrote in my first message, on Windows everything works fine, problem occurs only on Linux (or at least on my distro - Mint 19 MATE).

In the evening I'll be home, so I'll try to upgrade my Lazarus to current version (2.0.0) and check if problem still appears.


[0] Message Index

[#] Next page

Go to full version