Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Will on Sep 29, 2009 13:59
open dhtmlx forum
dhtmlxWindows attachEvent Help

I cannot get any attachEvent call to fire, I have tried both onContentLoaded, onShow, etc.
Code snippet below:

function dialog_show_error(err_text)
{
var winId = "diag_error_display";
var win = dhxLayout.dhxWins.createWindow(winId, 0, 0, 400, 200);
win.setText("An Error Has Occured");
win.denyResize();
win.button("park").disable();
win.center();
win.setModal(true);

dhxLayout.dhxWins.window(winId).attachEvent("onContentLoaded",function(win){

alert("Hello");

});

win.attachURL("/cp/inc/dialog/diag.error.php?error_text="+escape(err_text), true);
}
Answer posted by Support on Sep 30, 2009 01:54
Please try the following:

dhxLayout.dhxWins.attachEvent("onContentLoaded",function(win){
alert("Hello");
});
Answer posted by Will on Sep 30, 2009 07:48
This has corrected the issue (the event fires now)...
So am I to understand that when using the dhxLayout loaded version of dhxWins you cannot attach individual events to a window then?

Along those same lines, I cannot get custom icons to show for a window either (using full and relative paths):

    var win = dhxLayout.dhxWins.createWindow(winId, 0, 0, 400, 200);
    win.setIcon("http://cms.local/_media/ico/16x16/tb/Close.png", "http://cms.local/_media/ico/16x16/tb/Close.png");

-or-

    var win = dhxLayout.dhxWins.createWindow(winId, 0, 0, 400, 200);
    win.setIcon("/_media/ico/16x16/tb/Close.png", "/_media/ico/16x16/tb/Close.png");

The default icon is removed, but the image will not show up, just a blank spot where the icon should be.
Answer posted by Will on Sep 30, 2009 10:11
Answered my own question on the Icon issue.
Using the getIcon() function after setIcon() i see that it is just appending the setIcon() parameter to the end of the Image Directory string, so i guess only images under the setImagePath() directory can be assigned.