PDA

View Full Version : basic dialog



Alidad
22 Dec 2006, 6:23 PM
I recently finish my own sample hello world basic dialog, when click that button is expand in the middle, i like to change the position to move location to down middle, how can i write code on that!

which file do i need to change code for location!

alidad

jack.slocum
23 Dec 2006, 4:17 AM
You can pass the x and y in your config or you can call moveTo(x, y).

Check http://www.yui-ext.com/docs/ where these methods (and others) are documented.

amitgh
21 Nov 2008, 7:22 AM
Hi Jack,
I am using yui basic dialog and on clicking complete button each time my dialog moves up. How can i fix this prob? Plz help...

this is my code


//var flagForSave = 0; //This variable is used as indication whether any report is been saved as complete
//var flagToKnowIfNewSaveAgain = "no";


YAHOO.namespace("example.container");


function init() {

// Define various event handlers for Dialog

var handleYes = function() {
var choice="draft";
savereport(choice,flagToKnowIfNewSaveAgain);
if(flagForSave == 1){// This is again if the cycle of save happens after complete

YAHOO.example.container.simpledialog1.setBody("Please select your Choice !");
flagToKnowIfNewSaveAgain = "no";
flagForSave = 0;
}
this.hide();
};
var handleNo = function() {
YAHOO.example.container.simpledialog1.setBody("This report will be stored as a new Report.Please Enter your choice?");
var choice="final";
savereport(choice,flagToKnowIfNewSaveAgain);
if(flagForSave == 0){
flagForSave = 1;// Means report is saved as complete once
flagToKnowIfNewSaveAgain = "yes";
}
this.hide();
};

var cancel1 = function(){
this.hide();
};

// Instantiate the Dialog
YAHOO.example.container.simpledialog1 = new YAHOO.widget.SimpleDialog("simpledialog1",
{ width: "300px",
fixedcenter: true,
visible: false,
draggable: false,
zIndex: 15000,
modal: true,
close: true,
text: "Please select your Choice !",
icon: YAHOO.widget.SimpleDialog.ICON_HELP,
constraintoviewport: true,
buttons: [ { text:"As Draft", handler:handleYes, isDefault:false },
{ text:"Complete", handler:handleNo },
{ text:"Cancel", handler:cancel1} ]
} );
YAHOO.example.container.simpledialog1.setHeader("How would you like to save the Report?");


// Render the Dialog
YAHOO.example.container.simpledialog1.render(document.body);

YAHOO.util.Event.addListener("show", "click", YAHOO.example.container.simpledialog1.show, YAHOO.example.container.simpledialog1, true);
//YAHOO.util.Event.addListener("hide", "click", YAHOO.example.container.simpledialog1.hide, YAHOO.example.container.simpledialog1, true);


}


YAHOO.util.Event.addListener(window, "load", init);