Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
53 user(s) are online (42 user(s) are browsing Forums)

Members: 1
Guests: 52

serpi, more...
Support us!
Recent OS4 Files
OS4Depot.net
Report message:*
 

Re: BOOPSI Menu Class: first update

Subject: Re: BOOPSI Menu Class: first update
by broadblues on 2014/7/5 12:35:22

@trixie
Quote:

So I have taken my own way. You can now associate a "handler" function with any menu object, which you pass via MENU_Handler. This tag takes a pointer to a hook function, where the particular reaction to selecting the item will be handled. The hook for this hook function is allocated, installed and disposed of internally by the class. (This of course saves a lot of work. Considering that menus can contain dozens of items, just imagine having to prepare dozens of hooks manually!)


You should offer a MENU_Hook too then maybe, as I can quite see that the same handler could be called for many menus items and allocating a hook for each idetical instance is hardly efficient.

Quote:

Upon receiving a menu event for your window, you just call the MM_HANDLEINPUT method and that is all. The method will process the menu selection and call the respective handler. (The ARexx class works in this way, too, so I'm not introducing any foreign solution here.)


Not it not foreign but surely it will clash with window.class menu handling? arexx.class is a standalone class so no issues, but this menu.class must intertwine with other classes to be useful.


Quote:

If we manage to establish some cooperation between Window Class and Menu Class, the MM_HANDLEINPUT method could even be called by Window Class upon receiving IDCMP_MENUPICK. Thus, the programmer would become completely free of having to process menu events in the event loop.


Okay didn't read far enough ahead. But it seems you are forcing a hook function approach this way and adding extra complexity and overhead. That is ofcourse always a danger with OO approaches, but not inevitable.

Quote:

Along with MENU_Handler I have also added MENU_UserData, through which you can associate arbitrary data with the menu object. If MENU_UserData is provided, the hook for the handler function will put it in its ASOHOOK_Data, so that the user data can be accessed from within the handler if needed.


Sounds good.



Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project