XBrowse with full grid (Solved)

XBrowse with full grid (Solved)

Postby cnavarro » Thu May 16, 2013 9:23 am

Good morning
I can not paint the effect of divisions of rows and columns when the array is empty, or fails to have the number of rows occupied all xBrowse
Herewith the code I use

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: Select all  Expand view

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
 


How to be configured?
thanks
http://forums.fivetechsupport.com/viewtopic.php?f=6&t=22544&start=0
Cómo se ha de configurar?
Gracias
Last edited by cnavarro on Sat May 18, 2013 1:01 am, edited 1 time in total.
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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse with full grid

Postby Silvio.Falconi » Thu May 16, 2013 10:05 am

oBrw:lColDividerComplete = .T.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: XBrowse with full grid

Postby cnavarro » Thu May 16, 2013 11:39 am

Silvio
In my code and I have the instruction and does not work
Any idea?
thanks

Silvio
En mi codigo ya tengo esa instruccion y no funciona
Alguna idea?
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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse with full grid

Postby Silvio.Falconi » Thu May 16, 2013 12:45 pm

Please upload a minimal test to try
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: XBrowse with full grid

Postby cnavarro » Thu May 16, 2013 3:33 pm

Silvio.Falconi wrote:Please upload a minimal test to try


Silvio
Code: Select all  Expand view

#include "fivewin.ch"
#include "xbrowse.ch"

Function Main()
Local aPanels1
Local oMenu
Local x
Local y
Local oBrush
Local oFontEdt
Local oWndPrin
Local nAnchoSpl   := 200

        oFontEdt   := TFont():New("Lucida Console",0,-9) //"Segoe UI Light Bold", 0 , -11 )

        MENU oMenu
             //MENUITEM "            FUNCIONES            "
        ENDMENU


        DEFINE BRUSH oBrush COLOR nRgb( 100, 100, 100 )

        DEFINE WINDOW oWndPrin MENU oMenu TITLE "PRUEBA" MDI

         //oWndPrin:Maximize()
         oWndPrin:oFont   := oFontEdt

        aPanels1 := TPanel():New( 1, 0, oWndPrin:nHeight , nAnchoSpl , oWndPrin:oWndClient ) //oWndClient
        //aPanels1:nClrPane := nRgb( 255, 255, 255 )
        aPanels1:SetBrush( oBrush )


        ACTIVATE WINDOW oWndPrin MAXIMIZED ;
                        ON INIT ( ;
                           HazBrowse( oWndPrin , aPanels1 , nAnchoSpl, oFontEdt ) );
                        VALID ( .T. )


Return nil

Function HazBrowse( oWndPrin , aPanels1 , nAnchoSpl, oFontEdt )

Local aF        := {}
Local oBrush
Local oList

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

 

   @ 2, 4 XBROWSE oList ARRAY aF ;
      SIZE nAnchoSpl - 4, oWndPrin:nHeight - 2 ;
      OF aPanels1 ;
      COLUMNS 1 ;
      HEADERS "Nombre" ; //"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
 Return nil
 


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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse with full grid

Postby Silvio.Falconi » Thu May 16, 2013 5:42 pm

first
line 78 ENDWITH -> END

then
af:= NIL


try this to understand :
Code: Select all  Expand view
#include "fivewin.ch"
#include "xbrowse.ch"


Function Test()

Local oLbxSample
Local aArraysample := { { 'Ragged Array' },  { 123, Date(), 'Some Text', 349.23 }, ;
                              345.26, ;
                              str(date()-20), ;
                              { 'Next is Array', { "Nested Array", Date(), 3567.89 } }  }


Define DIALOG oDlg TITLE "Searching Customers - " ;
         FROM 452, 774 to 870, 1303 PIXEL COLOR 0, 14215660



  @ 80, 1 XBROWSE  oLbxSample OF oDlg ;
            SIZE -10,-10  PIXEL NOBORDER
                      Ut_BrwRowConfig( oLbxSample )


        WITH OBJECT  oLbxSample
             :setarray(aArraysample)
             :CreateFromCode()
         END



ACTIVATE DIALOG oDlg  CENTERED
return nil




