Article View: borland.public.cppbuilder.nativeapi
Article #8880Re: How to catch a mouseup on the right scrollbar of a TDBGrid?
From: Mark Jacobs
Date: Tue, 14 Sep 2004 15:45
Date: Tue, 14 Sep 2004 15:45
50 lines
3225 bytes
3225 bytes
"Paolo Borlandi" <pborlandi@virgilio.it> wrote in message
news:4146e331@newsgroups.borland.com...
| I need to trap the mouseup event shooten from the right scrollbar of a
| TDBGrid to refresh an image corresponding to a grid row. Using the scrollbar
| results to move the selection bar to another row and also the image must be
| reloaded. Have some suggestion?
You're better off trapping the much more generic "I have moved to a different
record" event. This is actually the OnDataChange of the DataSource object
connected to the DBGrid and TTable objects you are using. Here is an example
using an AdsTable descendant of TTable :-
//---------------------------------------------------------------------------
// Triggered when going to a new record (row)
void __fastcall TForm1::DataSource1DataChange(TObject *Sender,TField *Field)
{
AnsiString delmes,fnm,peace; int ii; char sng='\'';
if (DBGrid1->LayoutLock!=0 || AdsTable1->ControlsDisabled()) return;
if (filtno==0)
{
recallbtn->Enabled=false; StatusBar1->Panels->Items[1]->Text="";
StatusBar1->Panels->Items[2]->Text="No.Recs.=0";
recdsp->Text="No Records to Display\r\n"; return;
}
if (AdsTable1->RecNo>0 && AdsTable1->AdsIsRecordDeleted(0))
{
delmes=" Deleted"; recallbtn->Enabled=true;
}
else { delmes=""; recallbtn->Enabled=false;}
StatusBar1->Panels->Items[1]->Text="Rec.No."+mjfmtnm(AdsTable1->RecNo)+delmes;
StatusBar1->Panels->Items[2]->Text="No.Recs.="+mjfmtnm(filtno);
recdsp->Text=mjdsprec(AdsTable1,fldlist); DBGrid1ColEnter(Sender);
}
//---------------------------------------------------------------------------
// Triggered when going to a new field (column)
void __fastcall TForm1::DBGrid1ColEnter(TObject *Sender)
{
AnsiString fnm;
if (!AdsTable1->Active || filtno==0) return;
fnm=(DBGrid1->SelectedField->FieldName+" ").SubString(1,10)+":";
if (recdsp->Text.Pos(fnm)>0) wildfindtext(recdsp,0,fnm,false,false);
}
//---------------------------------------------------------------------------
HTH
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
markj atty critical dotty co dotty uk
Technical Details
Message-ID:
<41471202@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!wn13feed!worldnet.att.net!204.71.34.3!newsfeed.cwix.com!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4146e331@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7895f7bf962ab0e1 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Mark Jacobs" <markj atty critical dotty co dotty uk> From: "Mark Jacobs" <markj atty critical dotty co dotty uk> Newsgroups: borland.public.cppbuilder.nativeapi References: <4146e331@newsgroups.borland.com> Subject: Re: How to catch a mouseup on the right scrollbar of a TDBGrid? Date: Tue, 14 Sep 2004 16:45:06 +0100 Lines: 52 Organization: DK Computing X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 81.144.157.8 Message-ID: <41471202@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1095176706 81.144.157.8 (14 Sep 2004 08:45:06 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!wn13feed!worldnet.att.net!204.71.34.3!newsfeed.cwix.com!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail