Having troubles with multiple orientations [solved]
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Having troubles with multiple orientations [solved]
Hello everyone,
I am working on an app that has one main stack and several substack. The orientation of the main stack is portrait and the orientation for the substacks are landscape. In the stack script, I have imposed the orientation for the stacks.
When I call a substack it opens with the proper orientation. But when I close the substack, all the objects are now all the way down of the main stack and the orientationChanged handler is not deal with.
I am using Livecode Community Plus 9 on a Windows 10 laptop.
on the main stack script
on preOpenStack
if the environment is "mobile" then
mobileSetAllowedOrientations "portrait"
set the fullScreenMode of me to "exactfit"
set the acceleratedRendering of me to true
mobileLockIdleTimer
mobileSetFullScreenRectForOrientations "portrait","0,0,414,736"
end if
end preOpenStack
on the substack script
on openStack
if the environment is "mobile" then
mobileSetAllowedOrientations "landscape left"
mobileSetFullScreenRectForOrientations "landscape left","0,0,960,540"
set the fullScreenMode of me to "exactfit"
set the acceleratedRendering of me to true
end if
end openStack
Regards,
paskr18
I am working on an app that has one main stack and several substack. The orientation of the main stack is portrait and the orientation for the substacks are landscape. In the stack script, I have imposed the orientation for the stacks.
When I call a substack it opens with the proper orientation. But when I close the substack, all the objects are now all the way down of the main stack and the orientationChanged handler is not deal with.
I am using Livecode Community Plus 9 on a Windows 10 laptop.
on the main stack script
on preOpenStack
if the environment is "mobile" then
mobileSetAllowedOrientations "portrait"
set the fullScreenMode of me to "exactfit"
set the acceleratedRendering of me to true
mobileLockIdleTimer
mobileSetFullScreenRectForOrientations "portrait","0,0,414,736"
end if
end preOpenStack
on the substack script
on openStack
if the environment is "mobile" then
mobileSetAllowedOrientations "landscape left"
mobileSetFullScreenRectForOrientations "landscape left","0,0,960,540"
set the fullScreenMode of me to "exactfit"
set the acceleratedRendering of me to true
end if
end openStack
Regards,
paskr18
Last edited by paskr18 on Tue May 25, 2021 5:59 pm, edited 1 time in total.
Re: Having troubles with multiple orientations
Hi everyone,
I was able to find a solution to my issue.
Regards,
paskr18
I was able to find a solution to my issue.
Regards,
paskr18
Re: Having troubles with multiple orientations [solved]
Can you please post it?
I am struggling with the same problem...
Regards
I am struggling with the same problem...
Regards
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 9960
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Having troubles with multiple orientations [solved]
Use the resizeStack message as the trigger.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Having troubles with multiple orientations [solved]
I would use resizeStack as @FourthWorld says and also the preOpenCard of each stack that has a specific orientation.
Be kind, we all have our own wars.
Re: Having troubles with multiple orientations [solved]
mmmh...
I am having no problem on going from landscape, in the main stack, to portrait in the substack using the script below.
I cannot make it run when, as in my case, I am trying to implement notifications and show them in a portrait card while the rest of the app runs in landscape (works on Android, not on iOS)
The script of the substack card:
As I said, going from stack to stack, the windows turns fine, since the preopenstacks are running (I close the substack on leaving).
But when the standalone is launched by the notification received, the PreOpencard and resizestack of the substacks don't run.
The substack has only 1 card.
I am having no problem on going from landscape, in the main stack, to portrait in the substack using the script below.
I cannot make it run when, as in my case, I am trying to implement notifications and show them in a portrait card while the rest of the app runs in landscape (works on Android, not on iOS)
Code: Select all
On Preopenstack --Main stack script
if "lib_notifications" is not in the stacksinUse then start using stack "lib_notifications" --where all the notification stuff is
if the environment = "mobile" then
set the rect of this stack to the screenRect
set the fullscreenmode of this stack to "letterbox"
mobileSetAllowedOrientations "landscape left,landscape right"
if the platform is "iPhone" and iphoneGetNotificationBadgeValue() > 0 then
retrieveNotification --this script is in the lib_notifications library and essenzially go to the substack where it shows the notification
end if
end if
end Preopenstack
on pushNotificationReceived pMessage
retrieveNotification --this script is in the lib_notifications library and essenzially go to the substack where it shows the notification
end pushNotificationReceived
Code: Select all
on PreopenCard
if the environment = "mobile" then
mobileSetAllowedOrientations "portrait,portrait upside down"
set the fullscreenmode of this stack to "letterbox"
--mobileSetFullScreenRectForOrientations "portrait",0,0,tHeigth,tWidth
--set the rect of this stack to 0,0, tHeigth,tWidth
end if
end PreopenCard
on resizeStack pNewWidth, pNewHeight, pOldWidth, pOldHeight
try
set the width of fld "NotificationText" of me to pNewWidth - 24
set the height of fld "NotificationText" of me to the formattedheight of fld "NotificationText" of me
set the rect of widget "NotBrowser" of me to 0, the bottom of fld "NotificationText" of me + 10, pNewWidth,pNewHeight
pass resizeStack
catch errorVariable
put errorVariable into msg
end try
end resizeStack
But when the standalone is launched by the notification received, the PreOpencard and resizestack of the substacks don't run.
The substack has only 1 card.
Trevix
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>
OSX 14.6.1 xCode 15 LC 10 RC1 iOS 15> Android 7>