How can I display images in a dialog box?
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.
Can someone please help me? I am trying to create a basic dialog that displays a static image when the user clicks the encrypted dse in my new DAZ product directory. I am obviously not adjusting the script correctly because it is not working. I can see the dialog and even title it OK. But my associated image refuses to show up.
Is there is video or specific workflow for making this happen for daz creators? I am an artist, not a programmer. But I really need to get this working so i can deliver my new product as professionally as possible.
Here is my script. What the heck am I missing here?
Please help.
Update: I still cannot see my original post. It is being "approved", as I figure(hope) this one will be also.
In any case, I can get both my image dialog scripts to work flawlessly IF I use absolute path syntax. Obviously, not everyone will use the default Daz My Library path. That means I really need the correct syntax for getting Daz to locate my image using relative path, instead.
This way works:
// Finalize the function and invoke
})( String("C:/Users/Public/Documents/DAZ 3D/My Library/People/Genesis 8 Female/Characters/Vendor/Character for Genesis 8.1/product-notes-gen8.1.png").arg( App.getResourcesPath()) );
How can i get this to work using a relative path from say the "People" directory
// Finalize the function and invoke
})( String("../People/Genesis 8 Female/Characters/Vendor/Character for Genesis 8.1/product-notes-gen8.1.png").arg( App.getResourcesPath()) );
Adding the ../ does NOT work for me.
In adding a %1, Daz considers the relative path is from its "resources" directory in Program Files.
// Finalize the function and invoke
})( String("%1product-notes-gen8.1.png").arg( App.getResourcesPath()) );
Adding the %1 equals C:/Program Files/DAZ 3D/DAZStudio4/resources/product-notes-gen8.1.png
What is the correct syntax for the relative path "People"?
Thanks!
Is the file in the folder specified by the getResourcePath() method? Don't forget that this will proabably not work with a product installed through Connect
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/file_io/file_find/start shows how to get an absolute path from a relative path, ncorporating that in the dialogue script would let you have a portable way to show the image.
No, sir. This product is intended to be installed manually. As I said, I am not a programmer. I was hoping there was a sample script that would allow small changes in specific values to allow me to use for my own product read me popup.
I would like to have the dse and png file in the same directory, and the dse just find the file and display it.
How can I change the basic image dialog script FOUND HERE to allow such a simple configuration?
Thank you for your help!
It is potentially risky but you can also use http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/script_dz#a_1aa338a2077f9a344468248ed644fe31d6 to get the path to the script, assuming it is being run from a file, then chop off the script's name to leave just the path and apend the image name for the dialogue script.
I have mashed these two sample scripts together for you
Edited to note I did not see your most recent post about relative to the script, which Richard has supplied the answer for. This example is for a path relative to the content directory, as you requested initally.
My goodness! Thank you for your gracious replies! :)