//---------------------------------------------------//

FUNCTION Ut_BrwRowConfig( oBrw )

   oBrw:lRecordSelector     := .t. // .t.
   oBrw:lAllowRowSizing     := .t.
   oBrw:lColDividerComplete := .t. // .f.
   oBrw:lAllowColSwapping   := .t.
   oBrw:lAllowColHiding     := .t.
   oBrw:lFastEdit           := .f.

   oBrw:nRowSel      := 1
   oBrw:nColSel      := 1
   oBrw:nColOffset   := 1
   oBrw:nFreeze      := 0
   oBrw:nCaptured    := 0
   oBrw:nLastEditCol := 0

   oBrw:nRowDividerStyle := LINESTYLE_NOLINES
   oBrw:nColDividerStyle := LINESTYLE_LIGHTGRAY // LINESTYLE_NOLINES
   oBrw:nMarqueeStyle    := MARQSTYLE_HIGHLROW  // MARQSTYLE_SOLIDCELL
   RETURN nil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: XBrowse with full grid

Postby cnavarro » Thu May 16, 2013 9:58 pm

Silvio
The lines of columns if they occupy the entire Browse, but what I need is that the lines are painted also ranks although the data do not occupy the entire Browse.
I'm looking for a DATA as
/ /: lRowDividerComplete: =. T. that no
as there
: lColDividerComplete: =. T.

Thanks for your time
A greeting


Silvio
Las lineas de columnas si ocupan todo el Browse, pero lo que yo necesito es que las lineas de filas tambien se pinten aunque los datos no ocupen todo el Browse.
Estoy buscando una DATA como
//:lRowDividerComplete := .T. que no existe
al igual que existe
:lColDividerComplete := .T.

Gracias por tu tiempo
Un saludo
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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse with full grid

Postby ShumingWang » Fri May 17, 2013 3:32 am

You should add the lines :
//----------------------
while nRowPos <= nMaxRows

hBrush := CreateSolidBrush( Eval( ::bClreof, Self,nrowpos )[ 2 ] )
FillRect( hDC, {nRow, acols[1]-1, nrow+::DataHeight+1, nBrwWidth }, hBrush )
DeleteObject( hBrush )
nRowPos++
nRow += nRowHeight
enddo
//---------
/*
Paint lines
*/

do case
case nColStyle == LINESTYLE_NOLINES
nTemp := 2
case nColStyle < LINESTYLE_INSET
nTemp := 1
otherwise
nTemp := 0
end case

...
...
//----------------------
if nLast == Len( ::aDisplay )
nCol := acols[ nFor ] - nTemp
nWidth := ::BrwWidth() - 4
if nRowStyle != LINESTYLE_RAISED
DrawHorz( hDC, nRow, nCol, nWidth, hRowPen )
else
DrawHorz( hDC, nRow, nCol, nWidth, hWhitePen )
DrawHorz( hDC, nRow - 1, nCol, nWidth, hRowPen )
endif
if nRowStyle = LINESTYLE_INSET
DrawHorz( hDC, nRow - 1, nCol, nWidth, hWhitePen )
endif
endif
//-------------------

enddo
endif

::DispEnd( aInfo )

return 0

// end of paint() method
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
ShumingWang
 
Posts: 460
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Re: XBrowse with full grid

Postby cnavarro » Fri May 17, 2013 8:15 am

I was looking for a solution without modifying the class
I will test the code you've written

Thank you very much for your reply
regards

Buscaba una solucion sin modificar la clase
Probare el codigo que has escrito

Muchas gracias por tu respuesta
Saludos
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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse with full grid

Postby Silvio.Falconi » Fri May 17, 2013 9:05 am

have you try with oBrw:nRowDividerStyle := LINESTYLE_LIGHTGRAY ?
But you have the array EMPTY !!!!

Image


you cannot have the line for entire browse only if you create a empty array for sample

for n= 1 to 300
aadd(af," ")
next n

Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: XBrowse with full grid

Postby cnavarro » Fri May 17, 2013 10:17 am

Silvio
have you try with oBrw:nRowDividerStyle := LINESTYLE_LIGHTGRAY ?


Yes

But you have the array EMPTY !!!!


That effect is what I want to get (Type Excel)
In the attached image the array is empty but if column lines are

Image

thanks

Ese efecto es el que quiero obtener (Tipo Excel)
En la imagen adjunta el array esta vacio pero las lineas de columnas si aparecen

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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse with full grid

Postby cnavarro » Fri May 17, 2013 10:41 am

When defining a data containing Browse without initially, the visual aspect of the dialogue does not tell the user the type of control.
In other ancient versions of Browse, that was by default.
If you can define lines leaving all control columns, why not paint lines to rows too?
But if not contine browse any data, either columns painted lines.
Thanks for your time and greetings

Al definir un Browse sin que contenga datos inicialmente, el aspecto visual del dialogo no indica al usuario el tipo de control.
En otras versiones antiguas de Browse, eso estaba por defecto.
Si puedes definir que salgan las lineas de columnas en todo el control, ¿por que no poder pintar las lineas de filas tambien?
Pero si el browse no contine ningun dato, tampoco pinta las lineas de columnas.
Gracias por tu tiempo y saludos
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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse with full grid

Postby cnavarro » Sat May 18, 2013 1:00 am

Good night
If anyone is interested, with a few modifications I got what I needed

Creating the DATA lRowDividerComplete

In the Paint Method
Local lFinDatos: =. F

Spanish
Buenas noches
Por si a alguien le interesa, con unas pequeñas modificaciones he conseguido lo que necesitaba

Crear la DATA lRowDividerComplete

En el Method Paint
Local lFinDatos := .F.


Code: Select all  Expand view

// Aqui empieza la modificacion
// Here begins the modification
   /*
   Paint cols data
   */


      ::lRefreshOnlyData := .f.

      if ::nLen == 0 .and.  ( !::lRowDividerComplete  .or. !::lColDividerComplete )          // Aqui se añade   .and.  ( !::lRowDividerComplete  .or. !::lColDividerComplete )
                                                                      //  Here is added
                                                                      // Para que pinte lineas verticales aunque no haya datos
                                                                      // To paint vertical lines but no data  
         ::EraseData( nFirstRow  )
         ::DispEnd( aInfo )
         return nil
      endif

      nRowHeight := ::nRowHeight
      nHeight    := ::DataHeight()
      nMaxRows   := ::RowCount()
      nRowPos    := 1
      nRow       := nFirstRow
      nBookMark  := Eval( ::bBookMark )

      if ::nLen > 0                                                              // Añadir    if ::nLen > 0
                                                                                     // Add
         ::Skip( 1 - Min( ::nRowSel, nMaxRows ) )
      endif

      if nMarqStyle > MARQSTYLE_HIGHLCELL
         if ::hWnd == GetFocus()
            hSelBrush := CreateColorBrush( Eval( If( ::bClrRowFocus == nil, ::bClrSelFocus, ::bClrRowFocus ) )[ 2 ] )
         else
            hSelBrush := CreateColorBrush( Eval( ::bClrSel )[ 2 ] )
         endif
      endif

      do while nRowPos <= nMaxRows

         // We must also paint some times after the last visible column

         if hSelBrush != nil

            lHighLite := ::lMultiSelect .and. ( Ascan( ::aSelected, Eval( ::bBookMark ) ) > 0 )

            if aCols[ nLast + 1 ] < nBrwWidth
               nTemp     := nRow + nHeight
               nTemp2    := aCols[nLast + 1]
               if nColStyle < LINESTYLE_INSET
                  nTemp2--
               endif
               if lHighLite .and. ::nMarqueeStyle != MARQSTYLE_HIGHLWIN7
                  FillRect( hDC, {nRow, nTemp2, nTemp, nBrwWidth }, hSelBrush )
               else
                 if nMarqStyle == MARQSTYLE_HIGHLROWMS
                   if ! ::lTransparent
                      hBrush := CreateColorBrush( Eval( ::bClrStd )[ 2 ] )
                      FillRect( hDC, {nRow, nTemp2, nTemp, nBrwWidth }, hBrush )
                      DeleteObject( hBrush )
                   else
                      // ..../...
                   endif
                 else
                   // .../...
                 endif
               endif
            endif

         endif

         for nFor := 1 to nLast
            if aCols[ nFor ] > nBrwWidth
               exit
            endif
            oCol := ::ColAtPos( nFor )

            if !lFinDatos                                                     // Añadir ------> No pintar datos si no hay mas
                                                                                   // Add ------> Do not paint if no more data

               oCol:PaintData( nRow, aCols[ nFor ], nHeight, lHighLite, .f., nFor, nRowPos )

            endif
         next

         nRowPos++
         nRow += nRowHeight

         if ::Skip() == 0

            lFinDatos := .T.                                        // Añadir -----> Flags para indicar que no hay mas datos
                                                                           //Add -----> Flags to indicate that no more data
            if !::lRowDividerComplete                         // Añadir -----> Salir si no queremos pintar lineas horizontales
                                                                           // Add -----> Exit if you want to paint horizontal lines
                                                                           // Fin modificaciones    
                                                                           // End modifications  
               exit
            endif
         endif

      enddo

      if nMarqStyle <= MARQSTYLE_HIGHLCELL .and. aCols[ nLast + 1 ] < nBrwWidth .and. ! ::lTransparent
         hBrush := CreateColorBrush( ::nClrPane )
         nTemp  := aCols[nLast + 1] - 1
         FillRect( hDC, {nFirstRow, nTemp, ::BrwHeight() - ::FooterHeight(), nBrwWidth }, hBrush )
         DeleteObject( hBrush )
      else
         // ¿?

      endif

      if hSelBrush != nil
         DeleteObject( hSelBrush )
      endif

      ::nDataRows := nRowPos - 1
      ::nRowSel := Max( Min( ::nRowSel, ::nDataRows ), 1)

      if nRow < nLastRow
         ::EraseData( nRow  )
      endif

      Eval( ::bBookMark, nBookMark )

      ::DrawLine( .t. )

      /*
      Paint lines
      */


 


