scroller staying despite delete?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
witeowl
Posts: 45
Joined: Mon Feb 21, 2011 3:02 am

scroller staying despite delete?

Post by witeowl » Tue Mar 22, 2011 8:21 am

I believe that I'm supposed to use iphoneControlDelete sScrollerId (that's the variable I'm using to store the result of iphoneControlCreate) to get rid of the scroller when changing cards, but it doesn't seem to be working. I go to the next card, and although it has no effect, the little scroller along the side will show up on attempted swipes, sized to what it was on the previous card.

I have it in the closeCard handler, and the other commands in the handler are working.

The only way the little fake scroller goes away is when opening a card with a datagrid small enough that it's not needed. It will then stay away on subsequent card openings.

Help :?:

witeowl
Posts: 45
Joined: Mon Feb 21, 2011 3:02 am

Re: scroller staying despite delete?

Post by witeowl » Tue Mar 22, 2011 8:31 am

Now that I ask this, I was thinking of a work-around, and began to wonder whether I should just go ahead and let it stay, resizing it as needed (and using a global variable to store the control ID). That almost sounds better than creating it and deleting it on each card that needs it. Am I way off with this thinking?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4166
Joined: Sun Jan 07, 2007 9:12 pm

Re: scroller staying despite delete?

Post by bn » Tue Mar 22, 2011 10:09 am

Hi witeowl,

did you declare a script local variable? That is a variable that is declared outside of any handler ususally at the top of a script. It can then be accessed from any handler in that script.

Code: Select all

local sScrollerID

on opencard
-- any code here
end opencard

on closecard
iphoneControlDelete sScrollerId
end closecard
if you dont declare the script local variable and try to use it in the closecard handler it will not work.

Whether to delete a scroller when leaving the card or not depends on your app. I prefer to do it because it is easier to maintain.

Kind regards

witeowl
Posts: 45
Joined: Mon Feb 21, 2011 3:02 am

Re: scroller staying despite delete?

Post by witeowl » Wed Mar 23, 2011 1:30 am

No, I'm a dork. I got so used to using just temporary and global variables in this project that I forgot to call the local variable outside of a handler. Duh, and thanks.

Post Reply