How to display the scrollbars of a DzScrollArea?

V3DigitimesV3Digitimes Posts: 3,123

Hello, I'm finishing a small GUI, which at the end is finally not "that" small, and I wanted to place all my widgets in a DzScrollArea. From what I understood, it should give me access to a scroll area with scrollbars in which I can add my widgets.

But for now, I don't manage to see the scrollbars at all. I see a "place" for the scrollbars to be included, but they are not here. Here is the short example showing typically what I am writing. Maybe there is an error in my interpretation of how if should behave, but in all of what I tested (DzDialog instead of DzBasicDialog, layouts/no layouts, place widgets in Groupboxes, place group boxes in layouts or not.. or the contrary), I never saw any scrollbars appearing. I've just spent the 10 last hours searching for the scrollbars, I learnt nothing more having a look at QScrollArea docs, so maybe there is something I completely understand, or do, the wrong way. I took the example of a huge test text around which I would like to place a scrollArea.

​var wDlg = new DzBasicDialog();//wDlg.sizeGripEnabled = true;wDlg.setMaxHeight = 200;wDlg.setMaxWidth = 200;var fonts = new Font;fonts.pixelSize = 250;	var wScr = new DzScrollArea (wDlg); // //wScr.setFixedWidth(500)wScr.setVerticalScrollbarDisplay(true);wScr.setHorizontalScrollbarDisplay(true);wScr.alignment = wDlg.AlignVCenter;wScr.show(); var wtextBox = new DzLabel (wScr);wtextBox.wordWrap = true;wtextBox.text = "Where are the scroll bars????"wtextBox.font = fonts;wDlg.addWidget(wScr)wDlg.exec()[Click and drag to move]​

Does anybody have an idea how to have a scroll area with scrollbars around widgets ?

Well thanks in advance for any help. I'm going to bed right now, may things will be more clear tomorrow!

Post edited by Richard Haseltine on

Comments

  • jag11jag11 Posts: 885

    Just one line missing:

    var basicDialog = new DzBasicDialog();basicDialog.sizeGripEnabled = true;var scrollArea = new DzScrollArea(basicDialog);scrollArea.alignment = basicDialog.AlignVCenter;scrollArea.width = 300;scrollArea.height = 300;scrollArea.widgetResizable = true;scrollArea.setHorizontalScrollbarDisplay(true);scrollArea.setVerticalScrollbarDisplay(true);var font = new Font();font.pixelSize = 250;var bigTextLabel = new DzLabel(scrollArea);bigTextLabel.wordWrap = false;bigTextLabel.text = "Where are the scroll bars????";bigTextLabel.font = font;scrollArea.setWidget(bigTextLabel); //  <------------ was missingbasicDialog.addWidget(scrollArea);basicDialog.exec();
  • V3DigitimesV3Digitimes Posts: 3,123

    Thank you so much Jag11! I did not know at all what the "setWidget" was here for initially... And of course, it was a key function of all this!

    I modified my GUI script this morning to put all my widgets in a main widget relying on the scrollArea. And thanks to your help my interface now works wonderfully even for small screens with bad resolutions!

    Thanks again, I can go on with the rest my job now this is solved!

  • jag11jag11 Posts: 885

    I'm glad.

Sign In or Register to comment.