Hide the entire Menu
-
- Beginner
- Posts: 4
- Joined: Sun May 19, 2002 7:23 pm
Hide the entire Menu
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>
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>
Re: Hide the entire Menu
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
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
-
- Beginner
- Posts: 4
- Joined: Sun May 19, 2002 7:23 pm
Re: Hide the entire Menu
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>
Put this is the Addmenu list..... (this option is in a submenu called 'output')
,"<img src=images/buttons/print2.gif border=0>
Hiding Menu
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
Having problems positioning the menu when printing. Hiding it will solve the problem
Thanks
Nev
You can Show and Hide menus with this custom function.
This Hides a menu by it's name
This displays a menu by it's name
Hope this helps
Andy
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")
Code: Select all
function show_menu(mnu){
mn=getMenuByName(mnu)
SDiv("menu"+mn,1)
}
show_menu("mainmenu")
Andy
-
- Beginner
- Posts: 4
- Joined: Sun May 19, 2002 7:24 pm
Re: Hide the entire Menu
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!
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!
Hi,
I would assume that the functions Andy provided are meant to be incorporated into a third printing function that you provide.
The javascript code to support this menu item, incorporating Andy's functions, might look like this:
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
I would assume that the functions Andy provided are meant to be incorporated into a third printing function that you provide.
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):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?
Code: Select all
,"Print this page","javascript:print_page()",,,1
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
}
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
-
- Beginner
- Posts: 4
- Joined: Sun May 19, 2002 7:24 pm
Hide the entire Menu
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.
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.