PDA

View Full Version : Help with reactors firing



Glenn Pope
2004-07-06, 03:24 PM
Hey Guys,

I'm upgrading a routine that I wrote that allow you to assign different Layer, Ltscale, Dimscale, and Text Style to each layout. The routine uses a ini file to store default settings and xrecords to store the info for each layout in the drawing. One of the upgrades is the ability to turn off some of the options so that they don't change when switching layouts.

The Problem:
When turning off a setting and switching to another layout, the info (for that option) that is stored in the xrecords is overwritten with the settings of the layout switched to. I want it to retain that setting so if I turn the option back on and go back to that layout, it sets it back to what it was before turning off the option. :confused: yet?

Looks like whats happening:
There is a reactor that looks for these variables to change. The reactor fires a routine that will save the setting to the xrecord for the current layout. There is another reactor that fires when changing layouts. It fires a routine that will retrieve the info from the xrecord for the layout being switch to. In this routine, I disable the reactor that watches for changes in the variables. It appears that the reactor is not disabled and fires off the routine and then overwrites the info in the xrecords.

I hope this makes since. I will try to clarify if needed. I would appreciate any help.

Also if you see something that could be coded better, let me know.

peter
2004-07-07, 12:43 PM
Xdata seems to me to be a more direct way of storing data on a layout than an xrecord in a dictionary.

Also I found the sequence of the reactors firing like you discovered after the layout changes.

You need to have the "current" layout information recorded before you attempt to switch layouts.

What I would do is use a system variable reactor to monitor the different items you wish the layout to remember. Always have the data updated. The current layout information would be constantly updated in an xrecord. The reactor would only update the current layout after you switch.

I hope that makes sense.

I will play around with some of my code to see if I can cook up an example.

Peter Jamtgaard

Glenn Pope
2004-07-07, 01:47 PM
What I would do is use a system variable reactor to monitor the different items you wish the layout to remember. Always have the data updated. The current layout information would be constantly updated in an xrecord. The reactor would only update the current layout after you switch.
If I'm understanding you correctly, that what the routine dose. There are two reactors. One watches for LTscale, DIMscale, Clayer and Textstyle for changes and records those the the xrecord for the current layout. The second one watches for a change in layouts. After switching to the new layout, it retrieves the data stored for that layout. If its has no data then defaults are used.


Also I found the sequence of the reactors firing like you discovered after the layout changes.
So why is this reactor firing even though I'm disabling it? If I can keep the reactor that watches the variables from firing after switching layouts, every thing would be working right.

Thanks for the response. I would appreciate any examples you can give me.

Glenn Pope
2004-07-09, 08:25 PM
Okey, I think I have it working now. I still couldn't keep the reactor from firing after switching layouts :-(. What I ended up doing was changed the routine that saved the data for the layouts. Had to keep it from overwriting the xrecord under certain instants.

Still like to know why the I couldn't disable the reactor. This would have made things a lot easier.

Here is the new version. I would appreciate it if some of you guys could test and give me feedback :wink:

Thanks.