Send data to menu?
Is there an easy way? Or a way at all? :/
|
Re: Send data to menu?
To menu... Are you meaning to the menu handler function or what?
|
Re: Send data to menu?
Yeah, what else would I mean? :P
|
Re: Send data to menu?
Quote:
But aye. There's no way, since it can't be passed in menu_display. So... Probably you'll use global variable. |
Re: Send data to menu?
If you are using the new menu system you can do it.
Put data as the third parameter in menu_additem Then you can retrieve the data in the menu_handler like: Code:
//now lets create some variables that will give us information about the menu and the item that was pressed/chosen |
Re: Send data to menu?
Aye, but if you need to use the infos for regonizing the items in the handler, it isn't possible to get what part in the string is the item's info and what that one, if you would add them both.
|
Re: Send data to menu?
Could simply make the data[] = "01otherdata"
all the way to "99otherdata" str_to_num will still get the number correctly. Then you can just do data[2] to get the other data. Edit: Even if you didn't want to use exactly that, you could seperate the data by an identifier. formatex(data, len, "%d|%s", num, extra_data); Then use strtok(data, Left, 20, Right, 20, '|'); And use str_to_num(Left) and then you have the extra data in Right |
Re: Send data to menu?
Quote:
|
Re: Send data to menu?
Seems like way too much trouble. Besides, I thought of just using a global variable right after posting here. Still, interesting to know that you can do it.
|
Re: Send data to menu?
Actually, you can use the data originally like Emp` said without identifiers.
The "item" parameter in the handling function shows the item number that you did. Code:
|
| All times are GMT -4. The time now is 08:58. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.