[Orientation Event] Got errors when using Orientation Event

Forge Component
(3)
Published on 3 Jan by José Costa
3 votes
Published on 3 Jan by José Costa

Hi, I tried to use your Orientation Event block, in order to detect orientation changes, and refresh my screen.


But it only works the first time I changed orientation, the event is fired and it works as expected.  After that every time I change orientation the event is not fired and in the logs I see error:


Line 376:Uncaught ReferenceError: global is not defined

Line 2: Controller [2020-02-17T09:48:08:512Z] Invalid call of the 'OrientationHasChanged' client action of the 'MainFlow.AuditDetailList' since the latter is not currently active. This is likely due a platform's cient action being used as an event handler or in a setTimeout function. Consider removing this call by using the 'onDestroy' event of the screen/block or moving your logic to a global client action.....


I'm using the version 1.1.0 and OutSystems 11.


Can you advise me what I'm doing wrong?



Hello João,


I Installed this component just now, and it seems to be working.

Can you send a oml with the error? so that i can try to help you out.


With the best regards,

Gonçalo

Hi João,

Where are you getting/seeing those errors?

Also, as Gonçalo has said, can you share your oml?

Cheers,

José

Hello José and Gonçalo.


Thank you for the quick feedback.


The errors I see in the Debug Logs of OutSystems now application.

In attachment I sent an OML with the project.


In my project I use the IsPhone() action to assign the container class accordingly, but I found that when I rotate the screen, the action is not being evaluated.

Since there are some devices that on landscapeare considered "Tablets" and on portrait are considered "Phones", when I rotate the screen, the layout maintains the same.

I was using your Block to on rotate, navigate to the same screen in order to refresh it.

The first time I rotate the screen, everything works as expected.... after that never works again, and I can see the errors on Debug Logs of OutSystems now application.

Thank you


Joao Rodrigues

Hello João,

I used your oml and did 2 changes, put one expression in the screen to see the orientation and in the action that handles the event i changed the currentscreen for a End node, and it's working.

I'm testing this directly in the browser of my mobile.

With the best regards,

Gonçalo