Hide the entire Menu

Please note that official support for this menu version has now ceased. There are still plenty of users, though, and the forum is still running. Some of our long-time users may be able to help you out.
Post Reply
paulm@mit-comms.co.uk
Beginner
Beginner
Posts: 4
Joined: Sun May 19, 2002 7:23 pm

Hide the entire Menu

Post by paulm@mit-comms.co.uk »

OK,

still trying to hide the menu when I click on the print Icon.......


Any idea why this does not work?


,"<img src=images/buttons/print2.gif border=0>
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Re: Hide the entire Menu

Post by Andy »

Hi,

You are not far off.

getMenuByName() returns the menu number not the object reference.

To get a reference to the menu you need to use gmobj()

Try this.

spos(gmobj("menu" getMenuByName("mainmenu")),-100,0,0)

I've tested it and it works.

Cheers
Andy
paulm@mit-comms.co.uk
Beginner
Beginner
Posts: 4
Joined: Sun May 19, 2002 7:23 pm

Re: Hide the entire Menu

Post by paulm@mit-comms.co.uk »

Ok, got this working *sweeeeeet*

Put this is the Addmenu list..... (this option is in a submenu called 'output')

,"<img src=images/buttons/print2.gif border=0>
nev
Beginner
Beginner
Posts: 3
Joined: Thu Aug 15, 2002 12:47 am

Hiding Menu

Post by nev »

Do you mean that you can hide the menu when you print the page from within IE. I would be interest to learn how to do this if this is what you meant.

Having problems positioning the menu when printing. Hiding it will solve the problem

Thanks
Nev
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

You can Show and Hide menus with this custom function.

This Hides a menu by it's name

Code: Select all

function hide_menu(mnu){
	mn=getMenuByName(mnu)
	SDiv("menu"+mn,0)
}
hide_menu("mainmenu")
This displays a menu by it's name

Code: Select all

function show_menu(mnu){
	mn=getMenuByName(mnu)
	SDiv("menu"+mn,1)
}
show_menu("mainmenu")
Hope this helps
Andy
pstarkey@cinergy.com
Beginner
Beginner
Posts: 4
Joined: Sun May 19, 2002 7:24 pm

Re: Hide the entire Menu

Post by pstarkey@cinergy.com »

Not sure how to use the function Andy showed. I use a stylesheet with a media section to hide things on pages when I print. But I can't use it with the menu.

I do not understand paulm's suggestion either - I cannot figure out where to place the option and what is your print2.gif actually? just a 1pixel x 1pixel gif effectively making it a picture of nothing?

I just want to hide the entire menu when printing.

Thanks for any help you can offer!
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,

I would assume that the functions Andy provided are meant to be incorporated into a third printing function that you provide.
I do not understand paulm's suggestion either - I cannot figure out where to place the option and what is your print2.gif actually? just a 1pixel x 1pixel gif effectively making it a picture of nothing?
It looks to me like paulm's intent was to provide a print option as one of the menu items in a larger menu. But the given example was cut off part way through; it only shows the first of five fields for a menu item definition. The .gif image was probably not a transparent gif, but rather was simply an image at the beginning of the menu item used to print the page (either that, or it was the only thing in the menu item's "Description" field, in an image-only menu). Anyway, the menu item definition might look something like this (no images used here):

Code: Select all

,"Print this page","javascript:print_page()",,,1
The javascript code to support this menu item, incorporating Andy's functions, might look like this:

Code: Select all

function hide_menu(mnu){ 
   mn=getMenuByName(mnu) 
   SDiv("menu"+mn,0) 
} 

function show_menu(mnu){ 
   mn=getMenuByName(mnu) 
   SDiv("menu"+mn,1) 
} 

function print_page()
  hide_menu("mainmenu"); // substitute the name of your main menu
  if (window.print) window.print();
  show_menu("mainmenu"); // substitute the name of your main menu
}
You might put this code at the top of your menu_array.js file, at the beginning of the "editable properties".

This is meant only to illustrate what I believe was the original idea of this thread. As it stands above, the print_page() function hides the main menu, calls the window.print method, then reshows the main menu. It may not work completely for your unique purpose... you'd want to add to the approach (perhaps in the print_page() function) anything that you normally do to prepare for printing.

Hope that helps,

Kevin
pstarkey@cinergy.com
Beginner
Beginner
Posts: 4
Joined: Sun May 19, 2002 7:24 pm

Hide the entire Menu

Post by pstarkey@cinergy.com »

Success!! Using the menu_hide and menu_show, I used the DOM window_onbeforeprint and window_onafterprint events to call the menu hide and show functions.

In the window_onbeforeprint, I called the menu_hide function and hid the main menu and in the window_onafterprint, I called the menu_show function and unhid the menu.

The nice thing about this (other than the fact that it hides the menu during print), is that the two events happen VERY fast and the menu never really disappears on the screen.
Post Reply