avoid button deformation

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

avoid button deformation

Post by fko2 » Fri Feb 20, 2015 3:10 pm

Hi,

The app i am doing, it is running in my iPad where the orientation is landscape, as i really imagined it...
But when it turns to portrait, the buttons are deformed...
I imagine that yes, but i am not able to imagine how should i do this.

In my openStack i have this line:

CODE: SELECT ALL
set the fullScreenMode of this stack to "exactFit"


but even when i changed with the other options of the fullScreenMode i have the same problem.
So, how to have the same pretty look of my button in both orientations??? In my case i have one button of 50 x 50 and one image of 50x50 for this button too...

So what should i do to preserve 'round' of this button and image when i change the orientation to portrait?

thanks for your advices / councils or ideas!

Regards.
fko

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: avoid button deformation

Post by Klaus » Fri Feb 20, 2015 3:22 pm

Hi fko,
CODE: SELECT ALL
set the fullScreenMode of this stack to "exactFit"
"SELECT ALL"? Do you really have this in your script?
"fullscreenmode" applies to the complete STACK and not only
to any selected control, if that is what you mean.

"fullscreenmode = exactfit" will of course ALWAYS result in a possible unproportionally scaling of controls!
So you need to use another fullscreenmode or resize all cour controls manuall/by script after user changed the orientation.
And there is no other option, except living with that inconvenience 8)


Best

Klaus

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: avoid button deformation

Post by fko2 » Fri Feb 20, 2015 3:38 pm

Hi Klaus,

So, for your question the answer is not!!! :-)
I have not the SELECT ALL in my code!!! Hahaha
I don't know why this appeared here in the topic...As i have only one line! :-)

Any of the fullScreenMode worked well for what i need...
So the option to resize the buttons sounds well for me! Even if in the theory, because when i tried to test it i found 'one problem'

I put in orientationChanged the next code

Code: Select all

answer the width of btn "btnFrd1" & " " & the height of btn "btnFrd1"
And always is giving me 50x50...Even if the button is deformed in the portrait orientation...
And for this i wondered about what and how i have to do...As what i could see is that the button was deformed but for the system the width and height are 50x50 ( so, the is nothing deformed apparently ).

Regards.
fko

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: avoid button deformation

Post by Klaus » Fri Feb 20, 2015 3:51 pm

Well, that's one of the reasons why I still try to avoid developing for mobile 8)

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: avoid button deformation

Post by fko2 » Fri Feb 20, 2015 4:00 pm

It means that there is no solution???

Regards.
fko

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: avoid button deformation

Post by Klaus » Fri Feb 20, 2015 4:15 pm

That means that I have no idea! :D

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: avoid button deformation

Post by fko2 » Fri Feb 20, 2015 4:33 pm

Ok, so at least i can keep the hope!!! :-)

Any help about my problem???

Regards.
fko

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: avoid button deformation

Post by jacque » Fri Feb 20, 2015 6:36 pm

OrientationChanged is sent before the screen is redrawn. To get the measurements after the redraw, put your command into a resizestack handler.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: avoid button deformation

Post by fko2 » Sat Feb 21, 2015 10:46 am

Hi Jacque,

I put this

Code: Select all

on resizeStack
  answer the width of btn "btnFrd1" & " " & the height of btn "btnFrd1"
end resizeStack
And also like this as what i saw in the dictionary:

Code: Select all

on resizeStack newWidth,newHeight
  answer the width of btn "btnFrd1" & " " & the height of btn "btnFrd1"
end resizeStack
But nothing is happening when i change the orientation of my iPad...So, it is evident that i am not doing it well as i have no 'answer'!
I think i didn't understand well what in the dictionary was explained about this...
So this handler it is me who has to invoke it? It is not like the OrientationChanged that is invoked 'alone' in each change?
from where should i have to invoke it to make it work???

