Click here to get back home

Handling the back key doesn't work if the form has a LinkLabel (.NET CF)

 HomeNewsGroups | Search | About
 microsoft.public.smartphone    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Handling the back key doesn't work if the form has a LinkLabel (.NET CF) Jason 07-31-2007
Posted by Jason on July 31, 2007, 2:08 pm
Please log in for more thread options
I'm porting a Pocket PC app to SmartPhone. Certain forms within the
app contain buttons -- these are not supported on SP so I've switch
them to LinkLabels. They work fine, but the issue is that overriding
the back button does not work on these forms.

For handling the SP back button, my keypress method looks like:

protected override void OnKeyPress(KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Escape)
{
e.Handled = true;
MessageBox.Show("Got back key on SP");
}
else
base.OnKeyPress(e);
}


This works great, unless I add the following to the form's
InitializeComponent():

this.Controls.Add( new System.Windows.Forms.LinkLabel() );

Now when I press the SP's back key my 'OnKeyPress' does not fire, and
the app is no longer displayed on the screen (i.e. the default SP back
key behavior).

Has anyone worked around this before? I did a quick search and didn't
see any obvious hits.

Thanks,


Similar ThreadsPosted
Don´t make back in mobile web form October 17, 2005, 3:12 pm
Don´t make back to mobile web form October 19, 2005, 10:22 am
Handling of certificates issued to *.domain.com August 30, 2006, 8:42 pm
Add a menu item into messaging form May 21, 2006, 2:25 pm
Order of fields in Contact form August 2, 2007, 4:43 pm
List of Windows Mobile Form Factors August 30, 2006, 11:25 am
latest Windows Mobile news in podcast / audio form April 29, 2007, 2:00 pm
Restoring Back Ups August 1, 2005, 10:06 am
Carphone Warehouse holding back SPV? December 14, 2005, 4:05 pm
Can I restore wiped phone if I get it back. July 25, 2008, 9:36 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap