messaging

Forum thread started by Remco.Johannes on Tue, 2014-06-03 20:48

Hi,

I got a fquestion (well... a lot but start with one) about message-ing in haiku.


when you create for example a button like this

BButton *button = new BButton(BRect(10,10,11,11),"button","Click Me!"
, new BMessage(M_BUTTON_CLICKED));
and handling like yhis
MessageReceived(BMessage *msg)
{
switch(msg->what)
{
case M_BUTTON_CLICKED:
{
// blablabla
}
}
}
how does the button "knows" that the passed in bmessage is associated with the click.
Is this a standard "event" or is there only 1 "event" (click) or........confused

I hope my q is understabable

Remco J