all groups > dotnet compact framework > may 2007 >
You're in the

dotnet compact framework

group:

MS - PLEASE HELP (ListView, Back Key)


MS - PLEASE HELP (ListView, Back Key) Hilton
5/29/2007 8:39:20 AM
dotnet compact framework:
Hi,

Your UI guidelines state that we need to treat the Back Key appropriately
(on the SP). However, your ListView doesn't seem to behave correctly. Do
you have any suggestions on how we can 'intercept' the Back Key when a
ListView has the focus, then do something and set Handled=true?

Thanks,

Hilton

RE: MS - PLEASE HELP (ListView, Back Key) Simon Hart
6/1/2007 2:21:03 AM
Hook up the KeyDown event:
http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.keydown.aspx

Then in your event handler code something like this:

switch(e.KeyCode)
{
case Keys.Back:
MessageBox.Show("Back key pressed");
break;
}


--
Simon Hart
http://srhartone.blogspot.com


[quoted text, click to view]
Re: MS - PLEASE HELP (ListView, Back Key) Hilton
6/5/2007 12:00:00 AM
Simon,

Thanks for the reply. That sure would be nice, but MS have a bug and the
Back key doesn't get to KeyPress.

Hilton


[quoted text, click to view]

Re: MS - PLEASE HELP (ListView, Back Key) Simon Hart
6/5/2007 12:05:00 PM
It works for me, I'ved used this loads of times. Can you post a code sample?
--
Simon Hart
http://srhartone.blogspot.com


[quoted text, click to view]
Re: MS - PLEASE HELP (ListView, Back Key) macleod
6/5/2007 2:21:15 PM
I just verified it in VS2005 and it works without fail. Are you grabbing
the right event?

[quoted text, click to view]
Re: MS - PLEASE HELP (ListView, Back Key) Hilton
6/5/2007 9:31:38 PM
Simon, macleod,

Are you running it on CF 2.0 or CF 1.0? On 1.0 all the key presses are
caught except Back Key?

public Form1 ()
{
InitializeComponent ();

this.lv.KeyPress += new KeyPressEventHandler (this.lv_KeyPress);
}

void lv_KeyPress (object sender, KeyPressEventArgs kpea)
{
MessageBox.Show (kpea.KeyChar.ToString ());
}

Thanks,

Hilton



[quoted text, click to view]

Re: MS - PLEASE HELP (ListView, Back Key) Hilton
6/5/2007 10:19:56 PM
Hi,

It's not just me, ListView is/seems broken.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1351279&SiteID=1

Hilton


[quoted text, click to view]

Re: MS - PLEASE HELP (ListView, Back Key) Hilton
6/12/2007 12:00:00 AM
Yes, did you try it with a ListView?

[quoted text, click to view]

AddThis Social Bookmark Button