Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
$Color, color swatch, note color all different! (Read 1226 times)
james a. foster
Full Member
*
Offline



Posts: 130

$Color, color swatch, note color all different!
Sep 30th, 2016, 1:48pm
 
How can this possibly be? I have a code note (prototype Code) with $Text set to

$Color=“green”;

and

$Rule("/Prototypes/ProtoOutput")=$Text

And I have a prototype, /Prototypes/ProtoOutput, with $Rule set to
$Color=“green”;

Now, the prototype note itself is "red", the $Color attribute is "green", and the color swatch is "red"! (at one point, all were different).

Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: $Color, color swatch, note color all different!
Reply #1 - Sep 30th, 2016, 2:32pm
 
This may be an forum typo but this code won't work as it uses typographic ('curly') quotes:

Quote:
$Color=“green”;


Quotes around strings must be 'straight' in action code:

$Color="green";

If you see a brick-red colour, it is likely the 'undefined ' value which (for reasons I don't know) renders as something like a red-ish '#d5847f'.

Quote:
the prototype note itself is "red", the $Color attribute is "green"


Do you mean "green" or “green”? The former will show red (as above) and the latter green.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
james a. foster
Full Member
*
Offline



Posts: 130

Re: $Color, color swatch, note color all different!
Reply #2 - Sep 30th, 2016, 3:28pm
 
Ah! They are the "two upside down, two rightside up" double quotes. They were from the $Text field of the code note. I typed them in as the double quotes on my macbook keyboad so I don't know how they got converted. any ideas?

When I go back to my "not green" note, and set $Color to "green" (with the right quotes), it stays the redish color--which it would make sense to be undefined.

When I enter green, without quotes, the note changes color (to green!)

When I enter $Color=green; (without ANY quotes) in the code note, it works! So, the quotes are definitely the problem.

Thanks!
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: $Color, color swatch, note color all different!
Reply #3 - Sep 30th, 2016, 5:06pm
 
The reason the code works without quotes is for legacy purposes for those who can't be bothered to update their code. I strongly advise using this legacy [sic] method as at some point legacy support tends to drop away. It's better to fix the problem and then not have to worry about the code mysteriously stopping working one day.

As to the changed quote type, in v6, due to the underlying Apple frameworks the rich-type text part of the note ($Text) 'auto-corrects' quotes from straight to typographic. Generally this is considered helpful - most user seem to want this - but it's no help where you want to type code.

In v6, you either need to turn off auto-correction of quotes, or apply the build-in 'Code' prototype to your code notes. I'd suggest you make new code notes, using that prototype, as you're earlier experiment probably has other glitches in it. Starting over with a clean, correctly configured note will help.  If copying $Text from existing notes, use paste-and-match-style instead of paste and ensure you've not imported any unintended curly quotes.  In a Code-prototyped note, correcting these back to straight will not then result in auto-correct back to curly.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: $Color, color swatch, note color all different!
Reply #4 - Oct 1st, 2016, 11:54am
 
Turn off “Smart Quotes” for a note by toggling Format ▸ Text ▸ SmartQuotes.

There’s an attribute $SmartQuotes that controls smart quotes on a note-by-note basis. Change the default value to false, or change the value of $SmartQuotes in the prototype to false, to disable Smart Quotes more widely.
Back to top
 
 
WWW   IP Logged
james a. foster
Full Member
*
Offline



Posts: 130

Re: $Color, color swatch, note color all different!
Reply #5 - Oct 3rd, 2016, 12:35pm
 
since this is a Code note, the prototype is $Code, which is build-in prototype. I recommend making this a default for that prototype.

In the meantime... I will set it myself.

Thanks!!
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: $Color, color swatch, note color all different!
Reply #6 - Oct 3rd, 2016, 1:26pm
 
The concept of a 'code note' is an informal one, which started as a means -  in older versions of TB - to work on longer sections of action code. The built-in prototype 'Code' is baked into the app but like all built-in codes is added to a document, as required, by the user. Once added it is likewise applied to notes, by the user as the app has no way to know what a code note is (and only a few users need such structure - I'm one such).

A convention I've come to use is to add a root-level folder 'Codes', or a similar explanatory name, which houses my code notes. Having added the 'Code' prototype to the document I set the 'Codes' container's $OnAdd to:

$Prototype = "Code";

If, like me, you tend to export document data, I generally also set - via the Export Inspector - the container both to not export and not export children. This is because the code ($Text) in the notes is only used internally.
Back to top
 
« Last Edit: Oct 3rd, 2016, 1:27pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
james a. foster
Full Member
*
Offline



Posts: 130

Re: $Color, color swatch, note color all different!
Reply #7 - Oct 3rd, 2016, 1:30pm
 
Nice. Thanks, Mark
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print