Community of VE/MapPoint Users and Developers
This is a discussion on Multiple Forms Problem within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, This must have been discussed before, but I couldn't find anything with the Search. I have MP2002 Control on ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Multiple Forms Problem This must have been discussed before, but I couldn't find anything with the Search. I have MP2002 Control on a form. Whenever I show 2 modeless instances of the form, the focus/zorder goes funny - clicking on one form brings the other forward. This does not happen when I remove the OCXes, so it must be a control code bug? Here's my code: (Click on Cammand1 twice to open two instances of Form2 (with MapPoint OCX). Then try to click any of the instances. see what I mean? HELP! Form1: Option Explicit Private Sub Command1_Click() Dim frm As Form2 Set frm = New Form2 frm.Show vbModeless End Sub Form2: Option Explicit Private Sub Form_Initialize() MapViewer.NewMap geoMapEurope End Sub
__________________ Cheers André |
| |||
| |||
|
Thanks Ninjas, but I know what a modeless dialog is. In this case I have a normal modeless forms. Replace the MapPoint control with a textbox, click the button twice, and it works fine. Add back mappoint ctl and do the same - the form that loses focus jumps to the top.
__________________ Cheers André |
| |||
| Multiple Forms Problem
I noticed that the problem does not exist if you use an MDIForm and your Mappoint control in the child forms. However, you can imitate this somewhat using the following code. Be forwarned that whatever window is last activated will stay on top of all other applications as well as other windows in your current application! Create a module: Code: Public Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Public Declare Function SetWindowPos Lib "user32" _
(ByVal iWinHandle As Long, _
ByVal hWinInsertAfter As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal uFlags As Long) As Long
CONST TOPMOST = -1
CONST NOMOVE = &H2
CONST NOSIZE = &H1
CONST NOCHANGE = NOMOVE OR NOSIZE
Public Sub SetFormOnTop(frmHandle as long)
Call SetWindowPos(frmHandle, -1, 0, 0, 0, 0, NOCHANGE)
End Sub
On your form (I think you used Form2 in your example, but you will need it on ANY form that you want to have focus while your application is running) : Code: Private Sub Form_Activate() 'Debug.Print Me.Caption & " activated " & Me.hWnd Call SetFormOnTop(Me.hWnd) End Sub |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| multiple instance problem | pichan81 | MapPoint 2006/2009 Discussion | 1 | 06-06-2006 02:05 PM |
| Multiple Routes | wadams | MapPoint 2006/2009 Discussion | 0 | 11-17-2005 09:28 AM |
| Can I use Mappoint in Web forms in VB.NET? | Anonymous | MapPoint 2006/2009 Discussion | 4 | 11-11-2004 06:42 AM |
| Event handling- Mappoint Control in VB forms | EasyCoder | MapPoint 2006/2009 Discussion | 0 | 05-27-2004 07:10 PM |
| MP 2002/2004 Major problem with non modal forms in VB6 | neomoon | MapPoint 2006/2009 Discussion | 0 | 10-07-2003 04:13 AM |
Zermatt Skiing
Thinking about skiing in Switzerland? Zermatt skiing is simply spectacular. Book online at Holiday Hypermarket to get a great value holiday in the shadow of the Matterhorn.
Flights to Portugal
Find and book flights to Portugal. Travel Counsellors can help with travel to Portugal including flights and accommodation.
Flight to Canada
Book a flight to Canada to explore one of the most exciting travel destinations in the world. There are loads of interesting cities but some even more impressive natural beauty.
Sri Lanka Holidays
There are some outstanding deals on Sri Lanka holidays at theholidayplace.co.uk. Sri Lanka is renowned for it's exceptional beauty! Book a holiday today!
Cyprus
Before visiting Cyprus, make sure you are well informed to make the most of your holiday. Online at ulookubook.com you check out our useful travel guides. Find out all about the Cyprus nightlife, shopping, eating and customs.
Family package holidays
Save a lot of time and opt for one of the great family package holidays at Travel.co.uk
Holidays to Lanzarote
Not been to the Canary Islands yet? What are you waiting for! Get information on holidays to Lanzarote at On The Beach.