Page 1 of 1

Fit backgroundPattern image to a smaller stack

Posted: Fri Oct 27, 2017 2:39 pm
by tomsve
Developing for mobile.

I've important an image in a substack that I want to use as a background in my normal stack. Because the imported image is bigger than the stack, the background now looks strange (too big - because my image is 1.4 times bigger) when I use it as backgroundPattern.

Is there any way to resize the image used for backgroundPattern to fit a slightly smaller stack? I use a bigger image because I don't want the background image to have bad quality if someone uses an iPhone Plus for example.

The alternative seems to be to use an image control with Layer 1, but then it's not possible to tap outside the input fields to remove the keyboard toggle.

Any ideas?

Thanks,
Tom

Re: Fit backgroundPattern image to a smaller stack

Posted: Fri Oct 27, 2017 3:31 pm
by Klaus
Hi Tom,

do something like this, maybe "on preopenstack":
...
## In any case set the LOCLOCK of the image to true first in the inspector!

## First resize the image:
set the rect of img "you image here..." to the rect of this stack
## Or set width and height as you wish...

## NOW set the backgroundpattern via script:
set the backgroundpattern of this stack to xxx
##(the id of that image)
...

Best

Klaus

Re: Fit backgroundPattern image to a smaller stack

Posted: Fri Oct 27, 2017 4:15 pm
by bogs
tomsve wrote:
Fri Oct 27, 2017 2:39 pm
I've important an image in a substack that I want to use as a background in my normal stack. Because the imported image is bigger than the stack, the background now looks strange (too big - because my image is 1.4 times bigger) when I use it as backgroundPattern.
Alternately, you could just resize the image in any image editor, then use it in the program. However, if your stack size changes a lot, what Klaus said.

Re: Fit backgroundPattern image to a smaller stack

Posted: Fri Oct 27, 2017 4:34 pm
by tomsve
Great, thanks both of you. I'll try it.

Re: Fit backgroundPattern image to a smaller stack

Posted: Fri Oct 27, 2017 6:55 pm
by jacque
If I remember right a background pattern will only use its native size, but try it. If that doesn't work, use a second image instead and disable it. That will allow taps to go through to the card normally and dismiss the keyboard.

Re: Fit backgroundPattern image to a smaller stack

Posted: Fri Oct 27, 2017 7:05 pm
by tomsve
I tried a little bit back and forth and eventually I got it to work with Klaus method, but in the preOpenCard.

That's also a suggestion jacque, thanks. I'll have that in mind. I was thinking that might be a solution to a problem I just posted now about the datagrid borders, but I think not.

Thanks for quick help. Hopefully I'll have my next app in the store soon :-)