xBrowse Ajuste automatico ultima columna

xBrowse Ajuste automatico ultima columna

Postby Daniel Garcia-Gil » Mon Mar 16, 2009 6:43 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: Select all  Expand view
  DATA lAdjustLastCol AS LOGICAL INIT .F.



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

Code: Select all  Expand view
  if lComplete .and. nWidth >= nMaxwidth


EN LINEA AGREGAR DESPUES/ INLINE ADD AFER

Code: Select all  Expand view
.and. !::lAdjustLastCol


BUSCAR/FIND

Code: Select all  Expand view
return nPos


AGREGAR ANTES/ ADD BEFORE

Code: Select all  Expand view
  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: Select all  Expand view
#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
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: xBrowse Ajuste automatico ultima columna

Postby Antonio Linares » Mon Mar 16, 2009 7:32 am

Daniel,

gracias! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41366
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: xBrowse Ajuste automatico ultima columna

Postby Daniel Garcia-Gil » Sun Mar 22, 2009 7:46 am

Es importante la participacion de los usuarios, sobre comentarios y sugerencias...
eso ayuda a solidificar el producto y obtener el mejor rendimiento del mismo

En el foro de ingles han comentado que no hacen falta estos cambios pue ya existe en el xbrowse esta propiedad, los intresados pueden revisar el post

nageswaragunupudi wrote: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



debo agradecer a nuestro colega Rao (nageswaragunupudi) por tan valiosa observacion, de manera de evitar codigo redundante en la clase txbrowse
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: xBrowse Ajuste automatico ultima columna

Postby Daniel Garcia-Gil » Mon Mar 23, 2009 3:30 am

Nuevo descubrimiento con respecto a este punto... despues de varias pruebas me he dado cuenta que el uso de EDIT_GET_LISTBOX, EDIT_LISTBOX, EDIT_GET_BUTTON Y EDIT_BUTTON no trabajan apropiadamente con la propiedad de nStretchCol, porque genera un desagradable parpadeo en los botones

Por tal motivo se mantendra el cambio planteado en este post y podra ser incuido en el proximo build
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 68 guests