Raised This Month: $32 Target: $400
 8% 

[MENU] Spacer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 12-08-2014 , 18:09   [MENU] Spacer
Reply With Quote #1

I'm about to explode, I try to create a menu and add a spacer between the title and the options.

So far
AddMenuItem(menu, "", " ", ITEMDRAW_RAWLINE); does nothing
same for ITEMDRAW_NOTEXT and ITEMDRAW_IGNORE.
ITEMDRAW_SPACER work but it skip a number ITEMDRAW_RAWLINE|ITEMDRAW_SPACER just do fuck all like before.

So here I am requesting help for that little thing that is bugging me so hard.
Mathias. is offline
turtsmcgurts
SourceMod Donor
Join Date: Jul 2011
Old 12-08-2014 , 19:45   Re: [MENU] Spacer
Reply With Quote #2

Just taking a guess, have you tried using the newline character \n?

edit: i wouldn't say i'm expecting it to work in this scenario, just throwing it out there on the off chance.

Last edited by turtsmcgurts; 12-08-2014 at 19:46.
turtsmcgurts is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 12-08-2014 , 21:29   Re: [MENU] Spacer
Reply With Quote #3

You can always do it with a panel instead of a menu. Doing DrawPanelText(panel, " ") would create a blank line, and you can use SetPanelCurrentKey().
bl4nk is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 12-08-2014 , 23:38   Re: [MENU] Spacer
Reply With Quote #4

Unfortunately \n does not work but thx for the idea.

I need the menu feature where I can add as many items as I want (it is there for that and I don't want to reinvent the wheel) I'm sure there is a way or if not please add a fix to it, it is a really annoying issue.
Otherwise I guess I will have to reinvent the annoying wheel -.-!
PS: by the way panel function can't be use on menus it throw an error

Last edited by Mathias.; 12-08-2014 at 23:39.
Mathias. is offline
h3bus
AlliedModders Donor
Join Date: Nov 2013
Old 12-09-2014 , 06:15   Re: [MENU] Spacer
Reply With Quote #5

From https://github.com/alliedmodders/sou...Radio.cpp#L379
ITEMDRAW_SPACER | ITEMDRAW_RAWLINE should work, without skipping an item.

ITEMDRAW_RAWLINE with a displayStr = " " should have the exact same behavior.

From what i tested with panels, it works, didn't go deeper into SM code to see if Menus add another layer of logic that would break that behavior.
h3bus is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 12-09-2014 , 09:39   Re: [MENU] Spacer
Reply With Quote #6

Like I said, I tried it and it didnt work.

EDIT: just to make sure I retried ur solutions and it still dosnt work. It does work for panels but as mention I need it for menus.

Last edited by Mathias.; 12-09-2014 at 09:46.
Mathias. is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 12-09-2014 , 09:42   Re: [MENU] Spacer
Reply With Quote #7

Those have never worked on menus as far as im aware. I've tried to use them a long time ago, and never got them to work. I ended up doing " \n " (with the spaces) on the item before that you want the spacer to be. (or on the title.)
Mitchell is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 12-09-2014 , 12:05   Re: [MENU] Spacer
Reply With Quote #8

I tried on the title and no result with \n and I want the spacer between the title and items
Mathias. is offline
aexi0n
AlliedModders Donor
Join Date: Nov 2014
Location: bhop_deluxe
Old 12-09-2014 , 12:55   Re: [MENU] Spacer
Reply With Quote #9

Are you also changing the display text style in the MenuAction_DisplayItem callback? If not, the display text parameter will be completely ignored.

So for example, if you wanted the 'CHOICE3' menu item to be ITEMDRAW_RAWLINE:

Code:
AddMenuItem(menu, CHOICE1, "Choice 1");
AddMenuItem(menu, CHOICE2, "Choice 2");
AddMenuItem(menu, CHOICE3, "Choice 3", ITEMDRAW_RAWLINE);
then in the callback:

Code:
case MenuAction_DrawItem:
{
	new style;
	decl String:info[32];
	GetMenuItem(menu, param2, info, sizeof(info), style);
 
	if (StrEqual(info, CHOICE3))
	{
		return ITEMDRAW_RAWLINE;
	}
	else
	{
		return style;
	}
}
aexi0n is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 12-09-2014 , 13:45   Re: [MENU] Spacer
Reply With Quote #10

Quote:
Originally Posted by Black-Rabbit View Post
I tried on the title and no result with \n and I want the spacer between the title and items
Post your code, cause mine works just fine.
Mitchell is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode