# How to make a white menu with black letters?



## Mike Greene (Nov 10, 2011)

I've tried doing this with _hide_part($menu,$HIDE_PART_BG),_ figuring I'd draw the white background on my wallpaper and change the font to black, using _set_control_par(get_ui_id($menu),$CONTROL_PAR_FONT_TYPE,16)._ But as the ksp manual suggests, $HIDE_PART_BG only works for knobs, labels, value edits, and tables.

So then I tried the more drastic _set_control_par ( <$menu>, $CONTROL_PAR_HIDE, $HIDE_WHOLE_CONTROL)_ to hide the entire menu (including the font,) then use a ui_label with hidden background to display the current menu selection. Kind of a PIA, what with a label overlapping a menu, but I thought it would work.

The problem is that with the $HIDE_WHOLE_CONTROL option, not only is the menu hidden, but when you click where it's hiding (I assume the position is still there?) nothing comes up. In other words, it seems that "Hide" means disappear completely, as opposed to just being invisible.

I've seen a number of other libraries with menus in all sorts of different colors besides the gray with white letters. How the heck are they doing this???


----------



## polypx (Nov 10, 2011)

set_control_par_str(get_ui_id($My_Menu), $CONTROL_PAR_PICTURE, "transparent_graphic")


----------



## Mike Greene (Nov 10, 2011)

I'm not quite following. Would I use that command instead of the hide commands, or in addition?

And is "transparent graphic" a jpg, or an actual command? If it's a jpg, I'm not sure about the transparent part. Wouldn't a menu/button/label (basically just a rectangle) not need a transparent layer? Or are you thinking transparent because of the rounded corners?


----------



## sbkp (Nov 10, 2011)

I don't know anything about UI design in Kontakt. But JPGs don't do transparency. Can you use a PNG file?


----------



## Mike Greene (Nov 10, 2011)

Okay, I got it now. All I had to do was add Dan's _set_control_par_str_ command. No need for "Hide" or any of that. (My first time using pictures, by the way. I had hoped I could keep all my graphics in the wallpaper.)

Stefan, you're right about png images. Kontakt insists on them. No transparent stuff for me anyway, though. I can barely figure out how to make a plain old rectangle. :mrgreen: 

Thanks guys! 8)


----------



## polypx (Nov 11, 2011)

Mike,

I often just use a transparent PNG for my menu, and leave the actual "menu graphic" as part of the wallpaper. Making a transparent rectangle is just as easy as a white one, and you only have to make it once. 

cheers, Dan


----------



## Mike Greene (Nov 11, 2011)

polypx @ Fri Nov 11 said:


> Making a transparent rectangle is just as easy as a white one . . .


And truth be told, what I really wanted was something a little fancier than white. It's just that white is what I would have settled for. With a transparent menu, I'll have what I really wanted in the wallpaper, so this is perfect.

It does feel weird to make a Photoshop project that's just a box with . . . nothing! Just the base layer with opacity at zero. Weird, but it works! 8) 

Is it just my imagination, or does the size of this graphic supercede the size I specify for the ui_menu? My png is 100 pixels wide, which is my preferred menu size, but as an experiment, I expanded the ui_menu to 200 pixels wide, using set_control_par (get_ui_id ($menu), $CONTROL_PAR_WIDTH, 200). Yet the ui_menu remains at 100 pixels wide.

Whether I put this 200 pixel command before or after my "Use png" command, the size of the ui_menu remains at 100 pixels. (My png is purple for testing purposes, so I can see for sure what's happening.) In the text doc, I do have the vertical and horizontal resizes set to "yes," but that doesn't seem to matter. Not a huge deal since I can easily make the png the right size anyway, but it is odd.


----------



## polypx (Nov 13, 2011)

Mike, 

I also find I have to make menu graphics the right size. I can't seem to resize them either.

Also I've noticed that with switch or button graphics, I need to set the size 1 pixel bigger in KSP than the actual size of the graphic to get it to display correctly. 

None of those things a big deal, just the ins and outs of KSP wierdness.

cheers, Dan


----------



## mk282 (Nov 14, 2011)

If you can't resize the menu graphics, it means that you didn't set the horizontal/vertical resizing to "yes" in the .txt file for that image. Of course, in that case you would want to define all Fixed Top/Bottom/Left/Right values so that the menu button resizes propertly. My menus resize just fine 


For example, Kontakt's default graphic for buttons and menus resizes HORRIBLY, because NI didn't set those Fixed T/B/L/R values at all. I fixed that. I attached the corrected image. Try using this graphic for ui_menu, then resize it. You will see that it will work


----------



## mk282 (Nov 14, 2011)

Mike Greene @ 11.11.2011 said:


> And is "transparent graphic" a jpg, or an actual command? If it's a jpg, I'm not sure about the transparent part. Wouldn't a menu/button/label (basically just a rectangle) not need a transparent layer? Or are you thinking transparent because of the rounded corners?



Kontakt does NOT support JPG for custom graphics, please remember this. PNG, PNG, PNG. And polypx meant on having an image that's 100% transparent, so that the background shows.


----------



## polypx (Nov 14, 2011)

MK, what exactly ARE the fixed Top, Bottom, Left, and Right values? I see you have them set to 8, 7, 3, 3 for that button, but that's definitely not the original pixel values, so I don't understand what they are.

Thanks tho!


----------



## Mike Greene (Nov 14, 2011)

mk282 @ Mon Nov 14 said:


> Kontakt does NOT support JPG for custom graphics, please remember this. PNG, PNG, PNG. And polypx meant on having an image that's 100% transparent, so that the background shows.


Yeah, png instead of jpg was something I had to learn real fast. :mrgreen: The transparent stuff has been surprisingly easy, by the way. I guess it's like a lot of stuff - it's intimidating if you've never tried it, but once you get started, it seems sorta obvious.

One other thought about the text docs - While I was searching some old threads for clues on why an animated button I had wouldn't animate, I saw someone say that the associated txt doc needs to have a blank line at the end. (In other words, hit <RETURN> after _Fixed Right: 0_) Talk about key information that I don't see anywhere in the manual! I struggled for hours until I finally saw that post.


----------



## mk282 (Nov 14, 2011)

polypx @ 14.11.2011 said:


> MK, what exactly ARE the fixed Top, Bottom, Left, and Right values? I see you have them set to 8, 7, 3, 3 for that button, but that's definitely not the original pixel values, so I don't understand what they are.
> 
> Thanks tho!



These four values create a virtual rectangle within the image, which means "do not repeat the pixels outside this rectangle when the graphic is resized in Kontakt". This is great if you have embellished button edges, shadows, gradients only on some parts of the button, for example. If you try to resize the factory button, you will notice it won't resize correctly because NI didn't set the correct fixed edge values internally. LOL.


----------

