getItemWidth not working

Hi!

alert(
win.form.getItemWidth(“myText”);
);

throws an JS error:
TypeError: this.objPull[(this.idPrefix + o)][m] is not a function

Any suggestions?

Anybody can help?

hi
Please, provide us your form structure and init code part.

var data = [
			{type:"label", label:text, name:"text"}, 
			{type:"block", blockOffset:0, list:[
				{type:"button", name:"proved", width:70, value:"Ok" },
				{type:"newcolumn"},
				{type:"button", name:"cancel", width:70, value:"Abbrechen" } 
			]}
		];
		
		win.form.loadStruct(data, "json");	
		
		alert(win.form.getItemWidth("text"));

Init is:

window.dialogs = new dhtmlXWindows();
var win = window.dialogs.createWindow("dialog", 100, 100, 400, 165);
win.centerOnScreen();
win.setModal(true);		
win.setText(title);
win.form = win.attachForm();
win.button("park").hide();
win.button("minmax1").hide();

This mthod works only for “block” and “fieldset” item types, if the width is set in init.
We will add this note in documentation asap.

Ok, thanks very much.

Can i get the width of the label directly with javascript?

Could you please explain the reason for it?

Yes of course.

What i wanna do is to open a popup with a dynamic width.
The label inside the form is a text like “Do you really want to logout” or “When you click OK the dataset will be immediately be removed from database.”

As you can see the label text has a dynamic width and should define the width of the window.

Hope my english is not too bad.

Hi to all

Autoflow, have you tried dhtmlxMessage?

dhtmlx.confirm({ title: "Important!", type: "confirm-error", text: "Do you really want to logout?", callback: function(btn){ if (btn == true) { // logout code here } } })

Yes, but i would like to have to original window.
With buttons etc.

well

then create fake form. take offsetWidth of form’s parent node. add some value for window borders…

Done!
Thanks very much!