Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Uncaught TypeError: Cannot read property 'tcontrol_getlayout' of null (2.06b2)
Mon, Jul 3 2017 10:45 AMPermanent Link

Frederick Chin

I have a form with two edit boxes and a button. After entering values in the edit boxes, I click the button and another form is called. In the second form, a button is clicked which returns to the first form.

Once the focus lands on the first edit box, the error pops up and it keeps displaying multiple times.

This problem does not occur in EWB's internal browser or the Chrome browser in Windows 10.

It only happens in my Android phone.

Where can I check to determine which line of code is causing the problem?

--
Frederick
Mon, Jul 3 2017 11:08 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< It only happens in my Android phone.

Where can I check to determine which line of code is causing the problem? >>

Please send me the project that causes the error and I'll check it out here.  If I can reproduce the issue, I can tell you what is wrong and whether it is a bug in EWB.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Jul 3 2017 6:38 PMPermanent Link

Frederick Chin

Tim,

/*
Please send me the project that causes the error and I'll check it out here.  If I can reproduce the issue, I can tell you what is wrong and whether it is a bug in EWB.
*/

I was unable to repeat the above error while I was preparing the sample project but another error has popped up in the attached project files. The error message is "Unable to get property 'tcontrol_getdisplayorder' of undefined or null reference".

This error occurs whether I am using the internal EWB browser or on Android.

In the sample application, click the Login button. Then, click the "Show Balance" button. Finally, click the Cancel button. The error is shown.

--
Frederick



Attachments: test2.zip
Mon, Jul 3 2017 9:00 PMPermanent Link

Frederick Chin

Tim,

I am attaching another sample project that shows the error "Uncaught TypeError: Cannot read property 'telement_setwidth' of null.

This error occurs on Android only.

In the sample application, click the Login button. Then, click the Exit button. The error is shown.

I've managed to trace the offending code to DesktopResized() in MAIN.WBS but I am not sure why it would cause the problem. The procedure is there to change the dimensions of the form when the user switches between portrait and landscape mode.

--
Frederick



Attachments: test3.zip
Mon, Jul 3 2017 9:55 PMPermanent Link

Raul

Team Elevate Team Elevate

On 7/3/2017 9:00 PM, Frederick Chin wrote:
> This error occurs on Android only.
> In the sample application, click the Login button. Then, click the Exit button. The error is shown.
>
> I've managed to trace the offending code to DesktopResized() in MAIN.WBS but I am not sure why it would cause the problem. The procedure is there to change the dimensions of the form when the user switches between portrait and landscape mode.

Looks like a simple programmer error :

You're doing this

   Application.ViewPort.OnSize := DesktopResized;

When you FREE the frmMain the "Application.ViewPort.OnSize" points to an
invalid memory location.

If OnSize for any reason gets called you get an exception since
"DesktopResized" does not exist anymore.

Fix is to set the callback back to nothing for example before you free
the main form.

For example

procedure TfrmLogin.clsMain(Sender: TObject);
begin
   Application.ViewPort.OnSize := nil;
   frmMain.Free;
   self.show;
end;


Raul
Mon, Jul 3 2017 11:19 PMPermanent Link

Frederick Chin

Raul wrote:

/*
Looks like a simple programmer error :

You're doing this

   Application.ViewPort.OnSize := DesktopResized;

When you FREE the frmMain the "Application.ViewPort.OnSize" points to an
invalid memory location.

If OnSize for any reason gets called you get an exception since
"DesktopResized" does not exist anymore.

Fix is to set the callback back to nothing for example before you free
the main form.

For example

procedure TfrmLogin.clsMain(Sender: TObject);
begin
   Application.ViewPort.OnSize := nil;
   frmMain.Free;
   self.show;
end;
*/

Thanks for the fix. Based on your code above, I moved the DesktopResized() code into the form's OnSize event and that made it simpler to maintain since I did not have a separate procedure and the need to set and NIL the Application.ViewPort.OnSize's event.

--
Frederick
Image