Recent

Author Topic: ShowModal is not working anymore?  (Read 5860 times)

ertank

  • Full Member
  • ***
  • Posts: 244
ShowModal is not working anymore?
« on: April 12, 2016, 10:28:27 pm »
Hi,

I am not quite sure, but I cannot display a form as modal in WinCE platform. For example, attached program becomes unresponsive (picture 2) after clicking "Modal Show Form2" button (picture 1).

Project has 2 forms total. Only Form1 is auto created. When button clicks, Form2 created and displayed with ShowModal. Unfortunately, code executes it, directly goes to Free section and application become unresponsive.

If I change code to Form2.Show; everything is just fine.

My device is from http://www.dsic.co.kr/ model is DS5 under mobile solutions.

Thanks & regards,
-Ertan

GetMem

  • Hero Member
  • *****
  • Posts: 3495
Re: ShowModal is not working anymore?
« Reply #1 on: April 13, 2016, 05:41:52 am »
Quote
Project has 2 forms total. Only Form1 is auto created. When button clicks, Form2 created and displayed with ShowModal. Unfortunately, code executes it, directly goes to Free section and application become unresponsive
Probably it's a bug! Unfortunately I don't have WinCE to test it.

Quote
If I change code to Form2.Show; everything is just fine.
As a  quick workaround(asically you achieve the same thing):
1. Unit1
Code: Pascal  [Select]
  1. uses unit2;
  2.  
  3. procedure TForm1.Button1Click(Sender: TObject);
  4. begin
  5.   Form1.Enabled := False;
  6.   Form2 := TForm2.Create(Self);
  7.   Form2.Show;
  8. end;

2. Unit2
Set Form2 FormStyle to fsStayOnTop/fsSystemStayOnTop
Code: Pascal  [Select]
  1. uses unit1;
  2.  
  3. procedure TForm2.FormClose(Sender: TObject; var CloseAction: TCloseAction);
  4. begin
  5.   CloseAction := caFree;
  6.   Form1.Enabled := True;
  7. end;  
 

ertank

  • Full Member
  • ***
  • Posts: 244
Re: ShowModal is not working anymore?
« Reply #2 on: April 13, 2016, 09:03:22 am »
Hi,

Yes, similar thing can be achieved with your sample code. I used to use Modal windows myself. Show one get information from it. Continue with received information kind of coding what I generally do.

This will somehow change my habits, leading me to a bug full of coding  %)

GetMem

  • Hero Member
  • *****
  • Posts: 3495
Re: ShowModal is not working anymore?
« Reply #3 on: April 13, 2016, 09:25:31 am »
Quote
@ertank
es, similar thing can be achieved with your sample code. I used to use Modal windows myself. Show one get information from it. Continue with received information kind of coding what I generally do.
This will somehow change my habits, leading me to a bug full of coding  %)
You can always fill a bug report: http://bugs.freepascal.org/view_all_bug_page.php?project_id=1 . Hopefully somebody will fix the issue.

ertank

  • Full Member
  • ***
  • Posts: 244
Re: ShowModal is not working anymore?
« Reply #4 on: April 13, 2016, 11:24:47 am »
You can always fill a bug report: http://bugs.freepascal.org/view_all_bug_page.php?project_id=1 . Hopefully somebody will fix the issue.

Thanks. I already did. Waiting with patience.

ertank

  • Full Member
  • ***
  • Posts: 244
Re: ShowModal is not working anymore?
« Reply #5 on: May 10, 2016, 04:11:51 pm »
My test with Lazarus 1.7, fpc 3.0.0, SVN revision 52294 is a success.
ShowModal is working as it should be with above version.

Just wanted to follow up.