MoI discussion forum
MoI discussion forum

Full Version: Organizing scripts in customui

Show messages: All  1-2  3-7

From: Barry-H
13 Oct   [#3] In reply to [#2]
Hi Michael,
the attached photo's show the issue.
The left hand script button opens the complete list of scripts as normal.
The right hand button opens new layout in a restricted width ok but when selecting a sub menu it opens it bottom right of screen.
However all the scripts that are not in the sub menu's that are not listed in dropdown there is an option to open them and they get displayed correctly.
Thanks
Barry
Ps: here are the htm's of the new fullscript and sub solid menu

Attachments:
ScriptsCategory_SOL.menu.htm
ScriptsFull.menu.htm

Image Attachments:
Existing fly out.png  New script fly out.png  Other scripts.png  Sub menu position.png 


From: Barry-H
13 Oct   [#4] In reply to [#2]
Hi Michael,
Have found away to do it using a control panel.
Many thanks
Barry
From: Michael Gibson
14 Oct   [#5] In reply to [#3]
Hi Barry, thanks for posting the screenshots and your script code.

Ok, so the sub menu opening on the bottom right of the screen is from passing moi.ui.commandBar.CommandBarCustomUI as the parent element of the menu.

The menu will show being connected to the screen rectangle of the parent element. The element you are passing, CommandBarCustomUI, is the container of all the custom buttons in the bottom command bar. You usually want to pass in the button element that is being clicked on. That will be easier to get if you use an onclick="" event handler on the <moi:MenuItem> instead of having a command="" attribute with script inside it instead of a command name.

For an onclick="" event handler you will be able to use the 'this' keyword to refer to the element that was clicked on.

Then there's an additional tricky thing which is that by default most elements will automatically dismiss the flyout they are inside when they are clicked. That will interfere with launching a sub menu coming off of another flyout menu like you want here. So you'll need to put a style property dismissFlyout:false on the MenuItem also.

So try this for making your sub-menu links:

document.write('<moi:MenuItem style="dismissFlyout:false" onclick="moi.ui.showMenu(\'moi://appdata/customui/ScriptsCategory_SOL.menu.htm\', this, 1, 0);">Solids ></moi:MenuItem>');


The 3rd and 4th arguments to moi.ui.showMenu control how the menu will attach to the parent element's rectangle.

The 3rd argument is for LaunchSide which can be 0, 1, 2, 3 The 4th argument is for LaunchDir which can be 0 or 1.

The menu connection will go like this:

LaunchSide 0 Flyout has connector at its top, expanding to the right if LaunchDir == 0 or expanding to left if LaunchDir != 0

LaunchSide 1 Flyout has a connector on its left, expanding down if LaunchDir == 0 or up if LaunchDir != 0

LaunchSide 2 Flyout has a connector on its bottom, expanding right or left

LaunchSide 3 Flyout has a connector on its right, expanding down or up.

So if you pass in LaunchSide 1, LaunchDir 0 it will make the menu with the connector on the menu's left (so to the right of the parent element), expanding down, like this example in the Options dialog under Snaps:



Hope this helps! - Michael

Image Attachments:
OptionsMenu1.png 


From: Barry-H
14 Oct   [#6] In reply to [#5]
Thanks Michael,
will try your method.
The work around I ended up with was to have a 2 column fly out menu.
Many thanks for your help.
Cheers
Barry

Image Attachments:
Screenshot (71).png 


From: Michael Gibson
14 Oct   [#7] In reply to [#6]
Hi Barry, 2 columns is probably a good idea anyway.

- Michael

Show messages: All  1-2  3-7