MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Problem recognizing a keystroke

This is a discussion on Problem recognizing a keystroke within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, In Visual Studio 2003 and C# 1.0, I set KeyPreview to true for the form, so that while a ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-16-2005
Senior Member
Green Belt
 
Join Date: Jul 2005
Posts: 105
Problem recognizing a keystroke

Hi,

In Visual Studio 2003 and C# 1.0, I set KeyPreview to true for the form, so that while a form has the focus, I can get notified when a user presses a key on the keyboard, thusly:

private void MyForm_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
switch ( e.KeyCode )
{
case Keys.F5: break;
case Keys.F6: break;
case Keys.F7: break;
}
}

In this way, everything was working fine. But then I needed a MapPoint control on that form, and since I've added it, my ability to detect
the keyboard has been compromised. Now, it only works after I have opened a client form with a button click or clicked on a ListBox control on the form. From then on, keystrokes are detected fine. But I'd like it to work the first time, and without needing to know to click in these places. Clicking the form does not have the same effect as clicking in the controls I mentioned.

My question is what change can I make to the form or the control to allow me to fix this? It's puzzling, but I he there's a simple fix to it.

Thanks for the help.
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 12-18-2005
Senior Member
Green Belt
 
Join Date: Jul 2005
Posts: 105
I have more information about my problem

It seems, as one would expect, the focus is set to the new MapPoint cntrol, after it's initialized in my FORM_LOAD() function. And so long as the focus is on the control, the form's KeyUp event can not intercept the keystroke. While this is perfectly understandable, I can not understand why I am not able to programmatically change the focus to another control.

When I load the program, the F5 key does not work. But when I click inside a listbox, and move the focus away from MapPoint, the F5 does work. If I move the focus back to the MapPoint control, the F5 stops working. That's all fins and good. But why can I not move the focus with the Focus() method for the listbox? Why does that not do that same thing?

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

Tags
keystroke, problem, recognizing


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


All times are GMT -5. The time now is 01:14 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

Cheap Flights to Benidorm
Book cheap flights to Benidorm with Holiday Hypermarket. Whether Summer or Winter Benidorm is a great destination.

Greece Weather
Check Turkey Weather before you travel. We provide information on Turkey including weather, flights and accommodation.

Holidays in Italy
Holidays in Italy boast some stunning countryside as well as a beautiful coastline. You can even visit an active volcano like Stromboli or Etna. Book at dealchecker.co.uk.

Dubai Holidays
Dubai holidays provide you with exotic sights, desert safaris and superb cuisine. There is an extensive range of things to do and see!

Turkey
Before booking a holiday to Turkey check out the ULookUBook travel guide. Find out about the rich culture in Turkey before you go there to help you to make the most of your holiday.

Family package holidays
Save a lot of time and opt for one of the great family package holidays at Travel.co.uk

Cheap Holidays in Sharm el Sheikh
Egypt awaits! Visit On The Beach for info on cheap holidays in Sharm el Sheikh.


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 52