POST
|
Here's a follow-up to the Form Owner issue. I saw this demonstrated at the 2012 User Conference in San Diego using only ONE LINE OF CODE! As it turns out, .NET has a built-in static method that can do the same thing as the wrapper class mentioned earlier. It works as follows: MyFormInstanceName.Show(System.Windows.Forms.Control.FromHandle(My.ArcMap.Application.hWnd)) No wrapper class is needed after all!
... View more
07-30-2012
04:45 PM
|
0
|
0
|
241
|
POST
|
Thanks for that reply, @KenBuja. That's pretty much the same code I have, and it works beautifully. Incidentally, I discovered that this technique can also be used with a System.Windows.Forms.MessageBox object. As you know (or will eventually find out), the default location for the MessageBox is at the CENTER OF YOUR DISPLAY SCREEN. This behavior is not what I prefer, so I use the Win32 Window Wrapper technique, as follows:
Imports System.Windows.Forms
' Example 1: This will open a MessageBox at the center of YOUR FORM:
MessageBox.Show(New Win32HWNDWrapper(MyFormInstanceName.Handle), "This is the message", "This is the caption")
' Example 2: This will open a MessageBox at the center of the ARCMAP APPLICATION WINDOW:
MessageBox.Show(New Win32HWNDWrapper(My.ArcMap.Application.Hwnd), "This is the message", "This is the caption") I hope someone finds this as useful as I have.
... View more
05-01-2012
09:39 AM
|
0
|
0
|
241
|
POST
|
Wow, looks a tad complicated but I'll see if I can work through it (I'm an intermediate-level programmer, but some of these concepts, like the "hook", are new to me). Thanks a lot for posting this; MUCH APPRECIATED!!! -Jim
... View more
04-09-2012
08:19 AM
|
0
|
0
|
427
|
POST
|
@rlwatson and @jtkknelson, Thanks for the code and the links. I have it working now, thanks to helpful folks like you, here in these forums. Much appreciated! -Jim
... View more
03-26-2012
01:17 PM
|
0
|
0
|
1138
|
POST
|
@Neil, Thank you SO MUCH. This works PERFECTLY! ESRI developers can sometimes really confound my sense of consistency. I found in the online documentation an "ArcGIS Explorer Style Guide for Developing Add-ins", in which it explains how the ESRI.ArcGISExplorer.Application namespace returns an IWin32Window reference. EXACTLY THE OBJECT I WOULD NEED for my ArcMap add-in. Except that the ArcMap add-in's My.ArcMap.Application object exposes just the hWnd integer property. MyForm.Owner = My.ArcMap.Application.Window How much easier THAT would have been! But I suppose I may find other uses for the ModelessDialog class. Your help is MUCH appreciated! -Jim
... View more
03-26-2012
10:22 AM
|
0
|
0
|
310
|
POST
|
Now is there a way to set the Form.Owner property to be the ArcMap application? This would bring the form forward if the application window is made active. I found some documentation that shows how to do this with ArcGIS Explorer, which exposes a Application.Window reference that the Form.Owner property will accept. Unfortunately, the ArcMap Application class only exposes a hWnd integer. I have no clue what to do with that. Can anyone help?
... View more
03-23-2012
04:00 PM
|
0
|
0
|
1138
|
POST
|
Would you mind posting your code to get a windows form displayed in a dockable window? I've been trying to get that to work and cannot seem to figure it out. Thanks!
... View more
03-23-2012
03:35 PM
|
0
|
0
|
427
|
POST
|
OK, noob: Having already setup Visual Studio, now download and install the ArcGIS SDK for .NET, get all of your service packs on, then start learning about "Add-ins", new at 10.0. And beware, even though ESRI says there is "a lot" of documentation about Add-ins available, I am finding it EXTREMELY TRICKY to create an add-in that can open a standard Windows Form properly. Actually, I can get it to open a form, but the form is not "owned" by the application window, so it floats independently and can get hidden behind the application window or other windows if I'm not careful. I have found a grand total of ZERO help or discussion of this topic so far. Otherwise, the Add-in mechanism is very cool, and once I figure out my little form ownership issue, I think I'm going to love it. While it is true that you can get the VBA license from ESRI for version 10.0 only, it is a pain in the rear to install because it requires a separate license key. Plus, if you used to keep any VBA code in the User Template code module, you will be surprised to learn that ESRI has eliminated the user template (MXT file) at version 10.0, so now you must save your code in the MXD Document module. You can actually save code in the Normal Template module (yes, there's still a Normal template, but no user templates) but then you cannot call such code from a toolbar button or tool. Welcome to ESRI's new world order.
... View more
03-23-2012
03:06 PM
|
0
|
0
|
310
|
Online Status |
Offline
|
Date Last Visited |
07-06-2022
05:25 PM
|