Author Topic: wxSmith, Sizers.  (Read 3128 times)

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
wxSmith, Sizers.
« on: December 28, 2022, 09:55:49 pm »
Codeblocks, wxSmith, layout (sizers)

In wxFlexGridSizer, there are a couple of blank fields, Growable cols and Growable rows. There are no associated check boxes or greyed out values. What could be entered there?

Is it at all possible to change a sizer type, without destroying whatever else was added after the sizer assigned?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: wxSmith, Sizers.
« Reply #1 on: December 29, 2022, 12:27:52 am »
My workflow was to add a new sizer and then move the "parent" sizer with all its childs to the new sizer... If you can not reuse the old sizer you have to drag and drop all the controls by hand...

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: wxSmith, Sizers.
« Reply #2 on: December 29, 2022, 11:52:55 am »
Thanks, I'll try that. I was hoping that a text search and replace over the whole project would do it, but I can see problems in that I believe that the original sizer/position/other settings for the components within it would also need to be altered. Any idea wrt the blank Growable' fields?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: wxSmith, Sizers.
« Reply #3 on: December 29, 2022, 02:41:27 pm »
The growable fields are comma-separated lists of rows or columns that can have a different size. See the control docs in the wxWidgets site.

(The separator may be space or semicolon instead, I can not check ATM.)

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: wxSmith, Sizers.
« Reply #4 on: December 29, 2022, 04:11:41 pm »
The growable fields are comma-separated lists of rows or columns that can have a different size. See the control docs in the wxWidgets site.


Thanks, I'll try and find the control docs.

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: wxSmith, Sizers.
« Reply #5 on: December 29, 2022, 06:12:09 pm »
It happens that in the WxSmith tutorial 6, that it mentions putting '0,1' into the growable property, (I've only just come across that) but when adding the subsequent panel, then codeblocks crashes. I guess it may have changed since the tutorial was last updated. I'll check the WxWidgets docs.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: wxSmith, Sizers.
« Reply #6 on: December 29, 2022, 07:01:42 pm »
I can confirm it is a comma-separated list, in fact I have just added tooltips for those fields in trunk.

The problem in 20.03 arises when you write a growable column (or row) number greater or equal than the number of columns. This is fixed in trunk.

The workaround is setting the number of columns before writing the list of growable columns or using the last nightly.

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: wxSmith, Sizers.
« Reply #7 on: December 29, 2022, 10:06:11 pm »
Thanks for the further info., perhaps you can confirm what this means, (tutorial 6)
Quote
... , a wxFlexGrid Sizer with two columns, both growable.(In the Growable property of the sizer, put"0,1"without the quote marks..)

There are two fields, 'Growable cols' and 'Growable rows', the way the tutorial is worded, it is not clear if you put the '0,1', in one or both fields., afaik there is not a field labeled 'Growable property',
anyway it still crashes. Did this work previously, maybe 5 or 6 years ago, when the tutorials were written, or is there a difference in platform it is run on, or do the folk who write the tutorials not have any reviewing process?

From the wxWidgets documentation, I found
Quote
void wxFlexGridSizer::AddGrowableRow    (    size_t     idx,
      int     proportion = 0
   )       

The first digit in the tutorial is 0, meaning the first row/column, which is within the range of the two column sizer, but the second is a 1 which afaik means unequal sizing. which should not be a problem.

It may be best to download a recent nightly build, as you say, but with my luck...


Or, does it mean that the '1,0' is a list of rows/columns to be altered, and the tutorial should have said '... in the growable cols field, enter '0,1' to allow both columns to be grown,...'
« Last Edit: December 29, 2022, 10:15:56 pm by bdad »

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: wxSmith, Sizers.
« Reply #8 on: December 29, 2022, 11:04:30 pm »
Quote
the tutorial should have said '... in the growable cols field, enter '0,1' to allow both columns to be grown,...'

Correct.

wxSmith calls AddGrowableCol() for each item in the list, if any item is not a valid column index wxWidgets will show an alert. The default wxFlexGridSizer has 3 columns and 0 rows, so you can not write in the GrowableRows field until the number of rows is non-zero.

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: wxSmith, Sizers.
« Reply #9 on: December 29, 2022, 11:30:13 pm »
Yes, that worked fine. Thanks for explaining. What I found in the wxWidget documents, was not quite the explanation for filling in the fields, but I worked out what it meant, thanks to your reply, just after I posted (and b4 I edited).
It'll take me awhile to get used to the sizers, not so much in what they do, but selecting them with the mouse, in particular when starting, the frame becomes a small dot once the panel and sizers are added, then when adding a component, 50/50 chance where they  go, but can use the buttons down the rhs.  Shame not possible to put in sizers to sort out the layout after components placed.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: wxSmith, Sizers.
« Reply #10 on: December 30, 2022, 02:08:00 pm »
I have just edited the tutorial to clarify what field must be edited. You can also do that with your forum user account.

Offline bdad

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: wxSmith, Sizers.
« Reply #11 on: December 30, 2022, 08:08:40 pm »
I'm not sure if I would be capable of editing the tutorials, but I may attempt to rewrite one or two, and perhaps ask someone to review it, in order to make the tutorials  less dependent on dates, etc. In one it refers to the wxPanel component being fourth from left, the illustration shows it as fifth, in reality it is now, or was when I installed wxWidgets, the eighteenth. Also, probably because I'm building statically, I have to add in some extra header files, which could be worth mentioning.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: wxSmith, Sizers.
« Reply #12 on: December 31, 2022, 05:14:08 am »
Also, probably because I'm building statically, I have to add in some extra header files, which could be worth mentioning.

It is common to have to add extra libraries when using an static wxWidgets build; but, I never had to add extra headers because of static build. But, I have not really used wxSmith very much.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org