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

Open the option-dialog out from a C#-Form

4 REPLIES 4
Reply
Message 1 of 5
Juergen.Becker
453 Views, 4 Replies

Open the option-dialog out from a C#-Form

Hi,
how can I open the option-dialog within my own C#-Form?

I tried this:
Document doc = AcAp.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
this.Hide();
doc.SendStringToExecute("_+options 10 ",true, false, true);
this.Show();

Its hide my form but its shows the form immediately after its send the option-command.
When I close my form the option-dialog appears.

Regards Juergen
4 REPLIES 4
Message 2 of 5

The reason is that the SendString... methods are asynchronous, meaning they will get added to the command queue, but won't execute until autocad is ready for a command, which is after your code completes.

I am using 2010, and it appears this is a newly exposed sub in 2010 (not even in the acmgdinternal.dll under 2009), but under Autodesk.AutoCAD.Internal.Utils There is a method called InvokeOptionsDialog.

Being under the Internal namespace, of course there is no help available in the Docs, but the object browser shows the signature to be this:

InvokeOptionsDialog(ByVal strPos As String, ByVal bInvokedAsChildDlg As Boolean, ByVal defaultLabelIdInFileTab As UInteger, ByVal bExpanded As Boolean)

I tried it out by sticking it in a close event for one of my forms, and I can't figure out what the String argument is for, or what the purpose of the UInteger argument is, because it doesn't seem to matter what I put in them. The dialog still shows the same every time.

The first boolean seems straight forward enough, but whether I set it to true or false, it still behaves the same way (to the users perspective, anyway) The same with the last boolean.

I thought the Uinteger argument might be to set which tab is selected (which I see your command string does), but it had no effect when I tried to set it to anything other than the Files tab.

So, if you just skip the .Hide and .Show of your form, and call that sub, the options dialog will show (on top of your form, in its default position), and it will interupt execution of your code until it is closed, then return control to your code, however, I don't know if there is a way to set the active tab.
Dave O.                                                                  Sig-Logos32.png
Message 3 of 5

Hi,

many thanks for your help. It works.
I will figure it out what are the parameter are for. You will be informed.

Regards Juergen
Message 4 of 5

HI,
a good news.
i'd figured out what are the first stiring argument is for.
It is the name of the tab which must be actived.

The following code shows the system-tab.
Autodesk.AutoCAD.Internal.Utils.InvokeOptionsDialog("System", false, 0, false);

Juergen
Message 5 of 5

That's good. And wierd. I'm using VB, but I swear I tried that and it still opened on the Files tab every time.
Dave O.                                                                  Sig-Logos32.png

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost