How can I display images in a dialog box?
iwave
Posts: 46
Hello everyone.
I'm new to daz script.
I have spent a few days searching on the forum, reading the docs and examples.
The only useful class I found is DzListViewItem,which can be used to display pixmap in dialog box.
If this class is just what I need, then how should I convert an image to a pixmap?
Thanks.
Comments
An image can be loaded into a Pixmap by passing the path of the image you want to display to the constructor [or to the Pixmap::load() method after the object has been constructed]. A DzLabel can have a Pixmap set on it, and display that instead of text.
See the Simple Image Dialog sample.
-Rob
It works great!
Thank you so much for your clear and standardized coding!
I may have to remember this one.
Well it works great!
Yet I have a small issue. While playing with this to go and look for an image in any mapped content folder (which works now), I managed, god knows how, to "break" the dimensions of my "Content Directory Manager" pop up window...
Now the size of the Content Directory Manager window is vertically bigger than my screen, and I can't resize it - well I can resize it only horizontally, which is not the dimension presenting an issue.
It may be due to everything I tested in term of interface screen, maybe to the "sKey" part which I have hidden for a while (I did not know why it was important).
I'd like to repair this, but I don't know where to look for. In windows registry? In the " App data / roaming" of the application?
Thanks for any tip about this !
EDIT : FORGET ABOUT THAT, I leave it here for information, I managed to solve this in the windows registry, SOFTWARE/DAZ/Studio 4/content directory manager/ : change h value.. Well.. It is solved now!
I wrote this little method for this, to load an image and get it back as a widget to place into the Dialog.
// ==========================================
// getDialogImage method
// ==========================================
BWCRollUp.prototype.getDialogImage = function(imagename) {
var wLabel = new DzLabel( this.wDialog );
var sScriptPath = g_oFILE.path();
var sResourcePath = sScriptPath + "/REMResources/";
var sImagePath = sResourcePath + imagename;
var pixImage = new Pixmap(sImagePath);
wLabel.pixmap = pixImage;
return wLabel;
}
As an extention to this question, is there any chance someone knows whether it's possible to display images (or even change the color) for backgrounds of dialogs / group boxes?
So far all of my attempts have failed, and I was wondering if this could be due to Daz's UI theme overriding script behavior that tries to set this.
I add :)
You can scale image content. Create label with dialog size as background and place here one image. In next example I scale image content on label MyLabel.