News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
MurgaLua full release
Author Message
Juergen
Member
***


Posts: 81
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #1
RE: MurgaLua full release

JohnMurga Wrote:

Juergen Wrote:
The Fl_Menu_:menu() method doesn't work. I guess you are checking for an argument. The menu() should gives back the pointer to the first menu_item, which should be trivially to implement as it is the same as :find_item(first_item)

Nothing to fix :-)

That wouldn't be very useful in murgaLua, so I deviate from FLTK ...

Take a look at menuExample.lua ...

Fl_Menu_:menu(0) is what you'd want I guess.

Yes it is ;-)
I overlooked that. Although there is a small misunderstanding.
menu:find_item(first_item) and menu:menu(0) is exactly the same, but for the latter you don't have to know what the first item is. If you check if there are 0 arguments supplied to the menu() function and then execute the same code that menu(0) does, it would be nearer to the fltk documentation.

JohnMurga Wrote:

Juergen Wrote:
When you provide a callback function for a menu item, self in the callback function points to the menu_item and not to the menu which it should. This way there is no way to get the associated menu. The way fltk defines this is to provide a pointer to Fl_Menu_ and and the associated item can then retrieved via item=menu->mvalue().

Again, I chose to deviate here ...

I thought it was simpler to get the menu item directly.

As it is MenuItems would always have to be a little different in murgaLua.
I will of course document these deviations ...
(There are more like timers, off-screen drawing, etc).

If you could care to tell me, how to access the methods of the menu (redraw it for example) from within the callback. I don't see a way to do that. I can always access the item methods with self:mvalue():item_method() but I can't see a way to access the menu methods without using a special callback for every item or doing nasty tricks.

JohnMurga Wrote:

Juergen Wrote:
I don't think user_data works. Or is there something special to pay attention to?

Nope, you just set it on the widget or menu item, and then you get it.

If you remember the old menu example used it to store the function to call (a rather nasty hack).

Cheers
JohnM


Is there an example somewhere that doesn't throw an error message or a segmentation fault?

Juergen

This post was last modified: 02-11-2008 11:43 AM by Juergen.

02-11-2008 11:30 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
MurgaLua full release - JohnMurga - 01-29-2008, 12:32 AM
RE: MurgaLua full release - Juergen - 01-29-2008, 01:53 AM
RE: MurgaLua full release - iGame3D - 01-29-2008, 03:31 AM
RE: MurgaLua full release - JohnMurga - 01-29-2008, 08:47 AM
RE: MurgaLua full release - JohnMurga - 02-11-2008, 10:02 AM
RE: MurgaLua full release - JohnMurga - 02-12-2008, 09:54 AM
RE: MurgaLua full release - Juergen - 02-11-2008, 10:41 AM
RE: MurgaLua full release - JohnMurga - 02-11-2008, 11:09 AM
RE: MurgaLua full release - Juergen - 02-11-2008 11:30 AM
RE: MurgaLua full release - JohnMurga - 02-12-2008, 09:47 AM
RE: MurgaLua full release - JohnMurga - 02-13-2008, 10:16 AM
RE: MurgaLua full release - Juergen - 02-13-2008, 12:29 PM
RE: MurgaLua full release - JohnMurga - 02-14-2008, 11:46 PM
RE: MurgaLua full release - Juergen - 02-18-2008, 08:55 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: