WorkspaceLoaded Event

General APL language issues

WorkspaceLoaded Event

Postby paulmansour on Tue Jul 30, 2019 4:51 pm

The the default session file, the WorkspaceLoaded event is assigned a callback Dyalog.Callbacks.WSLoaded.

What are the consequences of setting the event to 0 or my own callback? In other words, what is WSLoaded doing other than bizarely setting the font name in the drop down list box?

It appears to be used to load SALT, but most if the code appears to already be in session, but I can't tell if that is because I saved the session previously. Is it just refreshing it?

I don't need SALT, but I do want to use user commands. It appears to me that I can use the workspacedloaded event for my own purposes and that user commands will still work.

Any insights appreciated.
paulmansour
 
Posts: 311
Joined: Fri Oct 03, 2008 4:14 pm

Re: WorkspaceLoaded Event

Postby Phil Last on Thu Aug 01, 2019 10:57 am

Below is the help for this event. As Paul notes it's currently pre-assigned to initialise a couple of things in ⎕SE.

So far I haven't managed to determine whether it runs on starting Dyalog without a workspace or if its first call in its present (17.0) state only occurs when I )LOAD a ws.

Either way it's there in the help with instructions how to use it so presumably its current use is non-critical and the event might already be re-ssigned and used in countless user applications.

Also the present function appears - from its possible expectation of a scalar 1 for its argument and its use of elements [3] & [4] (cf. below) - to be called in other circumstances.

So as I very rarely do )LOAD a ws in any Dyalog session I guess it's not going to hurt me if I re-assign it under an ]ACRE.command so that acre - that takes up temporary residence in ⎕SE only when used - can take the necessary action on )LOAD and )CLEAR.

To repeat:
Any insights appreciated.

WorkspaceLoaded Event 525

Applies To: Session

Description

If enabled, this event is reported when a workspace is loaded or on a clear ws. You may not nullify or modify the event with a 0-returning callback, nor may you generate the event using ⎕NQ, or call it as a method.

The event message reported as the result of ⎕DQ, or supplied as the right argument to your callback function, is a 2-element vector as follows :

[1] Object ref or character vector
[2] Event 'WorkspaceLoaded' or 525

This event is fired immediately after a workspace has been loaded and before the execution of ⎕LX.

The callback function you attach should be defined in ⎕SE.
User avatar
Phil Last
 
Posts: 514
Joined: Thu Jun 18, 2009 6:29 pm

Re: WorkspaceLoaded Event

Postby paulmansour on Thu Aug 01, 2019 12:24 pm

I'm pretty sure it executes when you start a session and don't load a ws, as it runs on )Clear and there is an implicit )clear when you start a session.

Unfortunately the documentation also says this under "The Session Object" with respect to WOorkspaceLoaded:

Special Events
The following special events are generated by ⎕SE or its child objects. They are used internally by Dyalog tools such as SALT. They are not intended nor supported for general use.
paulmansour
 
Posts: 311
Joined: Fri Oct 03, 2008 4:14 pm

Re: WorkspaceLoaded Event

Postby Phil Last on Thu Aug 01, 2019 3:27 pm

As to
They are not intended nor supported for general use.

Fix was first demonstrated at Kefalonia (in 2005?) nothing being said regarding its restricted use although at the time it wasn't documented. AfterFix followed not many years later. I don't know when the documentation for these events was added but its wording, as that of WorkspaceLoaded, contains nothing to indicate that they are not available for general use.

Acre has been using Fix since 2007 and AfterFix since 2018 when it (acre) was enhanced to share control by passing it to other software (SALT? Link? ...) if the edited object was out of acre's remit.

Having been working for twelve years under the distinct impression that changes to Fix would not be made without consultation and having found that such a change was made a couple of years ago - discovered by a previously impossible LENGTH ERROR - am I now to be concerned that acre, live since January 2008, may become unsupportable?

Perhaps now is the time for
Any insights appreciated.
User avatar
Phil Last
 
Posts: 514
Joined: Thu Jun 18, 2009 6:29 pm


Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest