TheSwamp

Code Red => .NET => Topic started by: GumbyCAD on August 28, 2014, 03:08:38 AM

Title: LayoutManager.Current.LayoutSwitched Event
Post by: GumbyCAD on August 28, 2014, 03:08:38 AM
Hi All,

I am trying to use the said Event to controls my ltscale.

i.e. When I switch from ModelSpace to Paperspace set it and the reverse when switching back.
(LayoutManager.Current.LayoutSwitched)

It seam to be that the Layout Manager is global for all files that get opened.

Does anyone have any experience with this?


Also if I use:

Code - Visual Basic: [Select]
  1. RemoveHandler LayoutManager.Current.LayoutSwitched, AddressOf P3.CalculateNewProposedLtAndDimScales
  2.  

I get a warning.

The 'AddressOf' expression has no effect in this context because the method argument to 'AddressOf' requires a relaxed conversion to the delegate type of the event. Assign the 'AddressOf' expression to a variable, and use the variable to add or remove the method as the handler.

Any ideas?



Title: Re: LayoutManager.Current.LayoutSwitched Event
Post by: Keith Brown on August 28, 2014, 11:47:03 AM
Maybe you can instead monitor the Application.SystemVariableChanged event and look for "Ctab".  This will give you the name of the current layout.  Store the current value and then when the variable changes compare it to the current variable and see if it changed.  If so then update the current variable and then do your processing.  The CTAB variable is per document so it should solve your problems in theory.