[Gambas-devel] New gambas MDI Component.

Ron Onstenk ronstk at ...124...
Wed Jun 28 00:57:14 CEST 2006


On Wednesday 28 June 2006 00:18, Fabien Bodard wrote:
> In this version i've integrated the code that Ron Onstenk have send to me.
> 
Fine :)

> (Hey Ron!, i've done some change on your code... special windows like Forms 
> can't be resized so i deasable the menu tile_window if one of then are this 
> type and forget the resizing in cascade.)
You are the "maintainer" of the gb.form.mda so change as you like.
The code was a simple quick try to help a bit.
Did not really test it with Forms, only code editors. (slap myself :) )

As I have seen earlier this evening you did not simple add/remove small code
snippits but changed i.e. Watch_Close much more I expected compared to original.
Take a look, if not already done, for the problem I found with close all
and try open a new code editor.


I'm now busy with some other things but will try it later


BTW
I changed the Tile to correct some dimensions.

To get the best layout I use the SQR of the count+1.
The plus 1 is to prevent SQR(0), gives 1 at least
The horizontal count is the integer of it
The vertical is the total divide by horz, note the no div by zero.
The IF just below is to make sure I get all windows/forms.
This part of code is not the best but works here in a quick&dirty way.
More for fit then best arrange&layout&fit. :)

In both iCCxxx the -24 is for the scrollbar if they occurs.
I had forgotten the Taskbar on bottom and is now also in calculation.

My actual new code I use now is:

PUBLIC SUB mnuTile_Click()
  DIM iCCwidth AS Integer
  DIM iCCheight AS Integer
  DIM xw AS window
  DIM off AS Integer
  DIM offx AS Integer
  DIM offy AS Integer
  DIM ix, iy AS Integer
  
  off = $aWindow.Count
  offx = Int(Sqr($aWindow.Count + 1))
  offy = $aWindow.Count \ offx ' offx ' + 1
  IF (offx * offy) < $aWindow.Count THEN INC offy
    
  iCCwidth = (ME.ClientWidth - 24) \ IIf(offx = 0, 1, offx)
  iCCheight = (ME.ClientHeight - hTaskBar.Height - 24) \ IIf(offy = 0, 1, offy)
  
  FOR ix = 0 TO offx - 1
    FOR iy = 0 TO offy - 1
      IF (iy * offx + ix) < off THEN '<-- this prevent no existing objects :)
        xw = $aWindow[iy * offx + ix]
        xw.Width = iCCwidth 'dimension
        xw.Height = iCCheight
        xw.Left = iCCwidth * ix 'place
        xw.Top = iCCheight * iy
      ENDIF  
    NEXT
  NEXT

END

Yes I know, using xw.move(x,y,w,h) could be used.

Greets
Ron

PS, increment you version in tarbal next time :)




More information about the Devel mailing list