Page 1 of 1

How to run a routine when a sheet is opened or sav

Posted: Wed Aug 07, 2002 1:32 pm
by drutiss

How can a bacis 2 function be called when any sheet
is opened or saved?

I suspect there should be some event functions that are triggered when a sheet is opened. A more general question might be what system events are available,
and how do you add routines for those events?

I know I've run across this in the help files, but I can't find them now.



How to run a routine when a sheet is opened or sav

Posted: Thu Aug 08, 2002 3:38 pm
by geoz
I could also use this feature. I have found 3 useful ones, however.
The file shown below is called
and is to be located somewhere in \UI\MED2D.
Compile it as you would any bacis2 ".bad" file and run
in Bacis2. Note that it is a little different than a typical procedure file.

-- this one runs at startup

-- this one runs only when quitting Medusa

-- this one runs when selecting elements


Coen_startup sets certain defaults for different users, some keyboard accelerators, etc.

Coen_quit writes out some dictionaries of the directory names used in the session, logs the time/date, etc.

Coen_select is the cool one. It displays data about the selected element(s) in the text window like Type, Layer, ID#,Text height & actual text so I don't have to zoom in just to read it. I also have it display user text attributes that we use for part numbers, item description, size, material, etc. There's no guessing about what is selected.


How to run a routine when a sheet is opened or sav

Posted: Fri Aug 09, 2002 4:47 pm
by drutiss
Thanks George for the post,

I tried !open, !close and a couple of other possible
symbol names without success.
I noticed the !select, runs every time something is
selected, and when a new sheet is opened.
It would be possible to write a !select function that
tests for a new sheet. This would be a possible !open
workaround, but would not work for !close.

Another possiblity would be to trap the file open functions that are built into Medusa (file open, sym/sheet preview dialogs, and others)
I redefined the !ok definition of the file open dialog,
which would capture which file was intended to be opened, then call the original function that would have been called. (mui_sheet_open_ok(object,attribute,arg)) The problem is, the user can cancel the file open, if the current sheet has not been opened.

Any other ideas?

Is there a way to list the possible symbol names for the
m2d_callback_set function that may not be documented?
How do you list what functions are to be called for a given symbol? Example: List the functions to run at
the !select event.