bobsneidar at iotecdigital.com
Wed Jan 20 15:44:58 EST 2016
On Jan 20, 2016, at 10:14 , Mark Waddingham <mark at livecode.com<mailto:mark at livecode.com>> wrote:
For example, many document-centric apps will have a 'Save' function. On Mac this is typically 'just' in the File menu. However, on Windows it is usual to have it both in the File menu *and* as a button on a document's toolbar. If the code for the 'save' action is not factored out you end up with duplicated code - so it is quite natural to move this code 'down' into core logic.
Oh right yes I do that too. As soon as I need to access the same code from multiple locations, I will often do that, but sometimes I will just send a mouseUp (or call a handler) from the object itself. A lot has to do with whether or not the object script has relative references to itself of the card/stack it belongs to. Sometimes moving complex code requires a lot of refactoring, so rather than do that, I just send or dispatch to the handler in the object, rather than go through the nonsense of re-debugging everything all over again.
More information about the Use-livecode