Word wrapping.

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
DaveFaris
Beginner
Beginner
Posts: 4
Joined: Thu Oct 30, 2003 12:07 am

Word wrapping.

Post by DaveFaris »

is there a way to turn off word wrapping inside a button?

Also, is there a way to define the size of a button so that it won't change, even at the cost of other buttons scroll off the page? Ex. I have one button that I want to make 190 px across, even though the text in that button amounts to only a few px. I've marked the item with a "itemwidth=190" but if I resize the screen, the button shrinks anyway.

(If you want to see what I'm talking about, take a look at the site I'm working on at http://www.maatf.com/index3.htm and shrink the width of the window down. You'll see the first item on the horizontal menu bar ("What is MSMA?") change size. You'll also see the other buttons wrap.)

thanks for your assistance.
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

I think it's the form. The menu doesn't start moving until the right edge of the window hits the text input. Can you try putting it in a sub just to see what happens?

BTW, current is RC19 and you're running RC17. You should update (things move fast around here). Also, please don't forget to paste your license number into your code.

Thanks.
John
DaveFaris
Beginner
Beginner
Posts: 4
Joined: Thu Oct 30, 2003 12:07 am

Post by DaveFaris »

happens even if the form is subbed.
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi Dave,

This'll be my second "I-can't-sleep-so-I'll-give-a-completely-long-winded-answer" topic of the night. ;)

The text wrapping occurs for two reasons: (1) You've used menuwidth="100%" in your Top mainmenu. So, in order to maintain 100% width, the menu will adjust itself as you narrow the window, until it has no more room to shrink. Part of the adjustment it to wrap text for multi-word menu items and increase the height of the menu. (2) The text, as you noted, isn't prevented from wrapping.
is there a way to turn off word wrapping inside a button?
You can use html non-breaking spaces to prevent line breaks at certain spaces. So for your case

Code: Select all

aI("text=What is MSMA?;...
would become

Code: Select all

aI("text=What is MSMA?;...
Also, is there a way to define the size of a button so that it won't change,
Again, I think the problem here is menuwidth="100%". If the menu item is wider than it needs to be to accomodate the text, then there will be a bunch of "white space" following the text. That white space will shrink as the menu adjusts its size to maintain 100% while the window narrows.

So what can you do? I have a couple of suggestions:

(1) Make "What is MSMA" part of the Left menu instead of part of the Top menu. Then use top= and left= in both main menus to exactly position the two menus. In other words, you can still make your Top menu go where you want it, even if the first item in it is "Home".

Or...

(2) The ol' dummy menu item approach... (a) Take menuwidth="100%" out of the Top menu. That way the none of the items should shrink if the user narrows the window. But you've lost the 100% span effect. (b) To regain the 100% effect, add a "dummy" item as the last item in the Top mainmenu, as follows:

Code: Select all

aI("text= ;itemwidth=100%;onbgcolor=#FFFF00;pointer=default;");
That should make a blank, unresponsive menu item at the end of the main menu that extends the rest of the way across the screen. That item will shrink if the user narrows the window, but the other items won't! (c) With your style, you'll end up with a separator after your "Search" menu item; there is no separator there in your present setup. If that separator bugs you, there are various ways to remove it. For example, set the Search menu item's separator size to 0, like so:

Code: Select all

aI("text=Search;showmenu=search;separatorsize=0;itemwidth=90");
Let us know how you make out. Hope that helps,

Kevin
DaveFaris
Beginner
Beginner
Posts: 4
Joined: Thu Oct 30, 2003 12:07 am

Post by DaveFaris »

Wow, Kevin. Thanks! Your suggestions worked like a charm. You saved me from pulling what's left of the rest of my hair out.

Thanks again.
Dave.
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi Dave,
DaveFaris wrote:Your suggestions worked...
Glad you got it working :) . I had a look to see which suggestion you used. I realized that, in my late-night stupor, I suggested the wrong onbgcolor for the "dummy" menu item (it turns yellow right now). It really should be #288630, the same as your style's green offbgcolor, so that the background color does not change on mouseover, making it totally inactive from the user's point of view. Like so:

Code: Select all

aI("text= ;itemwidth=100%;onbgcolor=#288630;pointer=default;");
Nice touch with the Search item by the way... "Mongo like!"

Kevin
DaveFaris
Beginner
Beginner
Posts: 4
Joined: Thu Oct 30, 2003 12:07 am

Post by DaveFaris »

I suggested the wrong onbgcolor for the "dummy" menu item
Oops. That's ok. I would have caught that eventually ...

thanks. I spent about 2 hours trying to figure out why the search field insisted on taking up more vertical space than it needed. By surrounding it with <p> and </p>, though, I was able to tame it.

Thanks again.
Post Reply