Sg2.9
ADM
Recent RSS
ADM
From:  Pedro
Date:  1. August 2006, 20:05

greetings

i'm almost done with the wallblazer-script. for those who remember it from the old scriptographer, the new version is much more advanced than before! (i.e. you can now apply the script to a shape and set random values for the length of the generated "wall".)

BUT now i stumbled upon the adm-reference. i din't know that it was possible to make such advanced dialog-boxes... so i was trying to figure out how they work and what parts i need, but i'm quite lost. is there any template or example of a dialog that is a little more advanced than just description, value, type,...?

i'm especially looking for checkboxes and the ability to write a longer description into the dialog-box.

i've seen some slider-stuff and some floating.dialog stuff in the ribbon.js script, and that was quite helpful to get an idea of what is possible... but i need more ;-)

so if anyone has some codesnipplet, it would be great!
pedro

Re: ADM
Date:  2. August 2006, 11:49

No checkboxes, but here's a way to show a list of system fonts. When you select one, it's weights are shown in the second pulldown (complete dialog code below):

ADM code that does the fonts thing

var whichfontList = new PopupList(dialog);

whichfontList.add(fonts[0].name).selected = true;
for(i=1; fonts.length>i; i++){
	if(fonts[i].name=="Verdana"){
		whichfontList.add(fonts[i].name).selected=true;
	}else{
		whichfontList.add(fonts[i].name);
	}
}
whichfontList.setBounds(10, fontsY-3, 100, 20);

whichfontList.onDraw=function(){
	whichweightsList.removeAll();
	whichweightsList.add(fonts[whichfontList.activeEntry.text][0].name).selected=true;
	for(i=1; fonts[whichfontList.activeEntry.text].length>i; i++){
		whichweightsList.add(fonts[whichfontList.activeEntry.text][i].name);
	}
}

var whichweightsList = new PopupList(dialog);
whichweightsList.add(fonts["Verdana"][0].name).selected = true;
for(i=1; fonts["Verdana"].length>i; i++){
	whichweightsList.add(fonts["Verdana"][i].name);
}
whichweightsList.setBounds(10, 20, 100, 20);

Complete dialog code:

var dialog = new FloatingDialog(FloatingDialog.OPTION_TABBED);
dialog.setTitle("Rotational Text Placer");

var thewordTextedit = new TextEdit(dialog,TextEdit.OPTION_MULTILINE);
thewordTextedit.setBounds(8, 13, 200, 5*20);
thewordTextedit.text="Placing words = FUN!";
thewordTextedit.setMaxLength(9000)

var thewordButton = new Button(dialog);
thewordButton.setText("Refresh Text");
thewordButton.setSize(thewordButton.bestSize);
thewordButton.setLocation(127,114);
thewordButton.onClick = function(){
	splitText();
}

var thewordFrame=new Frame(dialog);
thewordFrame.setText("Text");
thewordFrame.setSize(210,140);
thewordFrame.setLocation(3, 0);

var fontsY=142;

var thefontFrame=new Frame(dialog);
thefontFrame.setText("Font");
thefontFrame.setSize(210,60);
thefontFrame.setLocation(3, fontsY);

var wordsList = new PopupList(dialog);
wordsList.setBounds(10, 117, 100, 20);

wordsList.onDraw=function(){
	if(wordsList.length>0) count=wordsList.activeEntry.index-1;
}

var fontsY=fontsY+16;

var whichweightsList = new PopupList(dialog);
whichweightsList.add(fonts["Verdana"][0].name).selected = true;
for(i=1; fonts["Verdana"].length>i; i++){
	whichweightsList.add(fonts["Verdana"][i].name);
}
whichweightsList.setBounds(10, fontsY+20, 100, 20);



var whichfontList = new PopupList(dialog);
whichfontList.add(fonts[0].name).selected = true;
for(i=1; fonts.length>i; i++){
	if(fonts[i].name=="Verdana"){
		whichfontList.add(fonts[i].name).selected=true;
	}else{
		whichfontList.add(fonts[i].name);
	}
}
whichfontList.setBounds(10, fontsY-3, 100, 20);
whichfontList.onDraw=function(){
	whichweightsList.removeAll();
	whichweightsList.add(fonts[whichfontList.activeEntry.text][0].name).selected=true;
	for(i=1; fonts[whichfontList.activeEntry.text].length>i; i++){
		whichweightsList.add(fonts[whichfontList.activeEntry.text][i].name);
	}
}


var theFontSize = new Static(dialog);
theFontSize.setText("Size:");
theFontSize.setSize(theFontSize.bestSize);
theFontSize.setLocation(whichfontList.bounds.maxX+10, fontsY);


var theFontSizeField = new TextEdit(dialog);
theFontSizeField.setBounds(theFontSize.bounds.maxX, fontsY-3, 50, 20);
theFontSizeField.text="20";

var setimageText = new Static(dialog);
setimageText.setText("www.jonathanpuckey.com 2006");
setimageText.setSize(setimageText.bestSize);
setimageText.setLocation(12, 210);

var helpButton = new Button(dialog);
helpButton.setText("Help");
helpButton.setSize(helpButton.bestSize);
helpButton.setLocation(162,205);
helpButton.onClick = function(){
	Dialog.alert("While the mouse is down:nnPress Shift to set a new rotation pointnPress Option to place a wordnPress Alt and drag the mouse horizontally to change the size of the text");
}

dialog.setSize(216, 230);
dialog.setVisible(true);
dialog.onClose = function() {
        this.destroy();
}

Which produces:

Re: ADM
From:  Pedro
Date:  2. August 2006, 12:49

sweetness! thanks a lot you two!
this really should help me :)

Re: ADM
From:  Pedro
Date:  2. August 2006, 17:49

much better :)
thanks!

Re: ADM
From:  Jürg Lehni
Date:  3. August 2006, 14:48

I really should explain how the ADM stuff works... If only I got some time at hands... But good to see you find your way around without me ;)

Re: ADM
From:  Jürg Lehni
Date:  3. August 2006, 17:11

Yes, there is. As an example you can look at MainDialog.java. Scriptographer uses a wrapper class called ItemContainer that then can use normal Java AWT Layout managers.

In MainDialog, both a BorderLayout and a FlowLayout are used.

AboutDialog.java shows a use of the more flexible TableLayout.

Re: ADM
Date:  5. August 2006, 14:21

I was going to ask how to use the popupMenu, since my attempts kept erroring out. But as always with questions, you've answered them before you've asked them:

var dialog = new FloatingDialog(FloatingDialog.OPTION_TABBED);
dialog.setTitle("Popup Menu");

var pMenu=dialog.popupMenu;

var test = new ListEntry(pMenu)
test.setText("Test")
test.onClick=function(){
	print("clicked on test")
}

pMenu.visible=true;

dialog.setSize(200, 50);
dialog.setVisible(true);
dialog.onClose = function() {
        this.destroy();
}
Re: ADM
From:  graf salamander
Date:  6. August 2006, 20:36

Thanks for all these examples, they were very usefull to me, but now, i've a question about events.
Is there something like an 'onChange' event for 'ValueItems' like 'SpinEdit'?

Re: ADM
Date:  20. August 2006, 20:46
Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Transform Each 08.01.12