Hello,
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.
Thanks,
Steve
How to run a routine when a sheet is opened or sav
How to run a routine when a sheet is opened or sav
I could also use this feature. I have found 3 useful ones, however.
The file shown below is called
library-init.bar
and is to be located somewhere in \UI\MED2D.
Compile it as you would any bacis2 ".bad" file and run
library_create_index()
in Bacis2. Note that it is a little different than a typical procedure file.
---------------------------------------------------------------------
proc
-- this one runs at startup
m2d_callback_set(!startup,coen_startup)
-- this one runs only when quitting Medusa
m2d_callback_set(!quit,coen_quit)
-- this one runs when selecting elements
m2d_callback_set(!select,coen_select)
endproc
---------------------------------------------------------------------
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.
George
The file shown below is called
library-init.bar
and is to be located somewhere in \UI\MED2D.
Compile it as you would any bacis2 ".bad" file and run
library_create_index()
in Bacis2. Note that it is a little different than a typical procedure file.
---------------------------------------------------------------------
proc
-- this one runs at startup
m2d_callback_set(!startup,coen_startup)
-- this one runs only when quitting Medusa
m2d_callback_set(!quit,coen_quit)
-- this one runs when selecting elements
m2d_callback_set(!select,coen_select)
endproc
---------------------------------------------------------------------
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.
George
How to run a routine when a sheet is opened or sav
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.
Thanks,
Steve
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.
Thanks,
Steve