Page 2 of 2

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

Posted: Fri May 13, 2016 2:08 am
by PaulDaMacMan
It was indeed a corrupt preference file, something to watch out for, thanks.

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

Posted: Thu Jul 20, 2017 12:20 am
by PaulDaMacMan
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?

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

Posted: Thu Jul 20, 2017 10:00 am
by livecodeali
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.

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

Posted: Fri Jul 21, 2017 7:47 pm
by PaulDaMacMan
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).

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

Posted: Fri Jul 21, 2017 8:05 pm
by PaulDaMacMan
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.