FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Problemas de alineaci贸n con xBrowse
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Problemas de alineaci贸n con xBrowse
Posted: Sun Aug 09, 2015 02:26 PM
Colegas, estoy usando un control xbrowse para mostrar varias tablas, trabajo con ado, por lo tanto el datasource del xbrowse es un recordset, este es el c贸digo

Code (fw): Select all Collapse
聽 聽 Local i
聽 聽 Local oBrw
聽 聽 Local cStrings 聽 聽
聽 聽 Local cQuery := 'select * from alumnos order by alumno'

聽 聽 Memvar oVar
聽 聽 
聽 聽 Query( @::oRs, cQuery )

聽 聽 @ 35 + oVar : n, 250 xBrowse ::oBrw DataSource ::oRs Columns 0, 1, 2, 3, 4, 5, 6, 7, 8 Pixel NoBorder Of oVar : oWndMain
聽 聽 
聽 聽 With Object ::oBrw 
聽 聽 聽 聽 For i := 1 To Len( :aCols )
聽 聽 聽 聽 聽 聽 Switch i
聽 聽 聽 聽 聽 聽 聽 聽 Case 1
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ i ] : cHeader 聽:= 'C脫DIGO'
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ i ] : bStrData := { || StrZero( ::oRs : Fields( 'codigo' ) : Value, 6 ) }
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ i ] : nDataStrAlign := 2
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Exit
聽 聽 聽 聽 聽 聽 聽 聽 Case 2
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ i ] : nWidth := 250
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Exit
聽 聽 聽 聽 聽 聽 聽 聽 Case 3
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ i ] : nWidth := 200
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Exit
聽 聽 聽 聽 聽 聽 聽 聽 Case 4
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ i ] : nWidth := 100
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Exit
聽 聽 聽 聽 聽 聽 聽 聽 Case 6
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ i ] : cHeader := 'C. POSTAL'
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Exit
聽 聽 聽 聽 聽 聽 聽 聽 Case 7
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ i ] : cHeader := 'T. DOC.'
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Exit
聽 聽 聽 聽 聽 聽 聽 聽 Case 8
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ i ] : cHeader := 'N潞 DOC.'
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Exit
聽 聽 聽 聽 聽 聽 EndSwitch聽 聽聽 聽 聽 聽 聽 聽 
聽 聽 聽 聽 聽 聽 :aCols[ i ] : cHeader 聽 聽 := Upper( :aCols[ i ] : cHeader )
聽 聽 聽 聽 聽 聽 :aCols[ i ] : oDataFont 聽 := oVar : oFont2
聽 聽 聽 聽 聽 聽 :aCols[ i ] : oHeaderFont := oVar : oFont3
聽 聽 聽 聽 聽 聽 :aCols[ i ] : nHeadStrAlign := 0
聽 聽 聽 聽 Next i聽 
聽 聽 聽 聽 :nRecSelColor 聽 聽 := CLR_WHITE
聽 聽 聽 聽 :nRowHeight 聽 聽 聽 := 27
聽 聽 聽 聽 :nHeaderHeight 聽 聽:= 35
聽 聽 聽 聽 :bClrHeader 聽 聽 聽 聽 := { || { CLR_WHITE, CLR_BLACK 聽} }
聽 聽 聽 聽 :nColorPen 聽 聽 聽 聽:= nRgb( 225, 225, 225 )
聽 聽 聽 聽 :bClrSelFocus 聽 聽 := { || { CLR_WHITE, nRgb( 46, 139, 87 ) } }
聽 聽 聽 聽 :bClrSel 聽 聽 聽 聽 聽:= { || { CLR_BLACK, RGB( 255, 255, 255 ) } }
聽 聽 聽 聽 :nColDividerStyle := 5
聽 聽 聽 聽 :nRowDividerStyle := 5
聽 聽 聽 聽 :nMarqueeStyle 聽 聽:= 3
聽 聽 聽 聽 :lFlatStyle 聽 聽 聽 := .t.
聽 聽 聽 聽 :l2007 聽 聽 聽 聽 聽 聽:= .f.
聽 聽 聽 聽 :lKinetic 聽 聽 聽 聽 := .f.
聽 聽 聽 聽 :lExcelCellWise 聽 := .t. 聽 聽 聽
聽 聽 聽 聽 :lAllowRowSizing 聽:= .f. 聽 聽 聽
聽 聽 聽 聽 :lColDividerComplete := .t.
聽 聽 聽 聽 :bKeyDown 聽 聽 聽 聽 := { | nKey | If( nKey == VK_RETURN, MsgStop( ::nEnQueTabla ), ) } 聽 聽 
聽 聽 聽 聽 :CreateFromCode()聽 聽
聽 聽 聽 聽 :SelectCol( 2 )
聽 聽 EndWith
聽 聽 Return 0

Se ve de esta manera, La alineaci贸n de la primera columna es la correcta



Pero cuando genero la segunda tabla, todo va bien menos la alineaci贸n de los datos. Este es el c贸digo de la segunda tabla

