Appframe Knowledge Base


1 hits
0

How to create a buttonbar

/*
Buttonbar control settings:
container: null, // Container to attach to on initialization (optional)
initialize: true, // Initialize now
dock: "bottom", // specify where to dock (top or bottom)
type: "normal", // normal or slim (35px or
localize: false, // localize inputted strings automatically
definition: null // Array of button definitions (required before initialize):

Definition settings:
id: "someUniqueID", // (optional) if you need to name the button for some reason (we use this for PLUpload's shim)
type: "button", // "button", "label" or "custom" (will ignore "highlight" and "click" attributes when "custom")
text: "Close", // Will only be used when type is "button" or "label"
className: null, // when set, this class will be applied to the button (only applies for type button)
icon: false, // when true, a span will be prepended in addition to the text (use class to specify icon, only works for type button)
position: "left", // left/right/center
highlight: true, // true/false - true will make a hilighted button
display: true, // false to have button be hidden on init
disabled: false, // true to have button be disabled on init
custom: null, // html string, selector, or element to attach
click: function () { this.close(); }
*/

//Create buttonbar
var vButtonBar = new af.controls.ButtonBar({
	definition: [
		{ text: "OK", highlight: true, click: onOK },
		{ text: "Cancel", click: onCancel }
	]
});
//will return a buttonBar that has an Ok and Cancel button which will trigger functions onOk/onCancel when clicked
//Attach the buttonBar to your dialog
dlgMyDialog.setButtonBar(vButtonBar);

//Optionally you can define and set a buttonbar definition object directly on the dialog instead
dlgMyDialog.setButtonBar([
	{ text: "OK", highlight: true, click: onOK },
	{ text: "Cancel", click: onCancel }
]);

web · Perma link post comment Posted by: Øystein Kaldestad (12-apr-2013)