🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Trapping button message

#14892
From: Mattias Carleson
Date: Tue, 29 Jul 2003 21:43
25 lines
1868 bytes
Hi!
I want to trap the message generated by pressing a TSpeedButton.
I�ve been trying it in the Application->OnMessage, and I�ve been trying it by overriding the WndProc method. If Im right it�s the
WM_COMMAND that should be trapped, but it doesnt seem to work.
This is what I try to do:

void __fastcall TMainForm::AppMessage(tagMSG &Msg, bool &Handled)
{
   if(Msg.message == WM_COMMAND)
   {
      if(HIWORD(Msg.wParam=BN_CLICKED))
      {
         ShowMessage("Button event catched!");
      }
}

My second question is how to know which button object caused
the message? I know LOWORD(Msg.wParam) should contain the
identifier and that Msg.lParam contains the handle, but the
TSpeedButton class and its parents doesnt seem to include any
varible or function returning any of it.

How should this be done? Thanks for your time.
/Mattias
Technical Details
Message-ID: <3f26ea7c$1@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-xfer1.atl.newshosting.com!diablo.voicenet.com!feed3.newsreader.com!newsreader.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10cc67,77c37ce9ffa755d1,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-07-29 14:45:42 PST
From: "Mattias Carleson" <mattias.carleson@home.se>
Sender: "Mattias Carleson" <mattias.carleson@home.se>
Reply-To: "Mattias Carleson" <mattias.carleson@home.se>
Subject: Trapping button message
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 62.65.95.167 62.65.95.167    
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3f26ea7c$1@newsgroups.borland.com>
Date: 29 Jul 2003 14:43:24 -0700
X-Trace: newsgroups.borland.com 1059515004 207.105.83.65 (29 Jul 2003 14:43:24 -0700)
Lines: 25
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-xfer1.atl.newshosting.com!diablo.voicenet.com!feed3.newsreader.com!newsreader.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail