Bocchi Posted June 21, 2017 Share Posted June 21, 2017 Is it possibile to detect screen orientation in a UniGui application running on smartphone? Thanks. Link to comment Share on other sites More sharing options...
Sherzod Posted June 21, 2017 Share Posted June 21, 2017 Hi, Do you mean a desktop UniGUI app ?! Best regards, Link to comment Share on other sites More sharing options...
Sherzod Posted June 21, 2017 Share Posted June 21, 2017 If yes, can you try this approach ?!: MainForm -> Script: window.addEventListener('orientationchange', function(event){ switch(window.orientation){ case -90: case 90: // landscape alert("landscape"); break; default: // portrait alert("portrait"); } }) Link to comment Share on other sites More sharing options...
devya Posted June 22, 2017 Share Posted June 22, 2017 How about for mobile ? Link to comment Share on other sites More sharing options...
Sherzod Posted June 22, 2017 Share Posted June 22, 2017 Hi, How about for mobile ? MainmForm -> ClientEvents -> ExtEvents -> window.orientationchange fn: function window.orientationchange(eOpts) { } Best regards, Link to comment Share on other sites More sharing options...
Sherzod Posted June 22, 2017 Share Posted June 22, 2017 How about for mobile ? Which edition and build are you using ?! Link to comment Share on other sites More sharing options...
mikromundo Posted November 1, 2023 Share Posted November 1, 2023 On 6/22/2017 at 3:34 AM, Sherzod said: Hi, MainmForm -> ClientEvents -> ExtEvents -> window.orientationchange fn: function window.orientationchange(eOpts) { } Best regards, How can I lock the screen orientation? I've already tried some options but I can't be successful. Could you give any tips? Link to comment Share on other sites More sharing options...
irigsoft Posted November 2, 2023 Share Posted November 2, 2023 9 hours ago, mikromundo said: How can I lock the screen orientation? I've already tried some options but I can't be successful. Could you give any tips? hi, try this: https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/lock https://stackoverflow.com/questions/55564148/web-app-screen-orientation-lock-orientation-lock-failed Link to comment Share on other sites More sharing options...
mikromundo Posted November 2, 2023 Share Posted November 2, 2023 Thanks for the feedback, but I've already done all these tests. I can do it but only when it's in fullscreen. Link to comment Share on other sites More sharing options...
irigsoft Posted November 2, 2023 Share Posted November 2, 2023 1 hour ago, mikromundo said: Thanks for the feedback, but I've already done all these tests. I can do it but only when it's in fullscreen. So you dont want to be in fullscreen ? Link to comment Share on other sites More sharing options...
Sherzod Posted November 2, 2023 Share Posted November 2, 2023 14 hours ago, mikromundo said: How can I lock the screen orientation? Are you using a mobile browser? 14 hours ago, mikromundo said: I've already tried some options but I can't be successful. What exactly did you try? In any case, I think at the moment this is impossible if you use a mobile browser in the usual sense. Link to comment Share on other sites More sharing options...
mikromundo Posted November 2, 2023 Share Posted November 2, 2023 Yes, accessing via cell phone. It was really a question... whether it would be possible to do it without being in fullscreen. But I understand that it only works like that. thank you all !!! Link to comment Share on other sites More sharing options...
Thiago Moraes Posted November 28, 2023 Share Posted November 28, 2023 You can use JavaScript to detect the screen orientation in your UniGui application running on a smartphone. Just grab the 'window.orientation' property, and you'll know if it's in portrait or landscape mode. Link to comment Share on other sites More sharing options...
mikromundo Posted November 28, 2023 Share Posted November 28, 2023 Hello my friend, thank you. so...I created a specific function for orientation / platform detection...but the question above wouldn't be that. It's really change. is to force the orientation and as mentioned, it only works on "full screen". Link to comment Share on other sites More sharing options...
Thiago Moraes Posted November 29, 2023 Share Posted November 29, 2023 Yeah, it's totally possible to detect screen orientation in a UniGui app on a smartphone. You can use JavaScript to check the window.orientation property, and then take action based on the value (0 for portrait, 90 for landscape, -90 for landscape in the other direction). Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now