You are right. I've checked it and it was a simple case of arguments switched - 120 pixel min-width was inadvertently switched for 20%.
It works fine now, and on-size seems to be the right place for calculation, too. Thanks! Best, Erich On Thu, 8 Sep 2016 17:56:38 -0700 (PDT) Alex Harsanyi <alexharsa...@gmail.com> wrote: > I believe the message means that the width you specify is greater > than the max value you also specify. That is, you probably call it > as (set-column-width i 715 0 596), which could happen if 'perc' is > greater than 100. > > You can verify that by printing out all the values and checking them. > > Alex. > > On Friday, September 9, 2016 at 1:59:39 AM UTC+8, erich wrote: > > I'm trying to get a list-box% subclass to work with min-widths and > > percentage values, but I'm unable to figure out the correct total > > width to calculate the actual widths. > > > > Inside the listbox, I store the percentages in percentages and the > > minimum-widths in minimum-widths: > > > > (define/override (on-size width height) > > (set-column-dimensions)) > > > > (define (set-column-dimensions) > > (let-values (((w h) (get-client-size))) > > (for ([min-width (in-list minimum-widths)] > > [perc (in-list percentages)] > > [i (in-naturals)]) > > (let ((perc-width (truncate (* w (/ perc 100))))) > > (set-column-width i (if (< perc-width min-width) > > min-width > > perc-width) > > min-width > > w))))) > > > > But with this code I get errors like "set-column-width in list-box%: > > given size is greater than maximum size given: 715 maximum: 596" > > > > Question 1: get-client-size does not seem to return the maximum > > width of all columns, probably because of the scrollbar. How do I > > get the maximum width of all columns? > > > > Question 2: Is on-size the right place to set the actual width > > computed from the percentages? > > > > Another problem is a bit more tricky. I believe I should calculate > > any remaining percentage widths on the basis of the maximum total > > column width minus the actual widths already fixed, since min-width > > is used whenever perc-width is too small. I'll save that for later, > > though, and would be happy if somebody could help me with > > calculating perc-width correctly first. > > > > Best, > > > > Erich > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.