FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour xBrowse con full grid
Posts: 128
Joined: Wed Oct 26, 2005 12:18 PM
xBrowse con full grid
Posted: Mon Oct 03, 2011 05:57 PM
Obviamente que es cuesti贸n de gustos personales, pero, para mis preferencias, la regi贸n en blanco (figura izquierda) que queda en la parte inferior de un xbrowse cuando se muestra una array con menos elementos que los que pueden dibujarse, disminuye las elegantes caracter铆sticas visuales de este control.



Comparto con quienes coincidan conmigo las modificaciones necesarias que permiten dibujar xbrowse con full grid, como se muestra en la figura derecha.

1) En la clase txBrowse:
1.1) Variable que controla si se pinta el full grid: agregar: DATA lFullGrid INIT .T.
1.2) Pintado de celdas: En el m茅todo Paint, agregar variable Local nArrayAt e insertar el siguiente c贸digo justo antes de /* Paint lines */
Code (fw): Select all Collapse
聽 IF ::lFullGrid
聽 聽 聽nArrayAt:=::nArrayAt 聽 聽//Save current value
聽 聽 聽do while nRow<=nBrwHeight
聽 聽 聽 聽::nArrayAt:=nRowPos 聽// Case it's reqired by ::bClrStd
聽 聽 聽 聽for nFor := 1 to nLast
聽 聽 聽 聽 聽if aCols[ nFor ] > nBrwWidth
聽 聽 聽 聽 聽 聽 exit
聽 聽 聽 聽 聽endif
聽 聽 聽 聽 聽oCol := ::ColAtPos( nFor )
聽 聽 聽 聽 聽oCol:PaintData( nRow, aCols[ nFor ], nHeight, .F., .f., nFor, nRowPos )
聽 聽 聽 聽next

聽 聽 聽 // We must also paint some times after the last visible column
聽 聽 聽 if aCols[ nLast + 1 ] < nBrwWidth
聽 聽 聽 聽 聽nTemp 聽 聽 := nRow + nHeight
聽 聽 聽 聽 聽nTemp2 聽 聽:= aCols[nLast + 1]
聽 聽 聽 聽 聽 if nColStyle < LINESTYLE_INSET
聽 聽 聽 聽 聽 聽 nTemp2--
聽 聽 聽 聽 聽 endif
聽 聽 聽 聽 聽 if ! ( ::lTransparent == .t. )
聽 聽 聽 聽 聽 聽 聽hBrush := CreateSolidBrush( Eval( ::bClrStd )[ 2 ] )
聽 聽 聽 聽 聽 聽 聽FillRect( hDC, {nRow, nTemp2, nTemp, nBrwWidth }, hBrush )
聽 聽 聽 聽 聽 聽 聽DeleteObject( hBrush )
聽 聽 聽 聽 聽 endif
聽 聽 聽 聽 endif

聽 聽 聽 聽 nRowPos++
聽 聽 聽 聽 nRow += nRowHeight
聽 聽 聽enddo
聽 聽 ::nArrayAt:=nArrayAt 聽 聽//restore value
聽 聽ENDIF
聽 聽/*
聽 聽 聽 Paint lines
聽 聽 */


1.3) Pintado de lineas: En el mismo m茅todo Paint(), un poco m谩s abajo, comentar nTemp2 y agregar la l铆ne indicada
Code (fw): Select all Collapse
聽 聽 聽 聽 聽 聽 聽 if nRowStyle > 0
聽 聽 聽 聽 聽 聽 聽 聽 聽 nRow 聽 := ::HeaderHeight() - 1
聽 聽 聽 聽 聽 聽 聽 聽 聽 //nTemp2 := ::nDataRows
聽 聽 聽 聽 聽 聽 聽 聽 聽 nTemp2 := if(::lFullGrid,nMaxRows,::nDataRows) 聽// --> Need go until bottom


2) En la clase txBrwColumn, m茅todo PaintData, cambiar
if ::bStrData != nil //.and. !::hChecked
por
if ::bStrData != nil .and. nPaintRow<=::nLen //.and. !::hChecked


ADVERTENCIA: PaintData() es llamado ahora con valores de ::nArrayAt superiores a la longitud del array, lo que puede producir errores de rango en el acceso al array en tiempo de ejecuci贸n. Analice y corrija los codeblocks que contengan ::nArrayAt o ::aRow (y quiz谩s otros).

Ejemplo:
oBrw:={|| {if(oBrw:aRow[1],CLR_HBLUE,CLR_HGRAY),CLR_WHITE}}
va a generar un error cuando se llame con un valor superior a la longitud del array y para evitarlo debe ser cambiado por:
oBrw:={|| {if(oBrw:nArrayAt<=oBrw:nLen .and. oBrw:aRow[1],CLR_HBLUE,CLR_HGRAY),CLR_WHITE}}




Cordiales saludos.
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: xBrowse con full grid
Posted: Mon Oct 03, 2011 06:20 PM
Cesar, un gran aporte, gracias por compartir el codigo, estoy de acuerdo contigo....

Al poder voy a probarlo...

http://forums.fivetechsupport.com/viewtopic.php?f=3&t=22506

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 880
Joined: Fri Jan 12, 2007 08:35 PM
Re: xBrowse con full grid
Posted: Mon Oct 03, 2011 10:58 PM

Cesar muchas gracias que lindo en compartir :D

Saluditos :wink:

Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

s茅蕦菨晒 谉蓯 蓯蕠s菨 opun莎 菨蕠s菨
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: xBrowse con full grid
Posted: Tue Oct 04, 2011 03:48 AM
Cesar,
He estado pensando un poco acerca de tu muy acertada contribuci贸n, pero creo que crea un poco de problemas con asuntos de compatibilidad, que tu mismo has descrito...

Yo creo que esta forma de pintado mas bien deber铆a ser implementada al usar la opci贸n:
Code (fw): Select all Collapse
oBrw:lColDividerComplete := .T.

La evaluaci贸n de:
Code (fw): Select all Collapse
oBrw:nArrayAt<=oBrw:nLen

Deber铆a ser hecha en la clase, para evitar errores en ejecuci贸n y compatibilidad...

Espero que los amigos de FiveTech, nos den su opinion al respecto... a mi me encantar铆a que se implementara en xBrowse...

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: xBrowse con full grid
Posted: Tue Oct 04, 2011 06:20 AM
C茅sar, Bayron,

oBrw:lColDividerComplete = .T. parece estar funcionando correctamente :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: xBrowse con full grid
Posted: Tue Oct 04, 2011 01:48 PM
Antonio,
Si funciona correctamente, simplemente estaba mencionando usarlo como condici贸n para hacer el pintado que menciona Cesar con oBrw:bClrStd....

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: xBrowse con full grid
Posted: Wed May 15, 2013 01:50 PM
Buenos dias
No consigo el efecto de pintar las divisiones de filas y columnas cuando el array est谩 vacio, o no llega a tener el n煤mero de filas que ocupa todo el XBrowse
Adjunto el c贸digo que utilizo

Code (fw): Select all Collapse
Local aF 聽 聽 聽 聽:= {}
Local oBrush


聽 聽DEFINE BRUSH oBrush COLOR nRgb( 240, 240, 240 )

聽 聽@ 2, 4 XBROWSE oList ARRAY aF ;
聽 聽 聽 SIZE nAnchoSpl - 4, oWndPrin:nHeight - 30 ;
聽 聽 聽 OF aPanels1 ;
聽 聽 聽 COLUMNS 1 ;
聽 聽 聽 HEADERS "Funcion" ; //"S", "Nombre", "Descripcion" ;
聽 聽 聽 COLSIZES (nAnchoSpl - 22) ;
聽 聽 聽 JUSTIFY 聽nil ; //AL_CENTER, nil, nil ;
聽 聽 聽 COLORS RGB( 100, 100, 100 ), CLR_WHITE ; //, Rgb( 240, 240, 240 ) ;
聽 聽 聽 FONT oFontEdt ;
聽 聽 聽 PIXEL ;
聽 聽 聽 NOBORDER LINES

聽 聽WITH OBJECT oList
聽 聽 聽 :lFooter 聽 聽 聽 聽 聽:= .F.
聽 聽 聽 :lRecordSelector 聽:= .F. 聽 聽 聽

聽 聽 聽 :lColDividerComplete := .T.

聽 聽 聽 :l2007 聽 聽 聽 聽 聽 聽:= .F.
聽 聽 聽 :nMarqueeStyle 聽 聽:= MARQSTYLE_HIGHLROW
聽 聽 聽 :nRowHeight 聽 聽 聽 := 18
聽 聽 聽 :bClrSel 聽 聽 聽 聽 聽:= { || { CLR_WHITE, Rgb(128,128,128) } } //Rgb(35,31,32) } } 聽 //CLR_BLUE
聽 聽 聽 :bClrSelFocus 聽 聽 := { || { CLR_WHITE, Rgb(051,051,051) } }
聽 聽 聽 :bClrRowFocus 聽 聽 := { || { CLR_BLACK, Rgb(128,128,128) } } //RGB( 120,210,255 ) } }

聽 聽 聽 :SetBrush( oBrush )
聽 聽 ENDWITH

聽 聽 聽 SetParent( oList:hWnd, aPanels1:hWnd )
聽 聽 聽 oList:CreateFromCode()
聽 聽 聽 oBrush 聽:= Nil


C贸mo se ha de configurar?
Gracias
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: xBrowse con full grid
Posted: Sat May 18, 2013 01:03 AM
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces

Continue the discussion