Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread EWB 3 Build 7 - IF with Boolean causes problem in Forms
Sun, Mar 22 2020 3:21 PMPermanent Link

Rob Frye

Testing a Boolean value in an IF statement, will stop a form from displaying when it is run.  Just being in the source code causes the problem even if the IF statement is never actually called.

For example -

  create a Visual Client Project
  set the form Background.Color (so that it should be visible when run)
  add a Click event procedure to the form class
  within the procedure add a boolean variable and an IF statement referencing it
  running the project results in a blank page


unit Unit1;

interface

uses WebCore, WebUI, WebForms, WebCtrls;

type

  TForm1 = class(TForm)
     procedure Form1Click(Sender: TObject);
  private
     { Private declarations }
  public
     { Public declarations }
  end;

var
  Form1: TForm1;

implementation

procedure TForm1.Form1Click(Sender: TObject);
var
  sw: Boolean;
begin
  sw := True;
  if (sw) then
     ShowMessage('TRUE');
end;

end.
Sun, Mar 22 2020 4:31 PMPermanent Link

Raul

Team Elevate Team Elevate

On 3/22/2020 3:21 PM, Rob Frye wrote:
> Testing a Boolean value in an IF statement, will stop a form from displaying when it is run.  Just being in the source code causes the problem even if the IF statement is never actually called.
>
> For example -
>
>     create a Visual Client Project
>     set the form Background.Color (so that it should be visible when run)
>     add a Click event procedure to the form class
>     within the procedure add a boolean variable and an IF statement referencing it
>     running the project results in a blank page


This works OK for me as long as i don't change background colour - i.e.
i think issue is setting form background and not boolean value

Raul
Sun, Mar 22 2020 6:48 PMPermanent Link

Rob Frye

Raul wrote:

> This works OK for me as long as i don't change background colour - i.e.
> i think issue is setting form background and not boolean value
>
> Raul

No, I don't believe it is related to setting the background color.  If you start with a new TForm and don't set any properties at all, the problem still occurs.  It just isn't as obvious because the form would be transparent.  I believe if you try clicking on the form, you will still see that it isn't working properly because the message box won't be displayed.

Further, if you replace
   "if (sw) then"
with
  "if (sw = True) then"
you will see the problem goes away.

Rob
Mon, Mar 23 2020 4:26 AMPermanent Link

Matthew Jones

I've not had time to play much with theeh Betas, but I'd want to look at the emitted code. What's wrong with it? What console errors are shown?
Thu, Mar 26 2020 5:12 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Rob,

<< Testing a Boolean value in an IF statement, will stop a form from displaying when it is run.  Just being in the source code causes the problem even if the IF statement is never actually called. >>

This is now fixed.  It was a simple JS emitting issue where certain types of expression were not emitting any wrapped parentheses properly.

Thanks !

Tim Young
Elevate Software
www.elevatesoft.com
Image