🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #16303

Re: Prevent a user from checking a TListItem

#16303
From: StarCinema - Rodolfo Frino
Date: Tue, 20 May 2003 21:29
43 lines
2471 bytes
Your solution is good but this one is even better

void __fastcall TForm1::ListView1Change(TObject *Sender, TListItem *Item,
      TItemChange Change)
{
       Item->Checked = false;
}

Rodolfo
Stargate Software

"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message
news:3eca928b$1@newsgroups.borland.com...
>
> "StarCinema - Rodolfo Frino" <starcinema@stargate.com> wrote in message
> news:3eca8cff@newsgroups.borland.com...
>
> >     for (int i=0; i< ListView1->Items->Count; i++)
> >           ListView1->Items->Item[i]->Checked = false;
>
> Rather than looping, which will be quite inefficient if there are a lot of
> items in the list, you could just pass the X and Y values to
> TListView::GetItemAt() to get the actual item being clicked on.  You could
> also hit-test the item first to determine whether the user is actually
> clicking on the checkbox in the first place or just selecting the item in
> general:
>
>     void __fastcall TForm1::ListView1MouseDown(TObject *Sender,
TMouseButton
> Button, TShiftState Shift, int X, int Y)
>     {
>         THitTests ht = ListView1->GetHitTestInfoAt(X, Y);
>         if( ht.Contains(htOnStateIcon) )
>         {
>             TListItem *Item = ListView1->GetItemAt(X, Y);
>             if( Item ) Item->Checked = false;
>         }
>     }
>
>
> Gambit
>
>
Technical Details
Message-ID: <3eca9e2e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3eca8580@newsgroups.borland.com> <3eca8cff@newsgroups.borland.com> <3eca928b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,a81cc7d506c46104
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-20 15:04:17 PST
From: "StarCinema - Rodolfo Frino" <starcinema@stargate.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3eca8580@newsgroups.borland.com> <3eca8cff@newsgroups.borland.com> <3eca928b$1@newsgroups.borland.com>
Subject: Re: Prevent a user from checking a TListItem
Date: Wed, 21 May 2003 07:29:47 +1000
Lines: 45
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.23.25
Message-ID: <3eca9e2e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1053466158 203.206.23.25 (20 May 2003 14:29:18 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail