Page 1 of 2
Random errors whilst populating option button
Posted: Wed May 30, 2012 9:12 am
by Nakia
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
Re: Random errors whilst populating option button
Posted: Wed May 30, 2012 11:51 am
by Klaus
Hi Nakia,
the "strange" shape is the EURO sign, the european currency
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
Re: Random errors whilst populating option button
Posted: Wed May 30, 2012 12:01 pm
by Nakia
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.
Re: Random errors whilst populating option button
Posted: Wed May 30, 2012 12:19 pm
by Nakia
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

Re: Random errors whilst populating option button
Posted: Wed May 30, 2012 12:58 pm
by Klaus
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
Re: Random errors whilst populating option button
Posted: Thu May 31, 2012 8:28 am
by Nakia
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?
Re: Random errors whilst populating option button
Posted: Sat Jun 02, 2012 3:48 am
by Nakia
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
Re: Random errors whilst populating option button
Posted: Sat Jun 02, 2012 4:48 am
by Nakia
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.
Re: Random errors whilst populating option button
Posted: Sat Jun 02, 2012 5:23 am
by Nakia
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...

Re: Random errors whilst populating option button
Posted: Sat Jun 02, 2012 8:14 am
by bn
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
Re: Random errors whilst populating option button
Posted: Mon Jun 04, 2012 12:21 pm
by Nakia
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

Re: Random errors whilst populating option button
Posted: Mon Jun 04, 2012 12:23 pm
by Nakia
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?
Re: Random errors whilst populating option button
Posted: Mon Jun 04, 2012 12:23 pm
by Dixie
Nakia..
I don't see you stack attached to your post..
be well
Dixie
Re: Random errors whilst populating option button
Posted: Mon Jun 04, 2012 12:29 pm
by bn
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
Re: Random errors whilst populating option button
Posted: Mon Jun 04, 2012 12:38 pm
by Dixie
Hi Bernd...
What a nice little trick...

We live and learn... You've made my day !
Dixie