Checking boxes within a group

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Tester2
Posts: 102
Joined: Wed May 18, 2011 7:02 pm

Checking boxes within a group

Post by Tester2 » Thu Apr 04, 2013 10:15 pm

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.

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

Re: Checking boxes within a group

Post by Klaus » Fri Apr 05, 2013 11:26 am

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

Tester2
Posts: 102
Joined: Wed May 18, 2011 7:02 pm

Re: Checking boxes within a group

Post by Tester2 » Fri Apr 05, 2013 9:43 pm

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?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Checking boxes within a group

Post by Simon » Fri Apr 05, 2013 10:07 pm

Could you post a sample stack?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

Re: Checking boxes within a group

Post by endernafi » Sat Apr 06, 2013 4:47 am

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
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Tester2
Posts: 102
Joined: Wed May 18, 2011 7:02 pm

Re: Checking boxes within a group

Post by Tester2 » Mon Apr 08, 2013 10:10 pm

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!

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

Re: Checking boxes within a group

Post by endernafi » Mon Apr 08, 2013 11:19 pm

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
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Checking boxes within a group

Post by Simon » Mon Apr 08, 2013 11:28 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

Re: Checking boxes within a group

Post by endernafi » Mon Apr 08, 2013 11:37 pm

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.
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Post Reply