Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

My "Select By Location" dialog window keeps falling behind other windows(such as my table window) that I have on my second monitor.

So far, the only way to fix it is to move the table window to the first monitor which allows me to get the the "Select By Location" dialog window, and then window juggle.

The "Select By Location" dialog window doesn't create an item in the taskbar which would be useful (I could right-click and move). Or even just having the window raised to the top when I select the "Select By Location" menu-item again would help.

Are there any clever workarounds or maybe a shortcut key to deal with this issue?

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

try ctrl+tab... in this way, you can jump from one internal open window to another...

share|improve this answer
    
I use this method. –  Mapperz Oct 19 '10 at 2:34
    
Perfect! I didn't think to try ctrl-tab. That would have saved me some work yesterday! I need to learn to be more patient! –  Jay Cummins Oct 19 '10 at 12:06
    
Just an FYI, if the table window has focus, you jump from table-to-table instead of child window-child window. –  Jay Cummins Oct 19 '10 at 12:18
add comment

Update:
I've accepted @Marinheiro answer, since that's what I was after. But to use Ctrl-tab, the window has to actually open, but behind another window.

I'm leaving my addin solution here, because it has the advantage of showing the dialog regardless of whether it was previously opened or not. In real life, I will probably use a combination of both.

Original Answer:
I've developed a work-around, but I am still interested in any out-of-the-box options.

I had some code posted earlier that only worked when a single instance of ArcMap was open, but I've it working with multiple ArcMap instances.

Add-in is here: ShowSelectByLocation.esriAddIn

Here's the updated code snippet:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Framework;

/// <summary>
/// ArcMap AddIn Button class for a button that Shows the Select By Location 
/// followed by bringing the Select window to the top of the z-order
/// </summary>
public class ShowSelectByLocationButton : ESRI.ArcGIS.Desktop.AddIns.Button
{
    /// <summary>
    /// Initializes a new instance of the <see cref="ShowSelectByLocationButton"/> class.
    /// </summary>
    public ShowSelectByLocationButton()
    {
    }

    /// <summary>
    /// Called when [click].
    /// </summary>
    protected override void OnClick()
    {
        ArcMap.Application.CurrentTool = null;

        try
        {
            UID uid = new UIDClass();
            uid.Value = "{82B9951B-DD63-11D1-AA7F-00C04FA37860}";  // Select By Location Command

            ICommandItem commandItem = ArcMap.Application.Document.CommandBars.Find(uid, false, false);

            // open the Select By Location dialog (in case it isn't already open)
            if (commandItem != null)
            {
                commandItem.Execute();
            }

            IntPtr selectwindow = this.FindSelectByLocationWindow();

            if (!selectwindow.Equals(IntPtr.Zero))
            {
                WindowFunctions.BringWindowToTop(selectwindow);
            }
        }
        catch (Exception e)
        {
            Trace.WriteLine(e.StackTrace);
            throw;
        }
    }

    /// <summary>
    /// Called when [update].
    /// </summary>
    protected override void OnUpdate()
    {
        Enabled = ArcMap.Application != null;
    }

    /// <summary>
    /// Finds the select by location window.
    /// </summary>
    /// <returns>IntPtr of the Select By Location that matches this ArcMap's process ID</returns>
    private IntPtr FindSelectByLocationWindow()
    {
        IntPtr selectwindow = IntPtr.Zero;

        IntPtr ptr = new IntPtr(ArcMap.Application.hWnd);
        int arcmapPID = WindowFunctions.GetProcessThreadFromWindow(ArcMap.Application.hWnd);

        List<IntPtr> windows = WindowFunctions.GetWindows();

        foreach (IntPtr i in windows)
        {
            int length = WindowFunctions.GetWindowTextLength(i);

            StringBuilder sb = new StringBuilder(length);

            string title = WindowFunctions.GetText(i);

            /*
             Trace.WriteLine(string.Format(
             "IntPtr={0},  Window Title={1}",
             i.ToInt32(),
             title));
            */
            if (!string.IsNullOrEmpty(title))
            {
                if (title.Equals("Select By Location"))
                {
                    int pid = WindowFunctions.GetProcessThreadFromWindow(i.ToInt32());
                    if (pid.Equals(arcmapPID))
                    {
                        selectwindow = i;
                    }
                }
            }
        }

        return selectwindow;
    }
}
share|improve this answer
add comment

It is rumored that SP1 for version 10 will add a 'minimize' button back to the attribute 'Table' window. This would not fix the issue but might help a little. However, I was unable to confirm this rumor as I cannot find the update in the SP1 list:

http://downloads2.esri.com/support/documentation/ao_/10.0_SP1_Announcement.pdf

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.