Author Topic: Selected TABS C#  (Read 3874 times)

0 Members and 1 Guest are viewing this topic.

A_LOTA_NOTA

  • Guest
Selected TABS C#
« on: April 15, 2011, 10:02:59 AM »
I was tring to use LISP to get a list of selected tabs but I'm not sure it can be done. Can it be done in C#?

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Selected TABS C#
« Reply #1 on: April 15, 2011, 10:30:47 AM »
Yes

From the arxmgd help:


Layout.TabSelected Property

public bool TabSelected;

Description

Accesses the layout tab is included in the selection set for operations that affect multiple tabs. The user can perform multiple selection via the user interface using shift-click.

Conditions
Read / Write
« Last Edit: April 15, 2011, 10:49:29 AM by Jeff_M »

A_LOTA_NOTA

  • Guest
Re: Selected TABS C#
« Reply #2 on: April 18, 2011, 11:57:43 AM »
Thanks for the reply. Being a noob I still haven't been able to get this to work. Can someone please post some example code.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Selected TABS C#
« Reply #3 on: April 18, 2011, 12:58:27 PM »
Can you post what you've tried?

A_LOTA_NOTA

  • Guest
Re: Selected TABS C#
« Reply #4 on: April 18, 2011, 02:01:58 PM »
I think I got it...

Code: [Select]
Document acDoc = Application.DocumentManager.MdiActiveDocument;
            Database acDB = acDoc.Database;
            Editor ed = acDoc.Editor;

            using (Transaction tr = acDB.TransactionManager.StartTransaction())
            {
                DBDictionary layoutDic = tr.GetObject(acDB.LayoutDictionaryId, OpenMode.ForRead) as DBDictionary;

                foreach (DBDictionaryEntry entry in layoutDic)
                {
                    Layout lay = tr.GetObject(entry.Value, OpenMode.ForRead) as Layout;

                    if (lay.TabSelected == true)
                    {
                        ed.WriteMessage("\n" + lay.LayoutName);
                    }// end if
                }// end foreach

                tr.Commit();
            }// end transaction

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Selected TABS C#
« Reply #5 on: April 18, 2011, 02:15:36 PM »
:-)

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Selected TABS C#
« Reply #6 on: April 19, 2011, 08:11:11 AM »
From the arxmgd help:


Layout.TabSelected Property

public bool TabSelected;

Description

Accesses the layout tab is included in the selection set for operations that affect multiple tabs. The user can perform multiple selection via the user interface using shift-click.

Conditions
Read / Write


Jeff,

Pardon my novice question but how did you find this information? I have downloaded the ObjectARX SDK and copied the CHM files into the Help folder of my AutoCAD Program Files. The ObjectARX sections now appear in my VLIDE Help, but doesn't seem to be included when the Help is Searched. Also, is this the best application to use to view these help files?

Lee

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Selected TABS C#
« Reply #7 on: April 19, 2011, 09:24:28 AM »
Hi Lee,
I just have a shortcut that points directly to that chm file. When it is opened direct, the search works fine. I haven't added them to the normal acad help documents since R2008 as I found this easier for me.

I also use the Object Browser inside Visual Studio which has a search of it's own. Sometimes I don't need the 'complete' definition, just seeing what properties are available and what is returned is enough to move on.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Selected TABS C#
« Reply #8 on: April 19, 2011, 09:34:48 AM »
Many thanks Jeff - I'll see what I can do following your advice  :-)

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Selected TABS C#
« Reply #9 on: April 19, 2011, 09:52:53 AM »
Fantastic Jeff - works splendidly  8-)