Article View: borland.public.cppbuilder.nativeapi
Article #12332Re: ListItem SetFocus
From: Rodolfo Frino
Date: Wed, 10 Dec 2003 14:18
Date: Wed, 10 Dec 2003 14:18
34 lines
1709 bytes
1709 bytes
Try this code:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int index(5);
ListView->SetFocus();
ListView->Selected = ListView->Items->Item[index];
for (int i=0; i<index; i++)
{
keybd_event(VK_DOWN, 0x26, KEYEVENTF_EXTENDEDKEY | 0, 0);
keybd_event(VK_DOWN, 0x26, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
}
}
Rodolfo
"George" <george@nospam.org> wrote in message
news:3fd5c2e0@newsgroups.borland.com...
> Hi,
>
> I have my ListView and I select an item:
>
> ListView->Selected = ListView->Items->Item[5];
>
> but this ONLY make the blue box in the listview. If I press the keyboard
> upper or down key, it doesn't move. I have to click with my mouse inside
the
> listview to obtain "real" focus.
>
> What's wrong?
>
>
Technical Details
Message-ID:
<3fd72b0d@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3fd5c2e0@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,d67c05b9f8b9a10d X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-12-10 06:39:55 PST From: "Rodolfo Frino" <MenInBlack@nowhere.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3fd5c2e0@newsgroups.borland.com> Subject: Re: ListItem SetFocus Date: Thu, 11 Dec 2003 01:18:03 +1100 Lines: 36 Organization: Men In Black 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 NNTP-Posting-Host: 203.206.17.200 Message-ID: <3fd72b0d@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1071065869 203.206.17.200 (10 Dec 2003 06:17:49 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail