From: Miguel P. <ob...@sa...> - 2003-07-09 21:52:49
|
Sorry, I sent it from the wrong account and bounced... Regards, Miguel > > Hi. > The simplest way to understand it is by running the ndk_demo from ddd or > any similar debugger, but I will try to explain it: > > The binding stuff is a shameless downsized copy of the way MFC works. > > Basicaly you: > > 1) - Add the DECLARE_BINDINGS macro to the class declaration body, > 2) - Add the BEGIN_BINDINGS macro on the implementation file, passing the > class name and it?s parent class name. > 3) - insert the corresponding > ON_COMMAND/ON_NOTIFY/ON_COMMAND_RANGE/ON_NOTIFY_RANGE > entries. > 4) - Close the list with the END_BINDINGS macro. > > Here is the implementation of the bindings for DialogBox: > BEGIN_BINDINGS(DialogBox,Control) > ON_COMMAND(IDOK,DialogBox::on_dlg_ok) > ON_COMMAND(IDYES,DialogBox::on_dlg_yes) > ON_COMMAND(IDNO,DialogBox::on_dlg_no) > ON_COMMAND(IDCANCEL,DialogBox::on_dlg_cancel) > END_BINDINGS() > > > These declarations are used by the process_message function to walk thru > the table of bindings of each class searching a compliant event/control_id > pair (or any event/control par in a range, if you use ON_NOTIFY_RANGE) if > it?s an event (ON_NOTIFY_xxx) or for a comforming command ID if it?s > ON_COMMANDxxxx. > If it find one, then executes the associated function. > Exausted the list, if the parent?s list isn?t null, it will go up and > continue, > searching the parent?s list, and if it?s parent?s list is not null it will > go there, allowing you to fake inheritance for event consumption. > This is done in Control::process_message static function. > > The macros only hide the textual complexity of declaring each table and > each > entry. > > This apparatus is used on ndk_demo to update the editor when you click on > any list, or to know which element of the first list to delete based on > the > selection of the radio buttons on the second (first,last, middle). > > You can see it at work there... > > Hope this helps, > else let me know and I will go into more details... > > Best regards > Miguel > > Miguel Jose Pinkas > Fabrica de Software XXI S.R.L. > mi...@la... > ICQ#32064148 > > -------- > E-mail y acceso a Internet UltraVeloz totalmente GRATIS en Buenos Aires, > Rosario, Cordoba, Mendoza, La Plata y Pilar > http://www.Argentina.com > Nro. de acceso 5078-5000 Usuario: Argentina Password: Argentina > > > > -- > Obtenga gratis su cuenta @Argentina.com con AntiVirus, > 20mb de espacio y acceso libre UltraVeloz en 24 ciudades > www.Argentina.com |