script for DzTabWidget

 I've found a script  for DzTabWidget. Perhaps it is required someone.

 wDlg = new DzDialog;

wTabStack = new DzTabWidget( wDlg );

wOptionPage = new DzVGroupBox( wTabStack );

wPrefsPage = new DzVGroupBox( wTabStack );

var wDlgLayout = new DzGridLayout( wDlg );

wDlgLayout.addMultiCellWidget( wTabStack, 0, 1, 0, 0 );

var wDlgBtnsGB = new DzGroupBox( wDlg );

wDlgBtnsGB.flat = true;

var wDlgBtnsLyt = new DzGridLayout( wDlgBtnsGB );

wDlgBtnsLyt.setColStretch( 1, 1 );

wDlgLayout.addMultiCellWidget( wDlgBtnsGB,1, 1,0, 0 );

wOptionPage.flat = true;

wTabStack.addTab( wOptionPage, "1 page" );

wPrefsPage.flat = true;

wTabStack.addTab( wPrefsPage, "2 page" );

wDlg.maxWidth = wDlg.minWidth;

wDlg.maxHeight = wDlg.minHeight;

wDlg.exec()

Comments

  • Richard HaseltineRichard Haseltine Posts: 100,749
    edited March 2016

    If that's found, did the source give permission to post? If it did you should still give the source.

    Although that displays the tabs, I think (very hazy recollection) that in order to get itt o do anything useful you need code to populate each of the tabs with controls, and you need a function connected to the currentChanged signal for the widget to handle drawing the right set of controls.

    Post edited by Richard Haseltine on
  • YudinEdYudinEd Posts: 90

    :) It's DAZ Script API  ( see please here examples for v3.x version). http://docs.daz3d.com/doku.php/public/software/dazstudio/3/start

    Although that displays the tabs, I think (very hazy recollection) that in order to get itt o do anything useful you need code to populate each of the tabs with controls, and you need a function connected to the currentChanged signal for the widget to handle drawing the right set of controls.

    This is clear and I have no problem with this.
    But this script can be used even in this form using different GroupBoxes for different Pages. Script is working...:)

  • YudinEdYudinEd Posts: 90

    wDlg = new DzDialog;

    wTabStack = new DzTabWidget( wDlg );

    wOptionPage = new DzVGroupBox( wTabStack );

    var wEdit1 = new DzLineEdit( wOptionPage );

    wEdit1.text = "Is it working?";

    wPrefsPage = new DzVGroupBox( wTabStack );

    var wEdit2 = new DzLineEdit( wPrefsPage );

    wEdit2.text = "Yes, it's working";

    var wDlgLayout = new DzGridLayout( wDlg );

    wDlgLayout.addMultiCellWidget( wTabStack, 0, 1, 0, 0 );

    var page1=wTabStack.addTab( wOptionPage, "1 page" );

    var page2=wTabStack.addTab( wPrefsPage, "2 page" );

    wDlg.width=300;

    wDlg.height=300;

    wDlg.exec()

     You can test it. In first page - text "Is it working?"  

    In second page you can see the answer 

  • Richard HaseltineRichard Haseltine Posts: 100,749

    Ah, I didn't realise it worked without user-intervention - that's good.

  • YudinEdYudinEd Posts: 90

    Implementation of pages will be even easier if you'll use DzTextBrowser, which can be used for decoration with HTML tags. They even allow you to insert images into the script inside  in the 64-base format ... For beginners, it is very good, when the script code becomes simpler. Sorry for my English :)

     

     

     

  • V3DigitimesV3Digitimes Posts: 3,150

    Yes I'm working with DzTabWidget now, this is a very good widget, you can add as many pages as you want, and if you really need space, even add scrollbars in each page they are required. But the DzTextBrowser I had not remarked it before. It may be interesting to include documentation inside the interfaces.

  • YudinEdYudinEd Posts: 90

    you need a function connected to the currentChanged signal for the widget 

     Richard, You can not explain this function as an example of the script?

    In documentation 

    void DzTabWidget::currentChanged ( DzWidget *  wgt  )  [signal]

    Signature: "currentChanged(DzWidget *wgt)"

    Emitted when the current page changes

     I don't understand *wgt   [signal] . These are the variables? How this might look in the script? - it is not clear :)

     I guess I can do without this function. But it is useful. This is beyond doubt.

  • YudinEdYudinEd Posts: 90

    OK, thanks

  • YudinEdYudinEd Posts: 90
    edited July 2016

    It's very strange...

    I use  Tab1.setTabEnabled(Content1,false) - tab is deactivated. It's true.

    When I try to make it again as active Tab1.setTabEnabled(Content1,true) - tab is activated,  but none of the tab element is not working (to examples, buttons  connected with functions).

     In fact, I get GUI of tab only.

    Post edited by YudinEd on
  • YudinEdYudinEd Posts: 90

    Problem is no in Tab widget, how I understood.

    I have big script and used  include "My Function.dsa" .  I have problems with this string

    More information about INCLUDE    http://www.daz3d.com/forums/discussion/10400/dazscript-import-external-script-file#latest

  • YudinEdYudinEd Posts: 90
    edited April 2017

    So, I continue...

    About signal for Tab widget. 

    You can use the signal in this form  - "currentChanged(int) "

    connect (wTabStack, "currentChanged(int) " ,TabAction); // bind Tab with actiona=0; // Testing - to determine which tabfunction TabAction()     {a++	if ( a&1 ) {   false; print ("First Tab");}else {   true; print ("Second Tab");}}

     

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