<?xml version="1.0" encoding="utf-8"?><widget minimumVersion="4.0"> <settings> <setting name="debug" value="on"/> <setting name="allowCustomObjectAttributes" value="true"/> </settings> <action trigger="onLoad"> <![CDATA[ include("preferencePane.js"); // Our id. var id = 0; // This is our window object that we will use for all examples where applicable. var main = new Window(); main.id = "preferenceWindow" + id; // This is the background we will use, just for simplicity. var background = new Image(); background.id = "preferenceTabBackground" + id background.src = "Resources/Preferences/Window/windowBackground.png"; background.window = main; // Set the positon to dead center. main.hOffset = screen.width/2 - background.width/2; main.vOffset = screen.height/2 - background.height/2; // All our code and examples will go here. // You may have to delete previous examples to accommodate new ones as we go along. // Alternatively, you could save separate files after each example. It's up to you. var tab1 = new Tab( 0, main, "RandomGroup", "Tab1", "Resources/SizePref.png", 8, 8 ); tab1.changeBackground( "Resources/Preferences/Window/windowBackgroundSmall.png" ); // Lets add a color object. var color = new Color( id, null, "colorize", "Color:", "Color my world.", "#008000", 20, 50); color.setTitle( "Me!" ); color.setDescription( "Me!" ); color.setValue("#808080"); tab1.addObject( color ); //print(color); // Do we really want to force the user to colorize it? var check = new Checkbox( id, null, "doColor", "Colorize Widget?", "Uncheck to leave default colors.", false, 20, 105) check.setTitle( "Me!" ); check.setDescription( "Me!" ); check.setValue( true ); tab1.addObject( check ); // Lets have styles. Everyone loves "skinnable Widgets". var pop = new Popup( id, null, "style", "Style:", "Choose the style of the Widget.", new Array("New","Aging","Faded","Modern","Traditional","Gaudy"), null, "Modern", 20, 150); pop.setTitle( "Me!" ); pop.setDescription( "Me!" ); pop.setValue( "New" ); tab1.addObject( pop ); // We can use a null window object since the tab will reassign it anyway. var a = new Slider( id, null, "size", "Size:", "Drag me.", ["10%","50%", "100%"], 19, 10, 100, true, 45, 20, 200); a.setTitle( "Me!" ); a.setDescription( "Me!" ); //a.setValue( 15 ); tab1.addObject( a ); var cancelAction = "widget.getElementById( \"preferenceWindow"+id+"\").visible = false;"; var saveAction = "tab1.save(); " + cancelAction; // Button one. This will save the preferences and make the object disappear. var z = new Button( id, null, "save", "Save", saveAction, 333, 280); z.setTitle( "Me!" ); z.setAction( "alert('Here');" ); tab1.addObject( z ); // Button two. This will make the object disappear, but not go away. tab1.addObject( new Button( id, null, "cancel", "Cancel", cancelAction, 408, 280) ); var tab2 = new Tab( 0, main, "MyGroup", "Tab2", "Resources/LinkPref.png", 82, 8 ); tab2.changeBackground( "Resources/Preferences/Window/windowBackgroundSmall.png" ); var b = new Selector( id, null, "customImage", "Custom Image", "open", "file", new Array(".png",".jpg"), "Pick a custom image to use.", "", "", 20, 50); b.setTitle( "Me!" ); b.setDescription( "Me!" ); b.setValue( "Go! Go!" ); tab2.addObject( b ); tab2.addObject( new Checkbox( id, null, "doCustom", "Use Custom Image?", "Uncheck to leave default image in place.", false, 20, 105) ); //tab2.addObject( new Checkbox( id, null, "ugh", "", "I am so out of ideas.", false, 20, 140) ); var c = new TextField( id, null, "ugh", "Whee!", false, "I am so out of ideas.", "...", 20, 140); c.setTitle( "Me!" ); c.setDescription( "Me!" ); c.setValue( "Go! Go!" ); c.setSecure( true ); tab2.addObject( c ); // We should add these to tab two just to be consistent. tab2.addObject( new Button( id, null, "save1", "Save", saveAction, 333, 280) ); tab2.addObject( new Button( id, null, "cancel1", "Cancel", cancelAction, 408, 280) ); //tab1.setEnabled( false ); //tab2.setEnabled( false ); // Here is one way to make a tab group. //var group1 = new TabGroup( new Array(tab1, tab2) ); var group1 = new TabGroup(); tab1.addListener( group1 ); tab2.addListener( group1 ); tab1.addActionListener( "update()" ); //tab1.setEnabled( false ); //tab2.setEnabled( false ); //tab1 = tab2; //print(tab1); function update( object ) { //print( object.getValue() ); print(object.getAction() ); } ]]> </action></widget>