MoI discussion forum
MoI discussion forum

Full Version: Custom UI feature

Show messages: All  1-10  11-12

From: Michael Gibson
1 Jul 2018   [#11] In reply to [#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
From: Whiteman Dynamic (TIM_WHITEMAN)
2 Jul 2018   [#12] In reply to [#11]
Hi Michael,

Wow! Thank you very much for so kindly sharing your time, effort and experience; I am most grateful and learned something useful too!

Really cool of you to correct and improve the code for me, thanks again, it works perfectly!

I love how effortless the simple UI UX of MoI is and often find myself wishing other software were as simple but extremely effective. I even use MoI to do vector work rather than Illustrator, because it is so quick and effortless to achieve the same results.

I think you have definitely done the right thing to insist on the simplicity of MoI first and foremost. Of course different users are going to want different functionality, but you’re right to choose to keep it simple instead.

Have a great day!

Kind regards,

Tim

Show messages: All  1-10  11-12