Remember me

Lost Password?

Register now!
Who's Online
65 user(s) are online (51 user(s) are browsing Forums)

Members: 0
Guests: 65

Support us!
Recent OS4 Files
Report message:*

Re: BOOPSI Menu Class: first update

Subject: Re: BOOPSI Menu Class: first update
by trixie on 2014/7/13 12:47:19


You'd need a pointer to the window (or window object) too.

In that case it might be more sensible to make it

static void menu_func(Object *menuObject)

and then GetAttrs() attributes like MENU_Window and MENU_UserData from the object, inside the callback function.

In which case the callback can as well be a regular hook function because their second argument is always an object pointer. So in reaction to a toolbar event, the programmer can call

menu_func(NULL, menuObject, NULL);

and use the same function the Menu Class uses as callback.


While hooks are a nice idea, they aren't always the best solution...

Don't worry, the callbacks are going to be optional. There will be two ways to process menu events:

1. The handler-based approach
The programmer will have to write dedicated handler functions (callbacks) that will be invoked automatically by the class upon menu selection. No further processing will be needed.

2. The traditional approach
The programmer will be able to process menu events in a traditional loop, probably based on a MENU_ID value returned by the handleinput method (an attribute analogous to GA_ID).

These two approaches could even be combined to get the best of both worlds. For menu items that have no handler assigned to them the handleinput method will return the respective menu ID. For menu items with a handler the method will invoke the callback (= no ID will be returned).

Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project