Order of the Butterfly
Posts: 358 from 2003/10/3
From: Padova - Italy
Dear Kronos, you are right and I apologize for that but, sometimes, I must post at work from a win box.
Now I'm at home with my miggy in front of me and I'll try to be more precise altough my english, as you may see, is far from perfection
Here a piece of code cutted from calc2 :
...
DoMethod(BT_Clear, MUIM_Notify, MUIA_Pressed, TRUE, MUIV_Notify_Application, 2, MUIM_Application_ReturnID, CLEAR_ID);
...
while ((retval = DoMethod(app, MUIM_Application_NewInput, &signals)) != MUIV_Application_ReturnID_Quit)
{
switch (retval)
{
case CLEAR_ID : CalcClear(); break;
...
In this exemple, we parse the Method ID to catch a button pressed by the user but, as stated also in the remarks of the example, "ReturnIDs is not recommended way to do it but let's keep it simple, ok?".
Now we want to make it more complex (I'm masochist
and make the parsing of the return id's more OO. So, let's take a look at calc3 source where the calculator itself is build as a custom class.
We have the usual DoMethod
...
DoMethod(BT_Clear, MUIM_Notify, MUIA_Pressed, TRUE, obj, 1, MUIM_Calculator_Clear);
...
then we have (AAARGHH) the dispatcher:
...
DISPATCHERPROTO(MCC_Dispatcher)
{
...
switch (msg->MethodID)
{
...
case MUIM_Calculator_Clear : return CalcClear (data);
...
}
return DoSuperMethodA(cl, obj, msg);
}
My answer is: if I don't want to build a custom class, how have I to use the Dispatcher?
And if I'm forced to build a new class, where could I find some basic hints to do that? Reading MUI autodocs in the SDK make me feel a little crazy... ;-(
Again thanx for your replies and excuse me for my not very clear posts.
Ciao!
Mauro.
-------------------