Hello Stuart and Fern,
First of all I want to apologize for such a long delay with a reply.
I tried your code on a device that had .NETCF V1 SP2 installed and it
worked just fine as long as the ListView control had focus. In V1, when a
.NETCF application starts, the form is focused (not its children). This has
been changed in V2.
The only thing I had to do to make your application work was to add
listView.Focus() at the end of the constructor.
Hope this helps.
Please let me know if you have any other questions.
Thank you,
Sergiy.
--------------------
| From: "Stuart Celarier" <
[email protected]>
| References: <
[email protected]>
| Subject: Re: ListView KeyPress event
| Date: Fri, 10 Dec 2004 07:42:03 -0800
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="US-ASCII"
| Content-Transfer-Encoding: 7bit
| X-Mailer: Microsoft Office Outlook, Build 11.0.6353
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Thread-Index: AcTcbR//HD9l1NxhRBW5eaD+Z1EA3QAIoxUaAI88BRA=
| In-Reply-To: <
[email protected]>
| X-Transport: MAPILab NNTP v1.2 for Microsoft Outlook,
http://www.mapilab.com/
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: c-67-169-206-96.client.comcast.net 67.169.206.96
| Lines: 1
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
.phx.gbl
| Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.compactframework:66678
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Sergiy wrote:
| >The KeyPress event is supported for ListView in the .NET Compact
| Framework V1 SP2.
|
| Say, I looked into this. The ListView.KeyPress event is exposed in the
| .NET Compact Framework, but maybe I am using it incorrectly. A complete
| program is included below: I never get the MessageBox from
| listView_KeyPress. This approach works on the .NET Framework. What am I
| missing?
|
| Cheers,
| Stuart Celarier, Fern Creek
|
|
| using System.Drawing;
| using System.Windows.Forms;
|
| namespace SmartDeviceApplication6
| {
| public class Form1 : Form
| {
| private ListView listView;
|
| public Form1()
| {
| listView = new ListView();
| listView.Location = new Point(10 , 10);
| ListViewItem lvi = new ListViewItem( "Item" );
| listView.Items.Add( lvi );
|
| Controls.Add( listView );
| Text = "Form1";
|
| listView.KeyPress += new KeyPressEventHandler( listView_KeyPress
| );
| }
|
| private void listView_KeyPress( object sender, KeyPressEventArgs e )
| {
| MessageBox.Show( "Key pressed" );
| }
|
| static void Main()
| {
| Application.Run( new Form1() );
| }
| }
| }
|
|
This posting is provided "AS IS" with no warranties, and confers no rights.