Sorry if my questions seemed basics, but i didn't manage to do it alone, and even i didn't understand well what was explained in the dictionary...:-(

Regards.
fko

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: avoid button deformation

Post by Dixie » Sat Feb 21, 2015 2:28 pm

Mmm... Well, there is another way to go about this and that is to 'place' each object in a particular location depending on the orientation of the stack. This is my preferred method as I don't mess with android... So, I have attached a stack that will rotate and place two buttons correctly depending on the orientation of the ipad... run it in the simulator or on a device...

Hope it helps...:-)
Attachments
padorient.livecode.zip
(2.26 KiB) Downloaded 226 times

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: avoid button deformation

Post by fko2 » Sat Feb 21, 2015 9:20 pm

Hi Dixie,

first of all, your code is working fine in my simulator!!! :-)
Thanks for the example...:-)
But for what i wanted or tried to do is not working...:-(

I will explain you what i have, to see if you can tell me what should i do, or what i am doing wrong!

So i have one group in my card "cardL" with some elements (some of them are buttons). These buttons they have one size 40x40 and they have one icon that is round (also 40x40).
For example the first button of the seven i have is in the rect "56,273,96,213" and its location is "76,293". Adding 50 to the "Y loc" from this first button, you can find the second one, and 50 more the third one...Like this till the seventh button!
With this group i can make also vertical scrolling ( i don't know if this detail is important or not ).

In your code you have:

Code: Select all

         set the topLeft of group 1 to 11,10
         set the right of group 2 to the width of this card -10
         set the bottom of group 2 to the height of this card -10
for me, for the landscape i would like that the button 1 will be in the position "76,293" and the button 2 will be in the position "76,343", etc...

Code: Select all

         set the topLeft of btn 1 to 56,273
         set the right of btn 1 to 96 
         set the bottom of btn 1 to 313

         set the topLeft of btn 2 to 56,323
         set the right of btn 2 to 96 
         set the bottom of btn 2 to 363
What i don't know is what should i do for the portrait and how to find the correct location for this orientation and how finally the button in the portrait orientation won't be deformed...

And one last thing. There is one difference between Android and iOS for this? I am wondering as you said something about android in your last post...

Regards.
fko

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: avoid button deformation

Post by Dixie » Sat Feb 21, 2015 9:54 pm

Can you post a screen shot of your stack ?

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: avoid button deformation

Post by fko2 » Sun Feb 22, 2015 10:51 am

Hi Dixie,

I attach the two screenshots...
In the portrait the one, the buttons are deformed! :-(

I hope with the screenshots and with what i wrote in the other post, now it is more understandable what i am trying to explain...:-)

Regards.
fko
Attachments
screenshotPortrait.png
screenshotLandscape.png

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: avoid button deformation

Post by jacque » Sun Feb 22, 2015 8:22 pm

Are you using fullscreenMode? It looks like you are, and that you've chosen a mode that squeezes the content to fit the screen. If that's true, choose a mode that preserves the aspect ratio and does not rescale the content. For example, "exactFit" will change the proportions of objects so don't use that. Letterbox, noBorder, and showAll will work.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

fko2
Posts: 78
Joined: Sat Feb 07, 2015 12:58 pm

Re: avoid button deformation

Post by fko2 » Sun Feb 22, 2015 11:05 pm

Hi Jacque,

So yes, i am using "exactfit"...But i didn't notice any difference in my iPad when i tried also with "letterBox", "showAll", etc. :-(

I created all the cards thinking in one card 1024x768 ( iPad ), even if i also want that it will work in one iPhone.
And for this my idea was to use "exactfit". But when i saw that the buttons were deformed ( from landscape to portrait ) is when i began to think in that i should control in each change of orientation ( i will see what Dixie will tell me about how to control this, to can cam make appear the button in the same place in the proportional screen... ) to keep the appearance it has in the iPad landscape format.

And the intention is that it will have this appearance for iPad and iPhone and in landscape and portrait...So, for this target, the solution is the "exactfit" as i was doing or i was wrong in my thinkings? For what i saw in the dictionary i thought that this was corresponding to my needs, but maybe it is not like this...:-(

Regards,
fko

Post Reply