FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse Adjust Last Column
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
xBrowse Adjust Last Column
Posted: Mon Mar 16, 2009 06:44 AM
Esta adaptacion esta hecha a sugerencia del colega William Morales, espero haber captado la idea
This adaptation was suggest by William Morales

Se trata de ajustas la ultima columna del browse al ancho restante disponible, para que no quede ningun espacio vacio....
Adjust Last Column browse of the remaining available width, so that no empty space ....

les dejo un ejemplo a descargar, si desean probar...
Let a sample for test..

http://www.sitasoft.com/fivewin/test/xbcoladj.rar

Archivo a Modificar / File to Change
XBROWSE.PRG

Metodo a modificar /METHOD To Change
LastDisplayPos( )

ABRIR/OPEN XBROWSE.PRG
AGREGAR NUEVA DATA en TXBrowse / ADD NEW DATA in TXBrowse

Code (fw): Select all Collapse
   DATA lAdjustLastCol AS LOGICAL INIT .F.



BUSCAR EN/FIND IN METHOD LastDisplayPos( lComplete ) CLASS TXBrowse

Code (fw): Select all Collapse
   if lComplete .and. nWidth >= nMaxwidth


EN LINEA AGREGAR DESPUES/ INLINE ADD AFER

Code (fw): Select all Collapse
.and. !::lAdjustLastCol


BUSCAR/FIND

Code (fw): Select all Collapse
return nPos


AGREGAR ANTES/ ADD BEFORE

Code (fw): Select all Collapse
   if ::lAdjustLastCol .and. nPos = nLen
      if nWidth < nMaxwidth 
          ::ColAtPos( nPos ):nWidth += ( nMaxWidth - nWidth - COL_SEPARATOR )
      elseif nWidth > nMaxwidth
          ::ColAtPos( nPos ):nWidth -= ( nWidth - nMaxWidth + COL_SEPARATOR )
      endif
   endif


Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "xbrowse.ch"

function main()

   local oWnd1
   local oBrw
   local aArray1 := {}
   local nI
   
   
   for nI = 1 to 20
   aadd( aArray1, { .f.,SPACE(20),;
                                "Row:"+StrZero(nI,2)+" Col:02",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03" } )
   next
   
   
   DEFINE window oWnd1 Title "Test Adjust Last Column xBrowse" 
   
   
   oBrw:= txbrowse():new( oWnd1 )
   oBrw:nRowHeight := 40
   oBrw:nColDividerStyle    := LINESTYLE_BLACK
   oBrw:nRowDividerStyle    := LINESTYLE_BLACK
   oBrw:SetArray( aArray1 )
   oBrw:nMarqueeStyle := 6
   oBrw:CreateFromCode()
   oBrw:bClrStd := {|| { CLR_BLACK,RGB( 193,221,255 ) } }
   oBrw:lRecordSelector := .f.
   
   oBrw:lAdjustLastCol := .t.
   
   oWnd1:oClient = oBrw
   
   ACTIVATE window oWnd1 

return nil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: xBrowse Adjust Last Column
Posted: Mon Mar 16, 2009 07:32 AM

Daniel,

Thanks! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: xBrowse Adjust Last Column
Posted: Mon Mar 16, 2009 08:42 AM

Dear Mr.Antonio,

Can we expect these recent xBrowse changes in the next FWH build.

Regards

Anser

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse Adjust Last Column
Posted: Sat Mar 21, 2009 06:54 PM

This facility already exists in xbrowse without any change.

oBrw:nStretchCol := STRETCHCOL_LAST

With this setting, xbrowse fits ( or streches ) the last column to fit the width of the browse.

This may not look nice if the last column is a small numeric column. In such cases, there is another setting :

oBrw:nStretchCol := STRETCHCOL_WIDEST

With this setting, xbrowse stretches the widest character column to fit the width of the browse.

I hope I understood the original purpose of the posting correctly

Regards



G. N. Rao.

Hyderabad, India
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: xBrowse Adjust Last Column
Posted: Sat Mar 21, 2009 07:10 PM

Hello nageswaragunupudi

Thank for you feedback,
every day we learn new things...

Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: xBrowse Adjust Last Column
Posted: Sun Mar 22, 2009 01:45 PM
Hello Mr. Rao

to use nStretchCol property does browse so slow, apparently always recalculating the column widths
this effect is visible when does use nEditType >= EDIT_LISTBOX

check this samples and click any button or resize any columns or rows...

thank for you attention
Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "xbrowse.ch"

function main()

   local oWnd1
   local oBrw
   local aArray1 := {}
   local nI
   
   
   for nI = 1 to 20
   aadd( aArray1, { .f.,SPACE(20),;
                                "Row:"+StrZero(nI,2)+" Col:02",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03" } )
   next
   
   
   DEFINE window oWnd1 Title "Test Adjust Last Column xBrowse" 
   
   
   oBrw:= txbrowse():new( oWnd1 )
   oBrw:nRowHeight := 40
   oBrw:nColDividerStyle    := LINESTYLE_BLACK
   oBrw:nRowDividerStyle    := LINESTYLE_BLACK
   oBrw:SetArray( aArray1 )
   oBrw:nMarqueeStyle := 6
   oBrw:CreateFromCode()
   oBrw:bClrStd := {|| { CLR_BLACK,RGB( 193,221,255 ) } }
   oBrw:lRecordSelector := .f.
   
   oBrw:aCols[ 3 ]:nEditType := EDIT_LISTBOX
   oBrw:aCols[ 4 ]:nEditType := EDIT_BUTTON
   
   oBrw:nStretchCol := STRETCHCOL_LAST

   
   oWnd1:oClient = oBrw
   
   ACTIVATE window oWnd1 

return nil
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse Adjust Last Column
Posted: Sun Mar 22, 2009 05:46 PM

Yes.

Stretched columns and EditListBoxes do not go together well. Once the listbox is activated, the flicker starts.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion