LC8DP4 LCB Guide? Possible to have a default Script

LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.

Moderators: LCMark, LCfraser

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: LC8DP4 LCB Guide? Possible to have a default Script

Post by PaulDaMacMan » Fri May 13, 2016 2:08 am

It was indeed a corrupt preference file, something to watch out for, thanks.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: LC8DP4 LCB Guide? Possible to have a default Script

Post by PaulDaMacMan » Thu Jul 20, 2017 12:20 am

This feature now seems to be broken now in LC 9 DP 8. The default script appears in the extension builder window but it is not attached to the compiled widget as the default script when you go to edit the widgets script. I saw some talk on the list of possibly making a preference to turn off default scripts, but that doesn't appear to be the case yet. I'm wondering if the feature removal was on purposeful or should it be a bug report?
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

livecodeali
Livecode Staff Member
Livecode Staff Member
Posts: 192
Joined: Thu Apr 18, 2013 2:48 pm

Re: LC8DP4 LCB Guide? Possible to have a default Script

Post by livecodeali » Thu Jul 20, 2017 10:00 am

It hasn't been removed, it's just been tweaked slightly! Instead of filling the script editor with the content of the default script automatically, and handlers in the default script will be used when a default handler is added from the handler list on the left. This means you can have any number of default handlers in there and they are only added to the script when requested.

All documented messages for a given widget are listed in the default handlers list, and when clicked it either adds the corresponding handler from the default script (if there is one) or constructs a default handler using the documented message name and parameters.

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: LC8DP4 LCB Guide? Possible to have a default Script

Post by PaulDaMacMan » Fri Jul 21, 2017 7:47 pm

livecodeali wrote:It hasn't been removed, it's just been tweaked slightly! Instead of filling the script editor with the content of the default script automatically, and handlers in the default script will be used when a default handler is added from the handler list on the left. This means you can have any number of default handlers in there and they are only added to the script when requested.

All documented messages for a given widget are listed in the default handlers list, and when clicked it either adds the corresponding handler from the default script (if there is one) or constructs a default handler using the documented message name and parameters.
Ah, I see. I hadn't documented the default script within the LCB because, like the Header Bar widget, it uses mouseUp which is a standard message. It seems odd to have to document mouseUp when it's been part of the standard dictionary for decades.

Then there's another problem I have with this change. One of my defaultScript.livecodescript relied on a local variable declaration (which I was able to work around using a property) as well as a interaction between two handlers; mouseUp and mouseLeave (though it looks like the mouseLeave part never worked anyway because my widget wasn't firing a mouseLeave message).
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: LC8DP4 LCB Guide? Possible to have a default Script

Post by PaulDaMacMan » Fri Jul 21, 2017 8:05 pm

So this will allow the any default scripts to be inline within the LCB with no need for the external .livecodescript file?
Also will this allow multiple alternative scripts (for example different "mouseUp" behaviors to pick from) as well?
In any case this is a pretty sweet enhancement, a real time saver.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

Post Reply

Return to “LiveCode Builder”