Space and/or title between dialog elements?

Hi.

This probably will sound too basic, but I can`t seem to find out how to do it.

 

I have a dialog box with a slider and two buttons and they all have a common function. It all works and thought that was going to be the ticky part.

Now I`d like to include the same three elements doing another similar fuction, but separated by a tittle or at least a space between them to avoid confussion. Something like this:

 

    Title 1

---------------

[    ]     [    ]

 

   Title 2

---------------

[    ]     [    ]

 

I only managed to add text, but it ended covering the slider.

I would appreciate some tips for this. smiley

Comments

  • Cayman StudiosCayman Studios Posts: 1,135
    edited May 2017

    You use setGeometry (x,y,width,height) on the widgets to set their position and size.

    var wSet = new DzDialog;var wHeaderLabel = new DzLabel( wSet );var wSlider = new DzIntSlider( wSet );var wSliderLabel = new DzLabel( wSet );var wOKButton = new DzPushButton( wSet );var wCancelButton = new DzPushButton( wSet );var sDialogTitle = "Dialog Title Goes Here";wSet.caption = sDialogTitle;wSet.setFixedSize(380,160);wHeaderLabel.text = "HEADER Label";wHeaderLabel.setGeometry( 10,15,80,20 );wSlider.setGeometry( 80,40,300,20 );wSlider.min = 0;wSlider.max = 10;wSlider.clamped = true;wSliderLabel.text = "Slider Label: ";wSliderLabel.setGeometry( 10,40,70,20 );wOKButton.text = "OK";wOKButton.setGeometry( 80,100,80,25 );wOKButton.autoDefault = true;wCancelButton.text = "Cancel";wCancelButton.setGeometry( 200,100,80,25 );function CancelSet() {	wSet.close();}connect( wCancelButton, "clicked()", CancelSet );wSet.exec();

     

    Post edited by Cayman Studios on
  • SotoSoto Posts: 1,440

    Thank you! I ended doing something similar to what I wanted with margin and space, but knowing how to do it this way is much better and just what I wanted. :)

     

    How do people learn to code for DAZ Studio? Is the code based on something else and people have prior experience with that? Because I am trying to catch up with what I read in the documentation center and the forums and I`m making progress, but I fail to find a begginers explanation on how things work.

     

    Well thanks again for the example, it will come in handy for sure!

  • Richard HaseltineRichard Haseltine Posts: 100,941
    edited May 2017

    Be aware that using explicit pixel sizes like that (the setGeometry calls) could be problematic as DS is developed to handle UI scaling for high DPI displays and the like, something we know is being worked on.

    Post edited by Richard Haseltine on
  • Cayman StudiosCayman Studios Posts: 1,135

    Be aware that using explicit pixel sizes like that (the setGeometry calls) could be problematic as DS is developed to handle UI scaling for high DPI displays and the like, something we know is being worked on.

    Would this be a problem even if each widget had the pixel measurements?  Surely in that case all errors would be relative and thus cancel each other out.

  • Richard HaseltineRichard Haseltine Posts: 100,941

    Be aware that using explicit pixel sizes like that (the setGeometry calls) could be problematic as DS is developed to handle UI scaling for high DPI displays and the like, something we know is being worked on.

    Would this be a problem even if each widget had the pixel measurements?  Surely in that case all errors would be relative and thus cancel each other out.

    I don't know, since I don't have access to the development builds being used for this, but it depends - can you adjust fonts to fit the sized widgets? If not then you risk clipping the text of any labels. Even if you can be sure that everything will fit, it still risks the dialogue seeming microscopic relative to the rest of the UI.

  • Cayman StudiosCayman Studios Posts: 1,135
    edited May 2017

    Be aware that using explicit pixel sizes like that (the setGeometry calls) could be problematic as DS is developed to handle UI scaling for high DPI displays and the like, something we know is being worked on.

    Would this be a problem even if each widget had the pixel measurements?  Surely in that case all errors would be relative and thus cancel each other out.

    I don't know, since I don't have access to the development builds being used for this, but it depends - can you adjust fonts to fit the sized widgets? If not then you risk clipping the text of any labels. Even if you can be sure that everything will fit, it still risks the dialogue seeming microscopic relative to the rest of the UI.

    Well, there is a PixelSize property for Font, and font is a property for DzWidget, so maybe that's the solution - if it's a problem.

    Post edited by Cayman Studios on
  • Richard HaseltineRichard Haseltine Posts: 100,941

    Be aware that using explicit pixel sizes like that (the setGeometry calls) could be problematic as DS is developed to handle UI scaling for high DPI displays and the like, something we know is being worked on.

    Would this be a problem even if each widget had the pixel measurements?  Surely in that case all errors would be relative and thus cancel each other out.

    I don't know, since I don't have access to the development builds being used for this, but it depends - can you adjust fonts to fit the sized widgets? If not then you risk clipping the text of any labels. Even if you can be sure that everything will fit, it still risks the dialogue seeming microscopic relative to the rest of the UI.

    Well, there is a PixelSize property for Font, and font is a property for DzWidget, so maybe that's the solution - if it's a problem.

    The warning about using those methods came from Rob.

Sign In or Register to comment.