Home > arcgis 10.0 > Cannot Set TOC View/Tab to Display with VBA?

Cannot Set TOC View/Tab to Display with VBA?

February 27Hits:1
Advertisement

I have some code from 9.3 that would check the CurrentContentsView.ContextItem to ensure that the TOC was in Display (or Drawing Order) view. If not it would set it to Display via:

If Not pDoc.CurrentContentsView.ContextItem = 1 Then     Set pDoc.CurrentContentsView.ContextItem = 1     pDoc.ContentsView(1).Refresh Nothing End If pDoc.ContentsView(1).Refresh Nothing 

Now that the TOC is a DockableWindow (which I can access) and there are several IContentsViews, this no longer works. It's surprising that this is impossible to find in the forums and the VBA SDK as as brief and cryptic as could be.

How do I access the ContextItem (which seems stuck at NULL) to set it? Also, is the fact that "currentContentsView" automatically reverts to a lower-case "c" when the object apparently shouldhave an upper-case "C" significant?

Any help would be MUCH appreciated. For some reason, my code runs 3x faster in Display View and I want to automatically set it if the user forgets (or doesn't know).

Oh...and yes, I AM aware of VBA's demise and the existence of Python. Noted.

Thanks in advance.

Answers

This add-in code example (not in VBA format) will check contents view and change to display view (List By Drawling Order).

   Protected Overrides Sub OnClick()

        'ChangeArcMapTOC_ContentsView("Source")
        ChangeArcMapTOC_ContentsView("Display")

         My.ArcMap.Application.CurrentTool = Nothing
    End Sub

    Private Sub ChangeArcMapTOC_ContentsView(ByVal newContentsViewName As String)

        Dim app As IApplication = CType(Hook, IApplication)
        Dim mxdoc As IMxDocument = CType(My.ArcMap.Application.Document, IMxDocument)

        If mxdoc.CurrentContentsView.Name = newContentsViewName Then

            Exit Sub

        End If

        ' loop thru all ContentsViews to see if newContentsViewName exists.

        Dim i As Integer

        Dim pContentView As IContentsView

        Dim bFound As Boolean

        For i = 0 To mxdoc.ContentsViewCount - 1

            pContentView = mxdoc.ContentsView(i)

            If pContentView.Name = newContentsViewName Then

                bFound = True

                Exit For

            End If

        Next

        If bFound = False Then

            MessageBox.Show("Contents view '" & newContentsViewName & "' does not exist", "Could not change contents view")

            Exit Sub

        Else

            mxdoc.CurrentContentsView = pContentView

        End If

        pContentView.Refresh(Nothing)

        Exit Sub

    End Sub

Related Articles

  • Cannot Set TOC View/Tab to Display with VBA?February 27

    I have some code from 9.3 that would check the CurrentContentsView.ContextItem to ensure that the TOC was in Display (or Drawing Order) view. If not it would set it to Display via: If Not pDoc.CurrentContentsView.ContextItem = 1 Then Set pDoc.Current

  • How to remove 'By term' and 'View' tab being displayed at top of pages?October 26

    On a Drupal 6 site, I have these annoying 'View' and 'By term' tabs being displayed on all node types. I am wondering how to remove/disable both of them? --------------Solutions------------- 'By term' seems to be generated by one of the views in Orga

  • Edit/View Tab in Region other than ContentSeptember 19

    I'm trying to set up two contexts for use with a sub-theme of Omega. 3 Column Context: Uses the regions Sidebar First, Content and Sidebar Second. Content is 6 columns wide. The Sidebar regions are each 3 columns wide. This works fine. 2 Column Conte

  • How to make safari tab bar display all tabsJanuary 7

    How can I make the Safari tab bar display all of the tabs? Right now it displays only n tabs and the remaining are only accessible through a >> button. --------------Solutions------------- Actually there is a plugin (not to be confused with an exten

  • Hidding view tab on node/%/viewOctober 1

    I've successfully managed to hide "View" tab on node page with this code: /* * Implements hook_menu_local_tasks_alter(). */ function mymodule_menu_local_tasks_alter(&$data){ foreach ($data['tabs'][0]['output'] as $key => $value) { if ($va

  • block view is not displayingSeptember 30

    This problem starts with the subtheme. I am using drupal 7 with a subtheme based on omega 3.1. For some reason node title and admin tabs are displaying only on the home page and two basic pages, while they do not appear on the rest of the website(art

  • How to create views tabs in D8?September 6

    I can't get views tabs to work in D8, following the exact UI procedure that does work in D7. To be more precise, in D8 at /mypage I see no tabs at all, and at /mypage/tab2 and /mypage/tab3 I do see tabs "tab2" and tab3" but no "MyDefau

  • SharePoint 2007 : document library's view is not displayed correctlySeptember 13

    I'm working on my SharePoint site today and I noticed that one of my document library's view is not displayed correctly in the main content place holder of the page. I just have the blue title of the document library. I don't even have the blue toolb

  • How to hide the View tab in user page?May 11

    In the user page (www.example.com/user), there are [View | Edit] tabs. Is it possible to hide the View tab and leave Edit tab there? --------------Solutions------------- Use Tab Tamer, which allows you to move, hide and disable tabs on various pages.

  • How to rename the views tabs in user accountsNovember 7

    How do i rename the "view" tab in the user accounts? I want to rename it to Profile. Am using drupal 7 and the zen sub-theme. Any suggestions are welcome. --------------Solutions------------- The Tab Tamer module gives you a user interface to do

  • Views: How to display a grouped taxonomy list with node count?

    Views: How to display a grouped taxonomy list with node count?March 5

    I'm building a classifieds section of a website. Is it possible to create a grouped taxonomy list (by parents) with a node count at the end? Essentially this is what I want to appear: Currently, this is my BuySell content type node. I have two taxono

  • PNG viewer that can display text chunks metadataJuly 4

    Is there a PNG viewer that can display text chunk metadata? Ideally, I'd like a way to view arbitrary chunks. --------------Solutions------------- Found a partial solution, the pngcheck tool can print text chunks although it wont display the image. p

  • This view cannot be displayed because it exceeds the list view threshold (5000 items) enforced by the administratorAugust 13

    I am facing following warning message when i add list as webpart. "This view cannot be displayed because it exceeds the list view threshold (5000 items) enforced by the administrator." Also when i directly go to the list and change the view it g

  • Using Profile2 and Views - How to display the separate profile data on a single rowJanuary 26

    I have several different pieces of info in separate profile2 forms. When I run the view to display the data I want, it looks like this: Profile UID PID IID Name Email Membership Main Profile 124 15 1237 Bernardo Lee [email protected] Membershi

  • Views Slideshow only displaying first slide in IE

    Views Slideshow only displaying first slide in IEFebruary 2

    I have Views Slideshow working fine on Chrome 24.0.1312.56 m, and Firefox 18.0.1. But for some reason Views Slideshow only display the first slide (of five) in IE9. I'm using Views Slideshow 7.x-3.0, Views Slideshow Cycle 7.x-3.0 and my jQuery.cycle

  • Drupal 7 View tab on user profile empty as default?February 4

    In a default Drupal 7 installation where no custom fields were been added to user profiles is it the normal behavior that the user profile tab View is empty? I would expect to see for example the registration email. Thank you all for help -----------

  • Prevent clicking on view tab when editing a nodeMarch 13

    I was wondering anyone knew of a module that would warn people when clicking on the view tab if they have made changes to a node, but didn't save it. For example, I've seen a few times where people would click on the edit tab to edit the node, then w

  • Remove or hide view tab on nodeSeptember 30

    I know how to rename "edit" or "track" tab on user page and node page. Here's the code, it might help someone. It's for Drupal 7. <?php function MYMODULE_menu_alter(&$items) { // drupal_set_message('Menu Items: <pre>'.prin

  • How to show different entity in Views with different displays?

    How to show different entity in Views with different displays?March 21

    I create a views with 2 displays. One display show content type. One display show taxonomy list that related above content type. When I try to create a display with content type, then I can not create a display with taxonomy. Content type and taxonom

  • SharePoint-2010 calendar List View Webpart to display from Monday to SundayApril 14

    How to make SharePoint-2010 calendar List View Webpart to display from Monday to Sunday but not Sunday to Saturday. --------------Solutions------------- Site settings, regional settings > Define your work week. Select the start day of the week as Mon

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.498 s.