So far, the tests I've done, it works Ok
regards

Hasta ahora, las pruebas que he realizado, funciona Ok
Saludos

Version FWH 12.03
Last edited by cnavarro on Sat May 18, 2013 8:36 pm, edited 1 time in total.
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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse with full grid (Solved)

Postby Silvio.Falconi » Sat May 18, 2013 7:33 am

Before to change xbrowse class.. why not ask to Mr Nages?
I'm afraid you modified the xbrowse and you resolved but perhaps then there are problems for other situations!!!
Then when each time you purchase the new package of fwh, you must modify the xbrowse class....
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: XBrowse with full grid (Solved)

Postby cnavarro » Sat May 18, 2013 9:18 am

Silvio.Falconi wrote:Before to change xbrowse class.. why not ask to Mr Nages?
I'm afraid you modified the xbrowse and you resolved but perhaps then there are problems for other situations!!!
Then when each time you purchase the new package of fwh, you must modify the xbrowse class....


Silvio

Thanks for the advice
Since I started with Fivewin never modified the original classes of FW / FWH
I created always inheriting from classes that provide
So I found it very easy to maintain compatibility with later versions simply removing "my classes" the method or data that had been modified and that it resolved the problems I've encountered.
This way I can use the original class or that "I have created."
My English is very poor and not use Google Translate if I explain well.
Of course what I wrote in the forum is a small proposal that if interested studied.
Thanks again
regards

Gracias por el consejo
Desde que empecé con Fivewin nunca he modificado las clases originales de FW/FWH
He creado siempre clases que heredaban de las que proporcionan
Asi me ha sido muy facil mantener compatibilidad con posteriores versiones simplemente eliminando de "mis clases" los method o data que se habian modificado y que ya resuelven los problemas con los que me he encontrado.
De esta forma puedo usar la clase original o la que "yo he creado".
Mi ingles es muy pobre y uso Google Translate y no se si me explico bien.
Por supuesto que lo que he escrito en el foro es una pequeña propuesta para que si estan interesados se estudie.
Gracias de nuevo
Saludos
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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 98 guests