Random errors whilst populating option button

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Random errors whilst populating option button

Post by Nakia » Wed May 30, 2012 9:12 am

Hi All,

I have the below handler which I am using to populate the options within an option button.
Firstly it deletes all the options within the button, next it reads the contents of a fld into a Variable then places them into the button.
The fld that populates the Variable is on a different card to the btn (hence the card references)

The problem is sometimes the contents of the button display odd with funny code displayed after the
actual contents of the button. I have attached an image so you can see what I mean (the shape after the 12345). this happens on both the Simulator and the actual device.
it also seems to be random, sometimes it works just fine... seems to be if I access the button really fast after this handler has ran this is where the issue occurs.

code below

Code: Select all

on setPilotNameButton
   -- Deletes current contents of Btn PilotID from Card ScoreCard
   repeat with x = 1 to the number of lines of text of button "PilotID" of card "ScoreCard"
      delete line x of button "PilotID" of card "ScoreCard"
      delete line x of button "PilotID" of card "EditScores"
   end repeat
   -- place data from Pilots fld from card SetupMode into variable then insert into Btn PilotID on card ScoreCard
   put the text of field "Pilots" of card "SetupMode" into tPlist
   repeat with x = 1 to the number of lines of tPlist
      put line x of tPlist into line x of button "PilotID" of card "ScoreCard"
      put line x of tPlist into line x of button "PilotID" of card "EditScores"
   end repeat
   --
end setPilotNameButton
Attachments
Untitled.tiff
Untitled.tiff (40.96 KiB) Viewed 9449 times

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

Re: Random errors whilst populating option button

Post by Klaus » Wed May 30, 2012 11:51 am

Hi Nakia,

the "strange" shape is the EURO sign, the european currency :D

But I guess this is some charset problem going on here!
Where does the content of your variables from?
A database? Online?

And try this to simplify your script and save a lot of typing:

Code: Select all

on setPilotNameButton

    ## Get new content:
     put the text of field "Pilots" of card "SetupMode" into tPlist

     ## Simply OVERWRITE the complete content of the buttons in ONE step:
     set the text of button "PilotID" of card "ScoreCard" to tPlist
     set the text of button "PilotID" of card "EditScores" to tPlist
end setPilotNameButton
:)


Best

Klaus

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: Random errors whilst populating option button

Post by Nakia » Wed May 30, 2012 12:01 pm

Thanks.

The symbols that appear at the end of the options within the button are also random.
They differ every time this error occurs.

sometimes it may only add one extra character and other times more than 10 extra characters will appear.

the data itself comes from within a fld. the data gets entered into this fld from 3 ios text flds.
this fld also re populates this data on startup by reading in a file..

I will place your code into that handler and see if that potentially makes any difference.

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: Random errors whilst populating option button

Post by Nakia » Wed May 30, 2012 12:19 pm

well I tried you code and the error still occurs.
I did get excited for a few moments thinking it had resolved the issue but it has just re occured again :(

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

Re: Random errors whilst populating option button

Post by Klaus » Wed May 30, 2012 12:58 pm

Hi Nakia,

my script was not intended to solve your problem, just ot save you some typing ;-)

What version of LiveCode are you using?
I remember having seen something like this in the past, but this had been fixed some time ago.

Can you write the text with the strange character to a file and take a look at that file later on your Mac/WIn machine?


Best

Klaus

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: Random errors whilst populating option button

Post by Nakia » Thu May 31, 2012 8:28 am

Using LC 5.02.

The odd thing about the text is that it only "appears" in the button.
if i write that content to a fld or a file it appears as it should....

Maybe I should update my LC and re compose and see what happens?

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: Random errors whilst populating option button

Post by Nakia » Sat Jun 02, 2012 3:48 am

Interestingly enough I am again seeing this issue in another area of my App.

Based upon the selection of an optionButton I have the below code which will modify the contents of one particular button.
once again, I am occasionally randomly seeing odd random amounts of characters at the end of the contents I am placing into the button.

I added the line to delete the contents first to see if that would help but didn't make any difference..

