MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Multiple Forms Problem

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-16-2003
Junior Member
White Belt
 
Join Date: Apr 2003
Posts: 7
Multiple Forms Problem

Hi,

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é
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 09-16-2003
Junior Member
White Belt
 
Join Date: Aug 2003
Posts: 4
http://www.avdf.com/multimedia/samp_modeless.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 09-17-2003
Junior Member
White Belt
 
Join Date: Apr 2003
Posts: 7
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é
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 09-24-2003
Junior Member
Yellow Belt
 
Join Date: Feb 2003
Posts: 28
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 01:54 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51