dhtmlxWindows attach object

DHTMLX 3, Firefox & Chromium browsers.

It appears the a Window can attach to an object only once. If the window is closed and then re-opened it doesn’t attach to the object again.

[code]


function myWindow(){
w1 = dhxWins.createWindow(“w1”, 100, 20, 400, 300);
w1.attachObject(‘divobject’);

}

Call myWindow() // divobject attaches
other stuff
close window
more stuff
Call myWindow() // // divobject does not attach[/code]
Is there a solution to this?

Hello
Close() window destroys this window and detach it from its container.
You can hide() this window on closing and show() via some other command/event you need:

w1.attachEvent("onClose", function(win){ w1.hide(); });

Then I suppose one can test that the window “w1” has been created and in a hidden state?

Consider, that one opens a window on demand and then hides it after use - only to open (Show) it again later.

[code] var dhxWins, w1;

function doOnLoad() {

dhxWins = new dhtmlXWindows();
dhxWins.enableAutoViewport(false);
dhxWins.attachViewportTo(document.body);
dhxWins.setImagePath(“codebase/imgs/”);
}

Bring up a window - show it if it exists otherwise create it.

function taskForm(id){

if (dhxWins.isWindow("w1")){
  alert ('Window exists');
  w1.show();
} else {
  w1 = dhxWins.createWindow("w1", 150, 20, 600, 700);
  w1.setText("Task edit/entry: " + id);
  myBar = w1.attachToolbar();
  ...

Do stuff in w1

w1.hide()
}
[/code]

The test for existence didn’t work for me. What is needed to confirm that the window has previously been created.

Here is a sample for you. Please, check it
14.05.30.zip (33.8 KB)

Fairly typical response that I’ve seen many times. Create the window on load then hide. My question was creating the window on demand (which may or may not occur) and then hide it after being done with it for the time being. When the window is needed again in the future show the window.

Hi to all

not sure what the problem is, please check attached demo with two modes (destruct vs hide)
97.ZIP (34.2 KB)

Jeez mate! Such an elegant documented solution that describes and illustrates so much more than what can be gleaned out of ‘standard’ API/Method documentation.