LC: revpreferences

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9389
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

LC: revpreferences

Post by richmond62 » Wed Nov 24, 2021 12:42 pm

I want to list all the custom properties in the stack "revpreferences" and wonder
why:

Code: Select all

on mouseUp
   repeat for each element PLOP in customProperties of stack "revpreferences"
      put PLOP and return after fld "fPREFFS" of stack "ElsiePreffs"
      end repeat
end mouseUp
gives me this:

"falsefalsefalsefalsefalsefalsefalsefalse" and so on:

1. No returns?

2. "false" ?

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: LC: revpreferences

Post by Klaus » Wed Nov 24, 2021 12:56 pm

Yep, same here!? Must be a bug, if you step through that loop in the debugger PLOP shows the correct value.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: LC: revpreferences

Post by bn » Wed Nov 24, 2021 3:06 pm

Klaus wrote:
Wed Nov 24, 2021 12:56 pm
Yep, same here!? Must be a bug, if you step through that loop in the debugger PLOP shows the correct value.
But the bug is here
put PLOP and return after fld "fPREFFS" of stack "ElsiePreffs"
"and" is a boolean operator and not a concatenator.

That is why it is returning false, false, etc.

Watch out for arrays in the custom properties.

Try this code: (arrays marked but not resolved)

Code: Select all

on mouseUp
   put the customProperties of stack "revpreferences" into tProps
   put empty into field "fPREFFS"
   repeat for each key aKey in tProps
      put tProps[aKey] into PLOP
      if PLOP is an array then 
         put aKey && "is an Array" & return after tCollect 
         next repeat
      end if
      put aKey & ":" && PLOP & return after tCollect
   end repeat
   put tCollect into fld "fPREFFS" of stack "ElsiePreffs"
end mouseUp

Kind regards
Bernd

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: LC: revpreferences

Post by Klaus » Wed Nov 24, 2021 3:09 pm

AND! Go figure, never thought of THAT!
Obviously my mind translated this to & automatically... 8-)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9389
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: LC: revpreferences

Post by richmond62 » Wed Nov 24, 2021 4:00 pm

Code: Select all

on mouseUp
   put empty into fld "fPREFFS"
   repeat for each element PLOP in customProperties of stack "revpreferences"
      put PLOP & return after fld "fPREFFS" of stack "ElsiePreffs"
   end repeat
end mouseUp
AND: "Holy Cow":
-
SShot 2021-11-24 at 16.58.30.png
-
Ever so slightly opaque. 8)
Attachments
ElsiePreffs.livecode.zip
Here's the stack.
(7.61 KiB) Downloaded 93 times

Post Reply

Return to “Talking LiveCode”