|
-
April 26th, 1999, 10:19 AM
#1
Button
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...
-
April 26th, 1999, 11:01 AM
#2
Re: Button
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
-
April 26th, 1999, 12:18 PM
#3
Re: Button
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.
-
April 26th, 1999, 01:21 PM
#4
Re: Button
how can i connect a WM_COMMAND with my button?
-
April 26th, 1999, 01:31 PM
#5
Re: Button
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|