Click to See Complete Forum and Search --> : Button
Gedrain
April 26th, 1999, 10:19 AM
Hello.
I only need to know how i can know when a standard button is be clicked.
i though it will be like this
void Claden::Onladen()
{
while not (OKbuttonpressed); // then wait if it pressed then go further in this function...
}
plz help me out thx...
mihai
April 26th, 1999, 11:01 AM
The parrent's button receives one WM_COMMAND message. In MFC the button, send to itself a reflected message WM_NOTIFY, BN_CLICKED.
Sincerely, Mihai
Gomez Addams
April 26th, 1999, 12:18 PM
Mihai is correct. There is a little more to the story though. There
are several messages sent during the process of clicking a button.
Typically, the actual command message of being clicked is not sent
until the button is released. You can also catch the push and release
notifications if you want. They are WM_COMMAND messages with
notify codes of BN_PUSHED and BN_UNPUSHED respectively.
Gedrain
April 26th, 1999, 01:21 PM
how can i connect a WM_COMMAND with my button?
Gomez Addams
April 26th, 1999, 01:31 PM
The simplest method is to make an OnCmdMsg handler in the dialog
that contains the button. The class wizard can do this for you. Its
arguments will be OnCmdMsg( UINT nID, int nCode, void* pExtra,
AFX_CMDHANDLERINFO* pHandlerInfo ) so you can identify whether
the id matches your button and what the notify code is.
If your button's code is contained in its own class you will probably
need to use ON_CONTROL_REFLECT. See TN062 for more info
on this. I have never used it so I can't help very much on this.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.