Page 1 of 1

Checking boxes within a group

Posted: Thu Apr 04, 2013 10:15 pm
by Tester2
I have a Group (Scrl). Within that group are Buttons that function as checkboxes (ie: I have an image of an unchecked box and a checked box that switch when clicked on). They are grouped because this is a scrollable card. I am using this code to scroll:

on OpenCard
set the layerMode of group "Scrl" to "scrolling"
if the platform is "iphone" then
set the compositorType of this stack to "opengl"
else
set the compositorType of this stack to "software"
end if
set the compositorTileSize of this stack to 64
set the compositorCacheLimit of this stack to (16 * 1024 * 1024)
end OpenCard

My issue is that when I scroll and then try to click one of the buttons, the screen jumps (as it finds the object) and then I have to click again to actually get the button to function (change image). Is there a way I can get this to not jump, and to immediately change my image when clicked?

Thanks.

Re: Checking boxes within a group

Posted: Fri Apr 05, 2013 11:26 am
by Klaus
Hi Tester2,

I deleted your double posting.
As Simon said, please only one thread per question, thanks!

You could simply use a "real" checkbox object and set its ICON (icon and hilite) properties!
This way you do not need to group and/or script anything and this will surely scroll as desired!
At least worth a try :D

Best

Klaus

Re: Checking boxes within a group

Posted: Fri Apr 05, 2013 9:43 pm
by Tester2
I changed them to Check Box type buttons, but I still have the issue.

I need to have them as part of the group so that the user can scroll the card (the checkboxes on my card extend beyond the initial size of the iPhone so the user must scroll down to see/and check the checkboxes.

Does that make sense?

Re: Checking boxes within a group

Posted: Fri Apr 05, 2013 10:07 pm
by Simon
Could you post a sample stack?

Simon

Re: Checking boxes within a group

Posted: Sat Apr 06, 2013 4:47 am
by endernafi
Posting a stripped-out stack is always a great way to get helpful answers 8)

And as a fellow LiveCoder who struggled with compositor... thingy for a long time,
I must say, don't use them
unless it's a specialized app which should be customized according to the device
and you don't know what you're doing exactly.

Use set the acceleratedRendering of this stack to true instead,
this command chooses the best settings for the device.

You can check this post, if you want a little more detail about this issue.


Best,

~ Ender Nafi

Re: Checking boxes within a group

Posted: Mon Apr 08, 2013 10:10 pm
by Tester2
Here is a link to a sample "ScrollSample" stack:

http://dl.dropbox.com/u/5777653/ScrollS ... vecode.zip

If you go to the card with the screenshots and checkboxes then you can see the weird navigation issues that I am having when checking/unchecking the boxes. The screen kind of jumps and is chunky.

Please let me know of any remedies/comments.

Thanks!

Re: Checking boxes within a group

Posted: Mon Apr 08, 2013 11:19 pm
by endernafi
Hi Tester2,

Check this one out:
ScrollSample2.zip
(217.78 KiB) Downloaded 255 times
No jumpy behavior, anymore.
I've changed your scroller script in group "Scrl" to the native mobile scroller. It's in the card script.
If you still want to go with your original scroller script, it requires too much coding to behave.
Actual problem is that the mouseUp events triggered by the checkboxes are interfering with the scroller script's events.
and to immediately change my image when clicked?
I didn't quite get what you mean.
If this is another problem, please explain a little further.

One humble advice, though;
you'll probably need a good resize handler.
The stack looks nice in iphone5
but it crops the bottom edge in iphone4 and it crops all over in iphone3.


Hope it helps...

Best,

~ Ender Nafi

Re: Checking boxes within a group

Posted: Mon Apr 08, 2013 11:28 pm
by Simon
My 2 cents (though Ender's use the native mobile scroller is better)
at the bottom of all your checkbox mouseUp scripts add "pass mouseUp".

Simon

Re: Checking boxes within a group

Posted: Mon Apr 08, 2013 11:37 pm
by endernafi
Simon, your 2 cents won 8)
I've checked out your solution and voila...

So, Tester2;
you can choose whichever solution you want.
Both works.
Go wild :wink:


~ Ender Nafi

P.S.: Don't forget the resize handler unless you don't have one already.