.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Switch between files

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
waseefur.rahman
616 Views, 3 Replies

Switch between files

Hi,
I have developed a windows Form, when user initiate the form it will read some data of file and list it.

 

my question, if there is multipule file open and user switch between them, then i need to refresh 'my form' each time when user switches between files, so that the form to show the proper Details of file..

 

i am having a refresh sub in my code, that need to called if user switches between files.

Can anyone guide me please..

3 REPLIES 3
Message 2 of 4

I assume you show a form as modeless (floating) dialog, which is a Win Form (you can also use WPF window, or PaletteSet, for the matter of discussion). Obviously, user can only switch current drawing in AutoCAD while your form is visible, if the form is a modeless one.

 

Yes, if the information showing on the form is related to the current drawing in AutoCAD, when the current drawing changes, the form should update its data being shown (or, clear the form, or close the form...). In general, you achieve this by handling DocumentCollection.DocumentBecameCurrent, or DocumentCollection.DocumentActivated events. In most cases, you'd use the former.

 

Here are 2 articles I wrote a while ago that would give you some help/hints:

 

http://drive-cad-with-code.blogspot.ca/2014/02/showing-and-closing-modeless-formdialog.html

http://drive-cad-with-code.blogspot.ca/2016/08/showing-current-selection-in-modeless.html

 

HTH

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 4

You can use the DocumentCollection's DocumentActivated event to detect a change in the active document (do not use the DocumentBecameCurrent event, as that does not signal that a document has become the active document).

 

You can also take a more sophisticated approach that involves the use of data binding, which allows you to maintain separation of your UI and your application/business logic. See >>this post<< for an example.

 

 


@waseefur.rahman wrote:

Hi,
I have developed a windows Form, when user initiate the form it will read some data of file and list it.

 

my question, if there is multipule file open and user switch between them, then i need to refresh 'my form' each time when user switches between files, so that the form to show the proper Details of file..

 

i am having a refresh sub in my code, that need to called if user switches between files.

Can anyone guide me please..


 

Message 4 of 4


@ActivistInvestor wrote:

You can use the DocumentCollection's DocumentActivated event to detect a change in the active document (do not use the DocumentBecameCurrent event, as that does not signal that a document has become the active document).

 

You can also take a more sophisticated approach that involves the use of data binding, which allows you to maintain separation of your UI and your application/business logic. See >>this post<< for an example.

   


Sorry, that was a broken link, the post is >here<

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report