Does anyone have any idea's here?
It works fine on LC but errors as above on both the Simulator and the IPad??

Code: Select all

on unknownFilter
   if  the label of btn "SequenceType" = "UNKNOWN" then
      disable button "NextSequence" of card "ScoreCard"
      delete line 1 to 2 of btn "SequenceNumber" 
      put "SEQUENCE 1" into line 1 of btn "SequenceNumber" 
      set the label of btn "SequenceNumber" to "SEQ NUMBER ?"
   else
      enable button "NextSequence" of card "ScoreCard"
      delete line 1 to 2 of btn "SequenceNumber"
      put "SEQUENCE 1" into line 1 of btn "SequenceNumber" 
      put "SEQUENCE 2" into line 2 of btn "SequenceNumber" 
      set the label of btn "SequenceNumber" to "SEQ NUMBER ?"
   end if
   
end unknownFilter
Last edited by Nakia on Sat Jun 02, 2012 4:51 am, edited 1 time in total.

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: Random errors whilst populating option button

Post by Nakia » Sat Jun 02, 2012 4:48 am

Well upgraded to LC 5.5 and issue still exists :(

I am starting to get very frustrated with this issue. It is really all that is standing in the way of me finishing my first project.

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: Random errors whilst populating option button

Post by Nakia » Sat Jun 02, 2012 5:23 am

Well did a bit more testing and it appears it only occurs on an option Button.
Combo,Pulldown etc all work as expected...

Now I am really beginning to think it is an error with LiveCode... :x

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

Re: Random errors whilst populating option button

Post by bn » Sat Jun 02, 2012 8:14 am

Hi Nakia,

could you post a stripped down version of your stack that shows the problem? Just maybe two cards and the buttons.

It might be a unicode problem. As of version 5.5 of LiveCode there is a new property: the unicodeLabel of a button.

iOS uses unicode and maybe you have some strange characters in your text that are invisible in ASCII but change the unicode appearence of your label.

The whole unicode thing is confusing but necessary if a operating system wants to support a wide range of character sets.

To post a stack you have to zip it first and then upload it.

Kind regards
Bernd

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: Random errors whilst populating option button

Post by Nakia » Mon Jun 04, 2012 12:21 pm

Hi bn,

I have attached the entire stack for you to look at.

Basically, what you need to do to show the problem is:
1. open the app on the Ipad or Simulator (issue happens more on the actual IPad)
2. press the SETUP Button
3. enter the password "asaa" this will be changed before release so no issues
4. up the top enter a Name in the "Pilot name", enter a Surname in the next box and a number in the third and hit "ADD PILOT"
5. do this again for another Pilot or two (another Name surname and number etc)
6. select a judge Number (doesn't matter which one)
7. press exit
8. press Scribe Button
9. press the button that is hilited when the card opens (PILOT NAME?) and this is where you will see the issue.

any help you could provide would be fantastic.

Few things to note.
This is my first app and fist go at making a program so be kind :)
I really appreciate any help you could provide :)

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: Random errors whilst populating option button

Post by Nakia » Mon Jun 04, 2012 12:23 pm

well that didn't work as the file is too big.

I cant really strip it down as the process that is causing the issue is reliant on a few parts of the App.
any other ideas on how I can get you this STACK?

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

Re: Random errors whilst populating option button

Post by Dixie » Mon Jun 04, 2012 12:23 pm

Nakia..

I don't see you stack attached to your post..:-(

be well

Dixie

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

Re: Random errors whilst populating option button

Post by bn » Mon Jun 04, 2012 12:29 pm

Hi Nakia,

make a button, set it's script to

Code: Select all

on mouseUp
   put "bmlnZ2VtYW5uQHVuaS13aC5kZQ==" into tData
   put base64decode(tData)
end mouseUp
it will put the address into the message box.

give me a little time

Kind regards
Bernd

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

Re: Random errors whilst populating option button

Post by Dixie » Mon Jun 04, 2012 12:38 pm

Hi Bernd...

What a nice little trick...:-) We live and learn... You've made my day !

Dixie

Post Reply