DASH docset updated to LC 10 dp4 what yoy

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: DASH docset updated to LC 10 dp4 what yoy

Post by jameshale » Fri Sep 09, 2022 9:30 am

:) no worries stam. Glad to be of help.

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: DASH docset updated to LC 10 dp4 what yoy

Post by stam » Fri Nov 25, 2022 10:37 am

jameshale wrote:
Tue Aug 30, 2022 12:50 am
BTW I make these using the make docset stack I have on the sample stacks site. Weirdly when I do the resulting docset has no syntax coloring. I then spend a while trying to trace the code to see what’s going on. After a few checks here and there (has the underlying call to the IDE function charged?)
I run it again and the color is back!!
If anyone has used the make docset stack and feels like investigating please let me know what you find.
Hi James,

I wonder if you're encountering the same issue as I describe here: https://forums.livecode.com/viewtopic.php?f=9&t=37488
and if so, have you found a workaround yet?

S.

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: DASH docset updated to LC 10 dp4 what yoy

Post by jameshale » Fri Nov 25, 2022 11:32 pm

Hi stam,
If only :|
I have yet to discern any pattern to the colorise function working or not.
As Mark Knopfler says…”Its a mystery to me….”

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

Re: DASH docset updated to LC 10 dp4 what yoy

Post by bn » Sat Nov 26, 2022 11:07 am

jameshale wrote:
Fri Nov 25, 2022 11:32 pm
Hi stam,
If only :|
I have yet to discern any pattern to the colorise function working or not.
As Mark Knopfler says…”Its a mystery to me….”
Hi James,

Mark Waddingham pointed out that _internal colorize needs to be initialized once per session before it works
https://forums.livecode.com/viewtopic.p ... 74#p219774
some IDE actions initialize the color schemes (as Stam found out e.g. opening the Message Box)

In tinyDictionary I use

Code: Select all

dispatch "revSEColorizeField" to stack "revSEUtilities" with the long id of field "fRes" of this stack, tStartChar, tEndChar
Handler "revSEColorizeField" initializes the color schemes and has worked for me without a problem.

Mark Talluto has posted the initialization code earlier in this post and you could do it in your stack but it is easier to just let revSEColorizeField do it.

Kind regards
Bernd

AndyP
Posts: 615
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Re: DASH docset updated to LC 10 dp4 what yoy

Post by AndyP » Sat Nov 26, 2022 1:53 pm

Confirming the solution from Bernd works the best.

Just remember to pass in the number of chars in your field!

Code: Select all

put the num of chars of fld "myField" of this stack into tEndChar 
dispatch "revSEColorizeField" to stack "revseutilities" with the long id of field "myField" of this stack, 1, tEndChar
Also using 9.6.9 (rc2) on Windows revSEUtilities is revseutilities all lowercase.

AS a use case I am building a little thing to access my public GitHub Gists. I have snippets of code all over the place at the moment so trying to consolidate into one place and of course I want all the code snippets colored without first having to open the script editor or the message box first!
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: DASH docset updated to LC 10 dp4 what yoy

Post by stam » Sat Nov 26, 2022 5:35 pm

jameshale wrote:
Fri Nov 25, 2022 11:32 pm
Hi stam,
If only :|
I have yet to discern any pattern to the colorise function working or not.
As Mark Knopfler says…”Its a mystery to me….”
Actually it is exactly the same issue ;)
_internal colorize needs to be initialised as Bernd mentions (this was happening when I opened the msgBox and SE, so most of the time it seemed to work, but didn't work when immediately loaded the stack without opening these).

The code mentioned by Bernd and AndyP works perfectly (I had rather lazily put '-1' as the endChar and couldn't get it to work lol - needs absolute number), hence Andy's code works just fine:
AndyP wrote:
Sat Nov 26, 2022 1:53 pm

Code: Select all

put the num of chars of fld "myField" of this stack into tEndChar 
dispatch "revSEColorizeField" to stack "revseutilities" with the long id of field "myField" of this stack, 1, tEndChar

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: DASH docset updated to LC 10 dp4 what yoy

Post by mwieder » Sun Nov 27, 2022 4:50 am

Paraphrased from the glx2ScriptEditor code:

Code: Select all

   local tEnd
   
   lock screen
   put the number of lines of field kCodeField of group "Editor" into tEnd
   
   configureColorClasses
   configureColorKeywords pColorizationKeywordsArray
   _internal script colorize line 1 to tEnd of field kCodeField of group "Editor"
   unlock screen

private command configureColorClasses
   local tColorizationClasses
   
   put the uColorClasses of this stack into tColorizationClasses
   _internal script configure classes tColorizationClasses
end configureColorClasses

private command configureColorKeywords pColorizationKeywordsArray
   local tColorizationKeywordsArray
   
   # note that this can be empty
   put the uColorizationKeywords of this stack into tColorizationKeywordsArray
   _internal script configure keywords tColorizationKeywordsArray
end configureColorKeywords
where the uColorClasses is an array

Code: Select all

operator color : 251,148,22
chunk attributes : none
structure attributes : none
chunk color : 46,251,6
operator attributes : none
literal color : green
multicomment color : pink
command attributes : none
property color : white
property atttributes : none
error attributes : none
function color : 214,131,18
identifier color : 214,131,18
number attributes : none
structure color : 55,232,222
command color : 249,14,14
singlecomment attributes : italic
continuation color : white
number color : 8,234,69
keyword color : 247,247,0
continuation attributes : none
singlecomment color : pink
function attributes : none
identifier attributes : none
keyword attributes : none
error color : 255,0,0
literal attributes : none
multicomment attributes : italic
Look in the script of stack revSEUtilities to see how the IDE's script editor uses the _internal colorization routines.

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: DASH docset updated to LC 10 dp4 what yoy

Post by jameshale » Sun Nov 27, 2022 7:02 am

Very happy this discussion took place (thanks stam)
Interestingly the dispatch was actually in my colorise code that I lifted from the SE utils.
I just deleted the line from the posting.
In DocSet Maker, I have commented out the lines.
I didn't know what they did (not realising there was the need for initialisation.)
But looking at the discussion I wondered if there was an overhead in using it compered to the function I was already using.
So I made a test stack which used the colorise function in Docset maker, the dispatch form, and then calling the dispatch once (just to initialise) and then the colorise function.
Running them once show no perceptible difference. But DocSet Maker calls on this over 8000 times (there are a lot of script examples in the docs!)
So I time all three a 1000 times.
That is placing some text in a field and then applying syntax coloring.
On my M1 Mac running LC 10 DP4...

colorise function (initiated). 217ms
dispatch. 8920ms
call dispatch initially and then the colorise function repeatedly: 234ms

So for me, I will initialise the syntax colouring with an initial call via Dispatch in my open card script leaving the colorising function as is.

Thanks to stam for getting this discussion going and Mark, Mark, Bernd and Andy for all the help.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”