How can I display images in a dialog box?

iwaveiwave Posts: 46
edited December 1969 in Daz Script Developer Discussion

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

  • rbtwhizrbtwhiz Posts: 2,250
    edited October 2015

    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

    Post edited by rbtwhiz on
  • iwaveiwave Posts: 46
    edited December 1969

    It works great!
    Thank you so much for your clear and standardized coding!

  • Eustace ScrubbEustace Scrubb Posts: 2,698
    edited December 1969

    I may have to remember this one.

  • V3DigitimesV3Digitimes Posts: 3,150
    edited October 2015

    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!

    Post edited by V3Digitimes on
  • TotteTotte Posts: 13,965
    edited July 2016

    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;

    }


    Post edited by Totte on
  • 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.

  • YudinEdYudinEd Posts: 90
    edited March 2017

     

     someone knows whether it's possible to display images (or even change the color) for backgrounds of dialogs 

    var Dlg = new DzDialog;var pixImage = new Pixmap("c:/img.jpg");Dlg.paletteBackgroundPixmap = pixImage;	Dlg.exec()

     

    var Dlg = new DzDialog;Dlg.paletteBackgroundColor = new Color( 66,99,99 );//or can use for colors - new Color("dark red")Dlg.exec()

     

    Post edited by YudinEd on
  • YudinEdYudinEd Posts: 90
    edited April 2017

    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. 

    MyLabel.scaledContents=pixImage

     

    Post edited by YudinEd on
Sign In or Register to comment.