Recent

Author Topic: ShowModal freezes the device  (Read 9206 times)

GeorgiBonchev

  • Newbie
  • Posts: 6
ShowModal freezes the device
« on: December 29, 2017, 12:13:30 pm »
Hello,

I have written a simple WinCE app for testing. I have two forms. If I try to show the second form from the first (show or showmodal) the form starts to flash and the device becomes irresponsible. I call the second form like this:

Code: Pascal  [Select][+][-]
  1.   FormEnter:= TFormEnter.Create(Self);
  2.   FormEnter.Show;
  3.   FormEnter.Free;

Even simple ShowMessage('Hello') has the same effect. It happens on both WinCE 6.0 emulator and on the real device.

Is it a bug? And is there a workaround?

Thaddy

  • Hero Member
  • *****
  • Posts: 16132
  • Censorship about opinions does not belong here.
Re: ShowModal freezes the device
« Reply #1 on: December 29, 2017, 12:47:54 pm »
Do not touch size *in any way* - as documented - and it should work. WINCE 6 does not like forms that are not default screensize. Nothing you can do about it.
KOL for WINCE still works, just checked with an old HP device.
If I smell bad code it usually is bad code and that includes my own code.

GeorgiBonchev

  • Newbie
  • Posts: 6
Re: ShowModal freezes the device
« Reply #2 on: December 29, 2017, 01:21:51 pm »
Well, I do not change any sizes runtime. I have changed them in the project so they fit into the screen. Is this what is causing the problems? By the way I just checked - the program crashes if I set WindowsState to wsFullScreen or wsMaximized in the main form. So it is really looks like something with those damn sizes.

Am I supposed to have forms with only one same size? And should this size be the dafault size that is set when I create new form?

GeorgiBonchev

  • Newbie
  • Posts: 6
Re: ShowModal freezes the device
« Reply #3 on: December 29, 2017, 01:33:25 pm »
Well, I set both forms to height: 320 and width: 240 (display dimensions in the Emulator and I think in the device too). I tryed again in the emulator and still program freezes when I try to call second form.   :-\

Maybe I should not use poScreenCenter?

ertank

  • Sr. Member
  • ****
  • Posts: 276
Re: ShowModal freezes the device
« Reply #4 on: January 16, 2018, 07:24:09 pm »
I call the second form like this:
Code: Pascal  [Select][+][-]
  1.   FormEnter:= TFormEnter.Create(Self);
  2.   FormEnter.Show;
  3.   FormEnter.Free;
I believe, you should call FormEnter.ShowModal(); in your example code, otherwise, that example code immediately free the form you are trying to show on the screen.

When you call second form, set it's left and top properties in OnCreate() event both to zero in order second form to appear on the tiny WinCE screen. When you mention about flashing, I believe, second form is displayed on the screen, but it has a coordinate (left, top) so high that it simply cannot be visible on the WinCE screen.

My experience with WinCE, WindowState do not work on it. So, leave it as wsNormal. You should set height, width, top and left manually in your code.

I did not have problem setting window size in my code at run-time, yet.

BTW, would you tell us what version of Lazarus & fpc you are using? WinCE has some bug fixes. It maybe possible you are using a version without these fixes. I just cannot remember the SNV revision number. All I can say is Lazarus SNV 56773 and fpc version 3.0.1 are working OK for me.


 

TinyPortal © 2005-2018