The problem seems related to the number of items, and appears if them don't fill completely the grid or if
its number exceed the grid capacity.
It seems that the layout ignores the number of colums you specify while it respects the number of rows,
and that it adjust the number of colums so that it's able to display all the added elements.
In the following program, e.g. if you set 'number to a value below 13 or above 15, the grid becomes, rispectively of 3 * 4 and 3 * 6
If you set the number as 100, the grid becomes of 34 columns, with 2 empty cells.
If you set rows 7 and num 8, you get two columns, with the first 4 rows filled, and other 3 rows empty.
In other words it seems that cols becomes (/ (+ num rows -1 ) rows )
I'm not trying to dispraise NewLisp, (it's wonderful !)
I'm just experimenting with its layout capabilities.
Code: Select all
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
(gs:frame 'GridDemo 100 100 300 200 "panels in a grid")
(set 'rows 3 'cols 5 'num 16)
(gs:set-grid-layout 'GridDemo rows cols)
(dotimes (i num)
(set 'id (sym (string "P" i)))
(gs:set-background id (list (random) (random) (random)))
(gs:add-to 'GridDemo id)
(gs:set-visible 'GridDemo true)