Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ben C on Mar 23, 2009 12:24
open dhtmlx forum
attachToolbar skin

Is there any way to change the skin of a toolbar when that toolbar is created from a layout or window object? Basically, I have a window object upon which I call:

myWindow1ToolBar = myWin.window("myWindow1").attachToolbar();

After this call, the myWindow1ToolBar is a toolbar object that inherits its skin from the window object. Is there any way that I can change the skin of the myWindow1ToolBar after creation?

I want this toolbar to have a different skin (dhx_customblue) while keeping the other toolbars on the page skinned with dhx_blue.

Thanks!
Answer posted by Alex (support) on Mar 24, 2009 05:01

You can set the necessary skin directly in the dhtmlxwindows_wtb.js.

Please, try to set the necessary skin name instead of the this.skin in the following line:

win.toolbar = new dhtmlXToolbarObject(win._toolbarId, this.skin); 

Answer posted by Ben C on Mar 24, 2009 07:45
Yeah, I found that but I don't know if I want to hardcode it directly in the module.  I suppose I could make the edit in a copied module and import that one when I need it.  Still not the best solution though.  It'd be nice if attachToolbar could take a skin.  For that matter, any of the attach_____() functions (toolbar, layout, menu, window, etc.) should be able to take a skin in any of the modules (layout, window, etc).

~Ben


Answer posted by Alex (support) on Mar 24, 2009 08:09

You can add the tskin (toolbar skin) property to the window.

The modification in the dhtmlxwindows_wtb.js:

win.toolbar = new dhtmlXToolbarObject(win._toolbarId, this.tskin?this.tskin:this.skin);

instead of

win.toolbar = new dhtmlXToolbarObject(win._toolbarId, this.skin);

And then in the script:

var dhxWins = new dhtmlXWindows();

...

dhxWins.tskin = "custom";
 var toolbar = w1.attachToolbar();

Answer posted by Ben C on Apr 01, 2009 09:41
Thanks, that worked.  Now, what's the equivalent modification for a toolbar attached to an dhtmlxAccordion?

~Ben
Answer posted by Alex (support) on Apr 01, 2009 23:53

The following approach can be applied with the provided modification in the dhtmlxwindows_wtb.js file:

...

dhxAccord.dhxWins.tskin = "custom";
var toolbar = dhxAccord.cells(itemId).attachToolbar();