Help button for add on scripts?

Next
 From:  bemfarmer
10768.1 
I was thinking that it might be helpful to have a help button for an add-on script with html user interface.
The help button in the .htm or .js could pop up an alert box with a description of what the script does, and what the input parameters mean.
The help button could be a checkbox?

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10768.2 In reply to 10768.1 
Hi Brian, if the UI for your script has a little space in the upper right corner of its command options UI, you could make a help button like this:
code:
		<div style="position:absolute; right:0; top:0;">
			<moi:LabelButton onclick="moi.ui.alert('Help text here...');"><img src="moi://ui/icons/HelpIcon.png" style="width:2em;"/></moi:LabelButton>
		</div>

That will look like this:




But it won't make its own space there, it will be an overlay on top of other UI if there is something there.

You could put the button on its own line by removing the style="position:absolute; right:0; top:0;" from the above.

- Michael

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10768.3 In reply to 10768.1 
Or maybe you could set the prompt text to be left aligned instead of centered and then that could make it a little easier to give the help button its own space, something like this:

code:
<html>
	<body class="commandbody">
		<div class="commandheader" style="text-align:left; margin-bottom:0.5em;">
			<hbox style="align-items:center">
				<flex style="flex-shrink:1;">
					<div id="StartPrompt" class="commandprompt">Pick start point more text more</div>
					<div id="EndPrompt" class="hiddencommandprompt"><moi:Text textid="Line end point prompt"/></div>
				</flex>
			
				<div>
					<moi:LabelButton onclick="moi.ui.alert('Help text here...');"><img src="moi://ui/icons/HelpIcon.png" style="width:2em;"/></moi:LabelButton>
				</div>
			</hbox>
		</div>
		
		<moi:CheckButton id="bothsides"><moi:Text textid="Line both sides checkbox"/></moi:CheckButton>
	
		<moi:CommandCancel />
	</body>
</html>






  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10768.4 In reply to 10768.3 
Thanks Michael

I'll do some experimenting.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10768.5 In reply to 10768.3 
The first method to have a help "button" is OK.
The hbox and flex method is very nice.

Is there a text editor to create messages in an alert box?
In the past I have had to use /n for newline and + and '

Well, just using text, not variables, would not be too hard...

Sample code:
code:
moi.ui.alert( 'x1 = ' + x1 + ' cm' + '\n' + 'dValue = ' + dValue + ' cm' + '\n' + 'x0 = ' + x0 + ' cm' );


- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Michael Gibson
10768.6 In reply to 10768.5 
Hi Brian,

re:
> Is there a text editor to create messages in an alert box?
> In the past I have had to use /n for newline and + and '

That's the main way to do it. Sometimes it can be good to build it up in smaller chunks like

str += '...';
str += '...';

But there is also a string formatter you can use like this:
code:
var x1 = 5, dValue = 3, x0 = 8;
var msg = moi.ui.formatString( 'x1 = %1% cm\ndValue = %2% cm\nx0 = %3% cm', x1, dValue, x0 );
moi.ui.alert( msg );

So for that way you have one "template string" that contains placeholders %1% , %2%, etc.. which are replaced by the values passed after the format string.

That method reduces the amount of little fragments that the regular way uses.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All