Custom UI feature

 From:  Michael Gibson
8979.11 In reply to 8979.10 
Hi Tim,

> 1. Is there anyway to get the window to automatically close after one of the icons has
> been clicked on? As it is at the moment, it obscures the viewing window when one of
> the icons is selected.

Yup, you'll just need to add an onclick event handler that then tells the window to close.
This can be just in one place on the body instead of on all buttons individually because of
how events "bubble up". See below for an example.


> 2. I noticed that the textid's for some of the icons is not working? I'm wondering if it is because
> of the overall size of the palette window (too small) or the textid's not being recognised by the
> software? Sometimes they seemed to work, sometimes they didn't? (Boolean icons textid's are
> a good example)

So using a <moi:Text> element with a textid value actually means "Look up the text with this
id in the current string table". It's used for text that can be translated into different languages. The
ones that are not working for you are because there is no entry with that id in the string table
(see EnglishStrings.txt for example).

If you just want to make direct plain text you don't need to use a <moi:Text> for that,
you can just use the text directly.

Here's an example with those modifications, also I organized things into rows:

code:
<html>
	<head>
		<style>
			body { 
				padding: 4px;
			}
		</style>
	</head>

	<body class="MenuBody" onclick="moiWindow.close();">
	
		<nobr>
			<moi:CommandButton icon="moi://ui/icons/TrimIcon.png" command="Trim">Trim</moi:CommandButton>
			<moi:Spacer/>
			<moi:CommandButton icon="moi://ui/icons/MirrorIcon.png" command="Mirror">Mirror</moi:CommandButton>
			<moi:Spacer/>	
			<moi:CommandButton icon="moi://ui/icons/OffsetIcon.png" command="Offset">Offset</moi:CommandButton>
		</nobr>

		<moi:MenuSeparator/>

		<nobr>
			<moi:CommandButton icon="moi://ui/icons/CPlaneIcon.png" command="script: /* CPlane */ moi.view.setCPlaneInteractive();">CPlane</moi:CommandButton>
			<moi:Spacer/>
			<moi:CommandButton icon="moi://ui/icons/CPlaneIcon.png" command="script: /* Set CPlane to current view */ moi.view.setCPlane( moi.ui.mainWindow.viewpanel.getViewport('3D').targetFrame );">View</moi:CommandButton>
			<moi:CommandButton icon="moi://ui/icons/CPlaneIcon.png" command="script: /* Reset CPlane to default */ moi.view.resetCPlane();">Reset</moi:CommandButton>
		</nobr>

		<nobr>			
			<moi:CommandButton icon="moi://ui/icons/ScaleIcon.png" command="Scale">Scale</moi:CommandButton>
			<moi:Spacer/>
			<moi:CommandButton icon="moi://ui/icons/Scale2dIcon.png" command="Scale2d">Scale 2D</moi:CommandButton>
			<moi:Spacer/>
			<moi:CommandButton icon="moi://ui/icons/Scale1dIcon.png" command="Scale1d">Scale 1D</moi:CommandButton>
		</nobr>

		<moi:MenuSeparator/>

		<nobr>
			<moi:CommandButton icon="moi://ui/icons/BooleanDifferenceIcon.png" command="BooleanDifference">Diff</moi:CommandButton>
			<moi:Spacer/>
			<moi:CommandButton icon="moi://ui/icons/BooleanUnionIcon.png" command="BooleanUnion">Union</moi:CommandButton>
			<moi:Spacer/>
			<moi:CommandButton icon="moi://ui/icons/BooleanIntersectionIcon.png" command="BooleanIntersection">Isect</moi:CommandButton>
			<moi:Spacer/>
			<moi:CommandButton icon="moi://ui/icons/BooleanMergeIcon.png" command="BooleanMerge">Merge</moi:CommandButton>
		</nobr>
	
	</body>
</html>



Hope that helps!

- Michael