Recent

Author Topic: Keep a form in front of his owning form in showmodal  (Read 5169 times)

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Keep a form in front of his owning form in showmodal
« on: September 08, 2014, 10:44:05 pm »
I create a new form

MiForm := TForm3.Create(self);
MiForm popupparent := self;
MiForm.PopupMode:= pmExplicit;
MiBuyInForm.ShowModal;

But it keeps all the forms of my app locked. If i just call MiBuyInForm.ShowModal , the new form remains in top of the calling one, but do not blocks it from new click.

Any help ?
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Keep a form in front of his owning form in showmodal
« Reply #1 on: September 09, 2014, 12:47:01 am »
show modal is suppose to lock all the other forms while the modal form is visible. If for any reason it does not lock everything then it is a bug a small sample replicating the bug so we can check it would be nice and of course a bug report on mantis is mandatory, attach the sample in mantis and post here a link to the report instead of uploading it here directly.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Keep a form in front of his owning form in showmodal
« Reply #2 on: September 09, 2014, 03:09:34 am »
Sorry, i miss typed this...

I create a new form

MiForm := TForm3.Create(self);
MiForm popupparent := self;
MiForm.PopupMode:= pmExplicit;
MiBuyInForm.ShowModal;

But it keeps all the forms of my app locked. If i just call MiForm.Show , the new form remains in top of the calling one, but do not blocks it from new click.

Any help ?

Using showmodal lock all forms as it is suppossed, but i want just lock the owner form (DialogDirectory do that, for example)
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: Keep a form in front of his owning form in showmodal
« Reply #3 on: September 13, 2014, 03:50:04 am »
I give a try to this for 2 days and im not able to find the way. Maybe it is not possible?
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

bylaardt

  • Sr. Member
  • ****
  • Posts: 309
Re: Keep a form in front of his owning form in showmodal
« Reply #4 on: September 13, 2014, 05:32:34 am »
On the OnCreate event of MiForm:
Code: [Select]
Tform(parent)enabled:=false;
On the OnClose event:
Code: [Select]
TForm(parent).enabled:=true;
And use Show as ShowModal.

If you need ShowModal Results, you mus set manually on the buttons clicks

if you need wait the window close, do this after the show:
Code: [Select]
while miform.visible do application.processmessages;

cpalx

  • Hero Member
  • *****
  • Posts: 753
Re: Keep a form in front of his owning form in showmodal
« Reply #5 on: September 14, 2014, 03:17:37 am »
Use stayontop property and use show function  not showmodal

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 451
  • Programming is FUN only when it works :)
    • Cool Technology
Re: Keep a form in front of his owning form in showmodal
« Reply #6 on: December 10, 2015, 08:51:33 pm »
Use stayontop property and use show function  not showmodal

What if you have to use ShowModal in your code?

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 451
  • Programming is FUN only when it works :)
    • Cool Technology
Re: Keep a form in front of his owning form in showmodal
« Reply #7 on: December 23, 2015, 06:06:42 pm »
On the OnCreate event of MiForm:
Code: [Select]
Tform(parent)enabled:=false;
On the OnClose event:
Code: [Select]
TForm(parent).enabled:=true;
And use Show as ShowModal.

If you need ShowModal Results, you mus set manually on the buttons clicks

if you need wait the window close, do this after the show:
Code: [Select]
while miform.visible do application.processmessages;

I know this thread or topic is old, but I've been looking for solution for the showmodal problem. I tried yours suggestion which I thought was very promising but it didn't work. Actually it raised Segmentation Fault and the whole program crashed or terminates itself....

 

TinyPortal © 2005-2018