ListView and FocusedItem

T

Tore Stensby

Hi.

We are developing an application for the Symbol 8100, with a (almost)
complete hardware-keyboard. And after the release of SP2 the use of the
keyboard works pretty well.

But im struggling with one issue:
When my form loads, i read and fill a he listview, selects the last item,
call the ensurevisible, and forces the focus to the listview. Then i want my
user to be able to navigate up and down in the list using the up and down
keys on the keyboard. But when i use
 
T

Tore Stensby

Tore Stensby said:
Hi.

We are developing an application for the Symbol 8100, with a (almost)
complete hardware-keyboard. And after the release of SP2 the use of the
keyboard works pretty well.

But im struggling with one issue:
When my form loads, i read and fill a he listview, selects the last item,
call the ensurevisible, and forces the focus to the listview. Then i want my
user to be able to navigate up and down in the list using the up and down
keys on the keyboard. But when i use

Sorry, some more should be here:

But when i use the up/down-keys, the listview repositions to the first item
in the list. And trying to call the FocusedItem, a NullReferenceException
occurs.

If i click the selected item with the stylus in the listview, the focuesitem
is set, and the navigating works perfect. Trying to manually set the
FocusedItem dont work, the property is ReadOnly.

Am i missing something when working with the listview this way?

ToreS
www.stensby.com/netcf (My .net CF site, in Norwegian)
 
S

Serg Kuryata [MS]

Hello Tore,

You need to set the Selected and Focused properties of the listviewitem to
true. For example,

this.listView.Items[this.listView.Items.Count - 1].Focused = true;
this.listView.Items[this.listView.Items.Count - 1].Selected = true;

Please let me know if this does not help.

Best regards,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Tore Stensby" <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| References: <[email protected]>
| Subject: Re: ListView and FocusedItem
| Lines: 32
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Date: Thu, 22 Jan 2004 09:17:35 GMT
| NNTP-Posting-Host: 193.216.110.1
| X-Complaints-To: (e-mail address removed)
| X-Trace: juliett.dax.net 1074763055 193.216.110.1 (Thu, 22 Jan 2004
10:17:35 MET)
| NNTP-Posting-Date: Thu, 22 Jan 2004 10:17:35 MET
| Organization: Tele2 Norway AS Public Access
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!newsfeed.icl.net!newsfeed.fj
serv.net!news-FFM2.ecrc.net!uio.no!newsfeed1.uni2.dk!dax.net!juliett.dax.net
!not-for-mail
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:43710
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| "Tore Stensby" wrote:
| > Hi.
| >
| > We are developing an application for the Symbol 8100, with a (almost)
| > complete hardware-keyboard. And after the release of SP2 the use of the
| > keyboard works pretty well.
| >
| > But im struggling with one issue:
| > When my form loads, i read and fill a he listview, selects the last
item,
| > call the ensurevisible, and forces the focus to the listview. Then i
want
| my
| > user to be able to navigate up and down in the list using the up and
down
| > keys on the keyboard. But when i use
|
| Sorry, some more should be here:
|
| But when i use the up/down-keys, the listview repositions to the first
item
| in the list. And trying to call the FocusedItem, a NullReferenceException
| occurs.
|
| If i click the selected item with the stylus in the listview, the
focuesitem
| is set, and the navigating works perfect. Trying to manually set the
| FocusedItem dont work, the property is ReadOnly.
|
| Am i missing something when working with the listview this way?
|
| ToreS
| www.stensby.com/netcf (My .net CF site, in Norwegian)
|
|
|
|
|
 
T

Tore Stensby

"Serg Kuryata [MS]"write:
Hello Tore,

You need to set the Selected and Focused properties of the listviewitem to
true. For example,

this.listView.Items[this.listView.Items.Count - 1].Focused = true;
this.listView.Items[this.listView.Items.Count - 1].Selected = true;

Please let me know if this does not help.

Hmmm, that simple.... Yes, it works! Thank you.

And together with:
this.listView.EnsureVisible(this.listView.Items.Count - 1)
You are sure that the selected and foucesd item is visible in the list...


ToreS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top