Bocchi Posted June 21, 2017 Posted June 21, 2017 Is it possibile to detect screen orientation in a UniGui application running on smartphone? Thanks. Quote
Sherzod Posted June 21, 2017 Posted June 21, 2017 Hi, Do you mean a desktop UniGUI app ?! Best regards, Quote
Sherzod Posted June 21, 2017 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"); } }) Quote
Sherzod Posted June 22, 2017 Posted June 22, 2017 Hi, How about for mobile ? MainmForm -> ClientEvents -> ExtEvents -> window.orientationchange fn: function window.orientationchange(eOpts) { } Best regards, Quote
Sherzod Posted June 22, 2017 Posted June 22, 2017 How about for mobile ? Which edition and build are you using ?! Quote
mikromundo Posted November 1, 2023 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? Quote
irigsoft Posted November 2, 2023 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 Quote
mikromundo Posted November 2, 2023 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. Quote
irigsoft Posted November 2, 2023 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 ? Quote
Sherzod Posted November 2, 2023 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. Quote
mikromundo Posted November 2, 2023 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 !!! Quote
Thiago Moraes Posted November 28, 2023 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. Quote
mikromundo Posted November 28, 2023 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". Quote
Thiago Moraes Posted November 29, 2023 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). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.