Forum > LCL

[SOLVED] How to switch a Form from Show-mode to ShowModal() without flicker?

<< < (2/2)

GetMem:

--- Quote ---Did I made something wrong?
--- End quote ---
No. At least noting obvious. I would suggest to remove method displayinfos and move the ShowModal part to your main form:

--- 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; If your second form(Form2) does not behave like a modal form, please attach your project or try something like this:

--- 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  Form1.Enabled := False;  try    Form2.ShowModal;  finally    Form1.Enabled := True;  end;end; The last method really shouldn't be necessary.  ShowModal always works fine for me.

Hartmut:
I tried both suggestions, thank you. Suggestion 1 did not help, but suggestion 2 did.
Meanwhile I found out, that this "modal" problem is only on Linux Ubuntu 18.04, but not on Windows 7.
I attached my little project and a screenshot of the Runtime-Error when pressing Button1.
Are you on Windows or Linux?

GetMem:
@Hartmut

--- Quote ---I tried both suggestions, thank you. Suggestion 1 did not help, but suggestion 2 did.
Meanwhile I found out, that this "modal" problem is only on Linux Ubuntu 18.04, but not on Windows 7.
--- End quote ---
Windows and it works fine at my side, but should work with Linux(gtk2) too. In the past, there were some problem with modal forms(gtk2), but only when you show a modal form, from a modal form. Sort of a double modal form.
As for the error message, you should set form2 visible property to false.

Hartmut:
OK, I think we've got it. I have a solution. Your posts and examples were easy to understand for me. Thanks a lot again for your help.

Navigation

[0] Message Index

[*] Previous page

Go to full version