Code (fw): Select all Collapse
聽 聽 Local i
聽 聽 Local oCol
聽 聽 Local cQuery := 'select * from conceptos order by codigo'
聽 聽 Memvar oVar
聽 聽 
聽 聽 ::oRs : Close()
聽 聽 Query( @::oRs, cQuery )
聽 聽 ::oBrw : SetAdo( ::oRs, .t., .f., { 'codigo', 'descrip', 'importe', 'porcentaje' } ) 聽 聽
聽 聽 With Object ::oBrw
聽 聽 聽 聽 For i := 1 To Len( :aCols )
聽 聽 聽 聽 聽 聽 Switch i
聽 聽 聽 聽 聽 聽 聽 聽 Case 1
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ 1 ] : cHeader 聽:= 'C脫DIGO'
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ i ] : bStrData := { || StrZero( ::oRs : Fields( 'codigo' ) : Value, 6 ) }
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ 1 ] : nDataStrAlign := 2
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Exit
聽 聽 聽 聽 聽 聽 聽 聽 OtherWise
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 :aCols[ i ] : cHeader 聽 聽 := Upper( :aCols[ i ] : cHeader )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Exit
聽 聽 聽 聽 聽 聽 EndSwitch聽 聽聽 聽 聽 聽 聽 聽 
聽 聽 聽 聽 聽 聽 :aCols[ i ] : nHeadStrAlign := 0
聽 聽 聽 聽 聽 聽 :aCols[ i ] : oDataFont 聽 := oVar : oFont2
聽 聽 聽 聽 聽 聽 :aCols[ i ] : oHeaderFont := oVar : oFont3
聽 聽 聽 聽 Next i聽 
聽 聽 聽 聽 :nRowHeight 聽 聽 聽 := 27
聽 聽 聽 聽 :nHeaderHeight 聽 聽:= 35
聽 聽 聽 聽 :SelectCol( 2 )
聽 聽 End
聽 聽 ::oBrw : Refresh()
聽 聽 ::nEnQueTabla := 2
聽 聽 Return 0


Y la imagen



A pesar de haber definido la alineaci贸n de los datos no los toma, sin embargo la alineaci贸n de los header definida en el c贸digo si lo hace. Alguna idea para resolver este problema ? . Muchisimas gracias

Saludos
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: Problemas de alineaci贸n con xBrowse
Posted: Tue Aug 11, 2015 11:38 AM

Alguna idea sobre este tema ??? Gracias

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problemas de alineaci贸n con xBrowse
Posted: Tue Aug 11, 2015 05:02 PM

Horacio,

Le acabo de enviar un email a Rao para tener su opini贸n

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: Problemas de alineaci贸n con xBrowse
Posted: Tue Aug 11, 2015 05:38 PM

Gracias Antonio,

Saludos

Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: Problemas de alineaci贸n con xBrowse
Posted: Sun Aug 16, 2015 01:07 PM

Alguna noticia sobre este tema ??? Gracias

Saludos

Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: Problemas de alineaci贸n con xBrowse
Posted: Thu Aug 20, 2015 11:29 AM

+1

Posts: 346
Joined: Mon Oct 05, 2009 03:35 PM
Re: Problemas de alineaci贸n con xBrowse
Posted: Thu Aug 20, 2015 03:02 PM
amigo:

revis茅 tu c贸digo y lo 煤nico extra帽o que encuentro es lo que te marco.


Code (fw): Select all Collapse
        For i := 1 To Len( :aCols )
            Switch i
                Case 1
                    :aCols[ 1 ] : cHeader  := 'C脫DIGO'
                    
aqui no debe ser 1?? --->  :aCols[ i ] : bStrData := { || StrZero( ::oRs : Fields( 'codigo' ) : Value, 6 ) }


                    :aCols[ 1 ] : nDataStrAlign := 2
                    Exit
                OtherWise
                    :aCols[ i ] : cHeader     := Upper( :aCols[ i ] : cHeader )
                    Exit
            EndSwitch              
            :aCols[ i ] : nHeadStrAlign := 0
            :aCols[ i ] : oDataFont   := oVar : oFont2
            :aCols[ i ] : oHeaderFont := oVar : oFont3
        Next i


la l贸gica y la secuencia parece estar correcta, seguire revisando....

saludos
SkyPe: armando.lagunas@hotmail.com

Mail: armando.lagunas@gmail.com
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: Problemas de alineaci贸n con xBrowse
Posted: Thu Aug 20, 2015 08:11 PM

Armando, gracias por contestar. En el caso de la columna si te fijas es lo mismo poner 1 o i ya que entra en el case solo si vale 1, en este caso i = 1. Lo llamativo es que en la alineaci贸n de los headers funciona desde c贸digo y no la de los datos. Se me ocurre que esta alineaci贸n, por alguna raz贸n, no se puede cambiar din谩micamente y debe tener otro tratamiento que la alineaci贸n de los headers que si funcionan. Me gustar铆a que me confirmaran esta hip贸tesis ya que de no ser posible tendr铆a que encarar el proyecto de otra manera. Muchas gracias nuevamente.

Saludos

Posts: 133
Joined: Mon May 12, 2008 04:13 PM
Re: Problemas de alineaci贸n con xBrowse
Posted: Mon Aug 24, 2015 06:47 AM

Hola buenos dias

Prueba cambiando bStrData por bEditValue

Todos mis xBrowse los uso asi con ADO y trabajan bien

Fivewin 16.11
Harbour 3.2.0
Visual Studio 2015 community
MariaDb/MySql

Ing. MSc. Luis Duque
http://www.accasoft.net
Posts: 1364
Joined: Wed Jun 21, 2006 12:39 AM
Re: Problemas de alineaci贸n con xBrowse
Posted: Mon Aug 24, 2015 01:36 PM

Luis, gracias por responder. Finalmente en la clase TXBrwColumn hay un m茅todo, SetAlign() que modifica la alineaci贸n de los datos en forma din谩mica. Gracias nuevamente.

Saludos

Continue the discussion