XBrowse y Grupo de Columnas

XBrowse y Grupo de Columnas

Postby cnavarro » Sun Aug 18, 2013 10:58 pm

Hola
He realizado unas pequeñas modificaciones para poder ocultar (hide) o mostrar (show) todas las columnas de un xbrowse pertenecientes a un grupo que hayamos definido, o sea, ocultar o mostrar el grupo.
La condición que he establecido es que no se hayan definido títulos de columnas, solo títulos de grupo
Si se han definido títulos de columnas sigue funcionando igual que antes, hay que ocultarlas (hide) o mostrarlas (show) de forma individual
Quizás esto se podría también definir si se detecta si pulsamos el botón derecho sobre la zona de títulos de columnas o sobre la zona de los títulos de grupo

En mi versión FWH 12.03 no aparece. No se si en las versiones actuales esta implementado.
Este es el código de las funciones / Métodos modificados por si queréis echarle un vistazo y también pongo unas imágenes
Son:
El METHOD SetColumns( nRow, nCol, nFlags ) CLASS TXBrowse
y la funcion
static function GenMenuBlock( aCols, nFor, oXbrw )

Code: Select all  Expand view

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

METHOD SetColumns( nRow, nCol, nFlags ) CLASS TXBrowse

   local oMenu, oCol
   local nFor, nLen
   local cText      := ""
   local oItem

   nLen := Len( ::aCols )

   MENU oMenu POPUP
   oMenu:l2007    := ::l2007
   oMenu:l2010    := !::l2007
      for nFor := 1 to nLen
         oCol := ::aCols[ nFor ]
         if !Empty( oCol:cHeader ) //.and. Empty( oCol:cGrpHdr )
            MenuAddItem( oCol:cHeader, , !oCol:lHide, ;
               ( Len(::aDisplay) != 1 .or. oCol:nPos != 1 ), ;
               GenMenuBlock( ::aCols, nFor, Self ) )
         else                                                         // 17/08/2013
            if !Empty( oCol:cGrpHdr )
               if Empty( cText )
                  cText  := oCol:cGrpHdr
                  MenuAddItem( cText, , !oCol:lHide, ;
                     ( Len(::aDisplay) != 1 .or. oCol:nPos != 1 ), ;
                     GenMenuBlock( oCol, nFor, Self ) )
               endif
            else
               cText  := ""
               /*
               oItem := MenuAddItem( " - ", , !oCol:lHide, ;
                  ( Len(::aDisplay) != 1 .or. oCol:nPos != 1 ), ;
                  GenMenuBlock( ::aCols, nFor, Self ) )
               oItem:bWhen := { || .F. }
               */

            endif
         endif
      next
   ENDMENU

   ACTIVATE POPUP oMenu AT nRow, nCol OF Self

return nil

//----------------------------------------------------------------------------//
      //
      //  Estructura del array  ::aHeaderTop
      //        1         2     3     4            5
      // { oCol:cGrpHdr, oCol, nFor, nFor, oCol:HeaderHeight( .t. ), ;
      //   oCol:aBitmap( oCol:nGrpBmpNo ) }
      //              6
//----------------------------------------------------------------------------//


static function GenMenuBlock( aCols, nFor, oXbrw )   // Se ha añadido el parametro oXBrw

   local oCol
   local n        := 0
   local nGrps    := 0
   local nGrp1    := 0
   local nGrp2    := 0
   local uRet     := {|| .T. }
   local aGrp     := {}

   if ValType( aCols ) = "A"
      oCol := aCols[ nFor ]
      uRet := {|| iif( oCol:lHide, oCol:Show(), oCol:Hide() ) }
   else                                                      // 17/08/2013
      if !Empty( oXbrw:aHeaderTop )
         nGrps := Len( oXbrw:aHeaderTop )
         For n = 1 to nGrps
             if nFor >= oXbrw:aHeaderTop[ n ][ 3 ] .and.  ;
                nFor <= oXbrw:aHeaderTop[ n ][ 4 ]
                nGrp1 := oXbrw:aHeaderTop[ n ][ 3 ]
                nGrp2 := oXbrw:aHeaderTop[ n ][ 4 ]
                n := nGrps + 1
             endif
         Next n
         n := 0
         if !Empty( nGrp1 ) .and. !Empty( nGrp2 )
            For n = nGrp2 to nGrp1 step -1
                oCol := oXbrw:aCols[ n ]
                AAdd( aGrp, oCol )
            Next n
           /*
            if nGrp2 < Len( oXbrw:aCols )
               n := nGrp2 + 1
            else
               n := nGrp1 - 1
            endif
            if Empty( oXbrw:aCols[ n ]:aBitmaps )  //? oXbrw:aCols[ n ]:Value()
               AAdd( aGrp, oXbrw:aCols[ n ] )
            endif
            */

            if !Empty( aGrp )
            uRet := {|| AEval( aGrp, {|oC| iif(oC:lHide, oC:Show(), oC:Hide()) } )}
            endif
         endif
      endif
   endif

return uRet

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


Image

Image

Image

Uploaded with ImageShack.us

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: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse y Grupo de Columnas

Postby nageswaragunupudi » Mon Aug 19, 2013 8:46 pm

Interesting feature. Hiding and unhiding of entire group is not yet provided.

More interesting is the way you used xbrowse to create a metro panel like look. It would be useful to all if you can post some sample to create this browse.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10313
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBrowse y Grupo de Columnas

Postby FranciscoA » Mon Aug 19, 2013 10:10 pm

Cristábal,
Felicitaciones por tu creatividad con xbrowse. Podrías mostrar un ejemplo?
Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2114
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: XBrowse y Grupo de Columnas

Postby cnavarro » Tue Aug 20, 2013 4:54 pm

[ESPAÑOL]

Mr. Rao, Francisco
Gracias por su interes.
Puedo preparar un ejemplo para enviar.
Estoy probando en distintas resoluciones de monitores para realizar el ajuste del numero de filas y columnas que se pueden utilizar.
Las imagenes que he puesto estan en un ordenador de 1366 x 768
Pero yo utilizo una clase propia heredada de XBrowse con las siguientes características, que en mi version FWH 12.03 no estaban incluidas, y he tenido que hacer pequeñas modificaciones:
- Eliminar todas las lineas horizontales y verticales del area de datos, de los titulos de columnas, y de los pies de columnas.
- Modificar el metodo KeyDown para que salte las celdas y columnas vacias, programado con una data lNoEmpty cuando te mueves con el teclado
- Modificar el metodo PaintHeader de columnas para que pinte los titulos de grupos mas cerca del area de datos cuando no hay titulos de columnas.

Usted puede adaptar facilmente todas estas propiedades porque he leido en el foro que en la version actual de XBrowse, muchas de ellas estan proporcionadas.

En unos dias pongo el codigo.
Saludos

[SPANISH]

Mr. Rao, Francisco
Thanks for your interest.
I can prepare a sample to send.
I'm testing monitors in different resolutions to adjust the number of rows and columns that can be used.
I put pictures on a computer are 1366 x 768
But I use a custom class inherited from xBrowse with the following characteristics, which in my version FWH 12.03 were not included, and I had to make small changes:
- Remove all horizontal and vertical lines of the area of data, column titles, and feet of columns.
- Modify the KeyDown method to skip empty cells and columns, programmed with a data lNoEmpty when you move with the keyboard
- Modify the method PaintHeader of columns to paint groups titles closer to the data area when no titles of columns.

You can easily adapt these properties because they've read in the forum that in the current version xBrowse, many of which are provided.

In a few days I put the code.
regards
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: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse y Grupo de Columnas

Postby nageswaragunupudi » Tue Aug 20, 2013 5:25 pm

Mr Navarro

Thanks and I understood your customization.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10313
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBrowse y Grupo de Columnas

Postby cnavarro » Tue Aug 20, 2013 5:38 pm

nageswaragunupudi wrote:Interesting feature. Hiding and unhiding of entire group is not yet provided.

More interesting is the way you used xbrowse to create a metro panel like look. It would be useful to all if you can post some sample to create this browse.


Esta es la apariencia usando XBrowse de FWH 12.03

This is the appearance using FWH 12.03 xBrowse

Image

Hago algunas preguntas por si puede ayudarme en algunos conceptos que necesito optimizar:
- Las lineas de titulos de columnas se podrian "eliminar" dibujando las lineas con el mismo color del fondo de la cabecera, ¿ como puedo definir el color de las lineas?

- Los nombres de grupos siempre alineados en el centro (AL_CENTER), ¿ como modificar para que salgan AL_LEFT o AL_RIGHT?

- ¿Como puedo pintar texto en la celda que tengo el bitmap?

- ¿Como saber si la celda esta vacia ? no tiene ningun texto y no tiene ningun bitmap

- ¿Como saber si el estilo del control contiene WS_BORDER (cuando REDEFINO el control)?

Gracias



Some questions if I can help in some concepts that I need to optimize:
  - The lines of columns titles could "eliminate" drawing lines with the same color of the header background, how I can set the color of the lines?

  - The names of groups always aligned in the center (AL_CENTER), how to come out AL_LEFT modify or AL_RIGHT?

  - Like I can paint text in the cell that I have the bitmap?

  - How to know if the cell is empty? does not have any text and has no bitmap

- How to know if the control contains WS_BORDER style (when I redefine control)?

Regards
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: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse y Grupo de Columnas

Postby cnavarro » Wed Aug 21, 2013 6:06 pm

Esto solucionado

- ¿Como saber si el estilo del control contiene WS_BORDER (cuando REDEFINO el control)?

- How to know if the control contains WS_BORDER style (when I redefine control)?


Code: Select all  Expand view

 lAnd( ::nStyle, WS_BORDER )
 
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: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse y Grupo de Columnas

Postby nageswaragunupudi » Wed Aug 21, 2013 10:34 pm

The lines of columns titles could "eliminate" drawing lines with the same color of the header background, how I can set the color of the lines?

If oBrw:bClrHeader evaluates to an array of 3 colors, 3rd color is taken as the line color of the header. Please check if this works in version 12.03. If not, you may change your xbrowse.prg. This change is consistent with present versions.

- The names of groups always aligned in the center (AL_CENTER), how to come out AL_LEFT modify or AL_RIGHT?

This is not provided even in the current version.
You need to change xbrowse.prg or override paintheader() method of TXBrwColumn
- Like I can paint text in the cell that I have the bitmap?

Yes. I shall answer this separately
- How to know if the cell is empty? does not have any text and has no bitmap

Check for these codeblocks : bStrData, bBmpData and bStrImage. All these cideblocks must be either nil or evaluate to empty.

You can make a generic function like IsCellEmpty() or EmptyCell()
Or even a method in the derived class.
- How to know if the control contains WS_BORDER style (when I redefine control)?

lAnd( oBrw:nStyle, WS_BORDER ) checks only for browse created from sourcecode.

Use this check
lAnd( GetWindowLong( oBrw:hWnd, GWL_STYLE ), WS_BORDER )
after the window is created.

In recent versions of FWH you can also Query ? oBrw:WinStyle( WS_BORDER )
This method is available for all windows. dialogs and controls
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10313
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBrowse y Grupo de Columnas

Postby cnavarro » Wed Aug 21, 2013 11:34 pm

Mr. Rao

Muchas gracias por sus comentarios

Thank you very much for your comments

The lines of columns titles could "eliminate" drawing lines with the same color of the header background, how I can set the color of the lines?

If oBrw:bClrHeader evaluates to an array of 3 colors, 3rd color is taken as the line color of the header. Please check if this works in version 12.03. If not, you may change your xbrowse.prg. This change is consistent with present versions.


bClrHeader es un array de 3 posibles colores como minimo.
En mi version es usado para crear :

bClrHeader is an array of 3 possible colors minimum.
In my version is used to create:

hHeaderPen := CreatePen( PS_SOLID, 1, aColors[ Min( 3, Len( aColors ) ) ] )

Pero hay que cambiar hGrayPen y hWhitePen. Son los que utilizan DrawVert y DrawHorz

But you have to change hGrayPen and hWhitePen. They are using DrawVert and DrawHorz

- The names of groups always aligned in the center (AL_CENTER), how to come out AL_LEFT modify or AL_RIGHT?

This is not provided even in the current version.
You need to change xbrowse.prg or override paintheader() method of TXBrwColumn


Si, ya lo tengo implementado

Yes, I have already implemented

- Like I can paint text in the cell that I have the bitmap?

Yes. I shall answer this separately


Estoy impaciente por su respuesta
Hace mucho tiempo que estoy intentando hacerlo y no he podido

I look forward to your response
A long time ago I'm trying to do and I could not

- How to know if the cell is empty? does not have any text and has no bitmap

Check for these codeblocks : bStrData, bBmpData and bStrImage. All these cideblocks must be either nil or evaluate to empty.

You can make a generic function like IsCellEmpty() or EmptyCell()
Or even a method in the derived class.


Con sus indicaciones podré mejorar y terminar de implementar la funcion que uso

With your instructions I can improve and complete the implementation of the function that use

- How to know if the control contains WS_BORDER style (when I redefine control)?

lAnd( oBrw:nStyle, WS_BORDER ) checks only for browse created from sourcecode.

Use this check
lAnd( GetWindowLong( oBrw:hWnd, GWL_STYLE ), WS_BORDER )
after the window is created.


Si, ese era el problema, lo tengo que comprobar antes del CreateFrom.....()
Lo habia solucionado

Yes, that was the problem, I have to check before CreateFrom ..... ()
I had solved

http://forums.fivetechsupport.com/viewtopic.php?f=6&t=27026#p150096

In recent versions of FWH you can also Query ? oBrw:WinStyle( WS_BORDER )
This method is available for all windows. dialogs and controls


Si, voy a actualizarme en muy poco tiempo.
Es imprescindible para no trabajar en detalles que ya estan desarrollados.

Yes, I will update me in no time.
It is imperative not to work and waste time on details that are already developed.

Con sus indicaciones gran parte de codigo de mi clase heredada lo eliminare
With much of code indications of what will eliminate my inherited class

Para salir de la aplicacion pulsar sobre el icono de usuario

Le doy las gracias de nuevo
Gran herramienta XBrowse. Hay que dedicarle mucho tiempo a su estudio para poder utilizar toda su potencia.
Yo estoy empezando.

I thank you again
Great tool xBrowse. You have to devote much time to studying in order to use its full power.
I'm starting.
Last edited by cnavarro on Thu Aug 22, 2013 9:21 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: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse y Grupo de Columnas

Postby cnavarro » Thu Aug 22, 2013 12:46 am

Hola

Codigo de como implementarlo con XBROWSE, pero:

- No salta las columnas vacias al moverte con el teclado
- Permite seleccionar columnas y celdas vacias con el raton ( no debe permitirse )
- Los titulos de grupo no aparecen alineados a la izquierda
- Al pulsar boton derecho en los titulos de columnas no aparecen los grupos
Hay que implementarlo segun el primer post de este hilo
- Los bitmaps de mi ejemplo anterior no tienen fondo transparente

La clase heredada que utilizo y que contiene las caracteristicas anteriores la podre poner en unos dias cuando la tenga depurada.

He cambiado los bitmaps por los que incluye FW
Solo hay que copiarlo en el directorio SAMPLES de FWH y compilarlo con BUILDH


Code of how to implement it with xBrowse, but:

- Does not skip empty columns to move with the keyboard
- Select columns and empty cells with the mouse (not be allowed)
- The group titles are not aligned to the left
- Pressing the right button in the titles of columns are not groups
   You have to implement it according to the first post of this thread
- The bitmaps in my example above does not have transparent background

The inherited class to use and contains the above features the podre put in a few days when you have it refined.

I changed the bitmaps by including FW
You just have to copy it into the directory and compile FWH SAMPLES with BUILDH

Code: Select all  Expand view

#include "Fivewin.ch"
#include "xbrowse.ch"

//#include "colores.ch"
#define METRO_TURQUE   RGB( 0, 128, 128 )
#define METRO_ROJO1    RGB( 115, 13, 26 )
#define METRO_ROJO2    RGB( 224, 67, 67 )
#define METRO_AZUL0    RGB( 118,148,168 )
#define METRO_AZUL1    RGB(   0,140,255 )
#define METRO_AZUL2    RGB(   0,175,242 )
#define METRO_AZUL3    RGB(   0, 32, 80 )
#define METRO_AZUL4    RGB(   0, 22, 62 )
#define METRO_AZUL5    RGB(   0,191,255 )
#define METRO_AZUL6    RGB( 196,255,255 )
#define METRO_AZUL7    RGB(   0, 50,128 )
#define METRO_AZUL8    RGB(  43, 87,154 )
#define METRO_AZUL9    RGB(   0, 25, 64 )
#define METRO_MORA1    RGB( 116, 40,148 )
#define METRO_GRIS1    RGB(  17, 17, 17 )
#define METRO_GRIS2    RGB(  51, 51, 51 )

#define METRO_BTNFACE             RGB( 240,240,240 )
#define METRO_WINDOW              RGB( 255,255,255 )
#define METRO_MENU                RGB( 240,240,240 )
#define METRO_MENUTEXT            RGB(   0,  0,  0 )
#define METRO_BACKGROUND          RGB(   0,  0,  0 )
#define METRO_APPWORKSPACE        RGB( 171,171,171 )
#define METRO_ACTIVECAPTION       RGB( 153,180,209 )
#define METRO_INACTIVECAPTION     RGB( 191,205,219 )
#define METRO_CAPTIONTEXT         RGB(   0,  0,  0 )
#define METRO_ACTIVEBORDER        RGB( 180,180,180 )
#define METRO_INACTIVEBORDER      RGB( 244,247,252 )
#define METRO_HIGHLIGHT           RGB(  51,153,255 )
#define METRO_HIGHLIGHTTEXT       RGB( 255,255,255 )
#define METRO_BTNSHADOW           RGB( 160,160,160 )
#define METRO_GRAYTEXT            RGB( 109,109,109 )
#define METRO_BTNTEXT             RGB(   0,  0,  0 )
#define METRO_INACTIVECAPTIONTEXT RGB(   0,  0,  0 )
#define METRO_BTNHIGHLIGHT        RGB( 255,255,255 )
#define METRO_3DDHSHADOW          RGB( 105,105,105 )
#define METRO_3DLIGHT             RGB( 227,227,227 )
#define METRO_INFOTEXT            RGB(   0,  0,  0 )
#define METRO_INFOBK              RGB( 255,255,255 )
#define METRO_WINDOWFRAME         RGB( 100,100,100 )
#define METRO_WINDOWTEXT          RGB(   0,  0,  0 )
#define METRO_SCROLLBAR           RGB( 200,200,200 )


#define BTN_UP              1
#define BTN_DOWN            2
#define BTN_DISABLE         3
#define BTN_OVERMOUSE       4

static oWndUI

Function Main( lMax )
local oMnu
local oBrush
local nColor    := METRO_AZUL3   //APPWORKSPACE
local cShow     := "MAXIMIZED" //IF( lMax, "MAXIMIZED", "NORMAL" )
local oTitUI
local cTitUI    := "Titulo Aplicacion"
local oTUserUI
local cTUserUI  := "Usuario"
local oFont1    := TFont():New("Segoe UI Light", 0 , -54 )    //-12
local oFont2    := TFont():New("Segoe UI Light", 0 , -24 )    //-12
local nColor1   := METRO_WINDOW
local nColor2   := METRO_AZUL3
local oBtn
local  bBttIco  := { || oWndUI:End() }
Local aBmps1      := { ;
                       "..\Bitmaps\32x32\edit.bmp" ,;
                       "..\Bitmaps\32x32\new.bmp" ,;
                       "..\Bitmaps\32x32\down.BMP" ,;
                       "..\Bitmaps\32x32\copy.BMP"      ;
                     }

Local aBmps2      := { ;
                       "..\Bitmaps\alphabmp\chat.BMP" ,;
                       "..\Bitmaps\alphabmp\calendar.bmp"   ,;
                       "..\Bitmaps\alphabmp\folder.bmp" ;
                       }
Local aBmps3      := { ;
                       "..\Bitmaps\alphabmp\cilinder.bmp",;
                       "..\Bitmaps\alphabmp\lock.bmp",;
                       "..\Bitmaps\alphabmp\android.bmp",;
                       "..\Bitmaps\alphabmp\terminal.bmp";
                     }

Local aBmps4      := { ;
                       "..\Bitmaps\alphabmp\trash.bmp" ;
                     }

Local aBmps5      := { ;
                       "..\Bitmaps\alphabmp\printer.bmp",;
                       "..\Bitmaps\32x32\movie.bmp"   ;
                       }
Local aBmps6      := { ;
                       "..\Bitmaps\alphabmp\weather.bmp" ,;
                       "..\Bitmaps\alphabmp\widgets.bmp"        ,;
                       "..\Bitmaps\alphabmp\text.bmp"       ,;
                       "..\Bitmaps\alphabmp\phone.bmp"  ;
                     }
Local aBmps7      := { ;
                       "..\Bitmaps\alphabmp\pendrive.bmp" ,;
                       "..\Bitmaps\alphabmp\imac.bmp" ,;
                       "..\Bitmaps\alphabmp\movie.bmp"  ;
                     }

Local aBmps8      := { ;
                       "..\Bitmaps\32x32\floppy.bmp",;
                       "..\Bitmaps\32x32\fax.bmp",;
                       "..\Bitmaps\32x32\goto.bmp",;
                       "..\Bitmaps\32x32\graphics.bmp";
                     }

Local aBmps9      := { ;
                       "..\Bitmaps\32x32\help.bmp",;
                       "..\Bitmaps\32x32\info.bmp",;
                       "..\Bitmaps\32x32\keys.bmp";
                       }


Local aBmps     := { aBmps1, aBmps2, , aBmps3, aBmps4, , ;
                     aBmps5, aBmps6, , aBmps7, aBmps8 , aBmps9 }

Local aTitGrps  := { "Grupo Inicial","Grupo Trabajo","Otras Pruebas","Mis Utilidades" }


   DEFINE BRUSH oBrush COLOR nColor

   DEFINE WINDOW oWndUI ;
          MENU oMnu ;
          BRUSH oBrush

  NoTitle()

   @ 42, 105 SAY oTitUI PROMPT cTitUI OF oWndUI ;
        FONT oFont1 ;
        PIXEL COLOR nColor1, nColor2 ;
        SIZE GetTextWidth(0,cTitUI, oFont1:hFont )+20, (-(oFont1:nInpHeight)+14) //;

   @ 68, ScreenWidth()-240 SAY oTUserUI PROMPT cTUserUI OF oWndUI ;
        FONT oFont2 ;
        PIXEL COLOR nColor1, nColor2 ;
        SIZE GetTextWidth(0,cTUserUI, oFont2:hFont ), (-(oFont2:nInpHeight)+14) //;

                                             // 24, 24
   oBtn := TBtnBmp():New( 70, ScreenWidth()-90, 32, 32,,, "..\Bitmaps\32x32\user.bmp",,;
                                             bBttIco, oWndUI,,, .F., .F.,,,,, !.T.,, .F.,, ,;
                                             .T.,, !.F.,, .T., .F. )
  UIMnu( aBmps, aTitGrps, 118 )

  ACTIVATE WINDOW oWndUI MAXIMIZED //ON INIT NoTitle()

Return nil

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

Function NoTitle()
Return SetWindowLong( oWndUI:hWnd, -16, "L" )

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

Function UIMnu( aBmps, aTitGrps, nSzBmp  )
Local oXBrw
Local n       := 0
Local z       := 0
Local aT      := {}
Local x
//Local oWClient      := oWndUI
Local nWidth        := 645
                    //if( oWinUI:lMdiUI, oWClient:oWndClient:nWidth - 4, ScreenWidth() - 5 ) //oWClient:nWidth - 4 )
Local nHeight       //:= if( oWinUI:lMdiUI, oWClient:oWndClient:nHeight -2 - 26, ScreenHeight() - 68 ) //oWClient:nHeight + 100 )
Local oDlg
Local oBrush1
Local oFont1
Local oRect
Local y             := 0
Local nColumnas     := 0
Local nFilas        := 0
Local nColVacias    := 0
Local nNumFilas     := 0
Local nMonitor      := 0   //TipoMonitor()
Local aGruposHeader := {}
Local nBmp          := 3
Local aBitmaps      := {}
Local aBmpPal
Local nPonBorde     := 0
Local hOldWhite
Local hOldShadow
local oFont2    := TFont():New("Segoe UI Light", 0 , -24 )    //-12

DEFAULT aBmps     := {}

DEFAULT aTitGrps  := {}
DEFAULT nSzBmp    := 118

   Do Case
      Case nMonitor = 0
           nFilas     := 4
           nColumnas  := 9
           nColVacias := 3

      Case nMonitor = 1
           nFilas     := 5
           nColumnas  := 11
           nColVacias := 5

      Case nMonitor = 2
           nFilas     := 6
           nColumnas  := 13
           nColVacias := 7

   EndCase

   For n := 1 to Len( aBmps )
       if !Empty( aBmps[ n ] )
          z := Max( z , Len( aBmps[ n ] ) )
       endif
   Next n
   nNumFilas := z
   //z   := Min( z , nColumnas )
   For n := 1 to z
       AAdd( aT, n )
   Next n
   z := 0
   y := 0
    For n := 1 to Len( aBmps )
       if !Empty( aBmps[ n ] )
          if Empty( y )
             y := n
          endif
          if n <= nColumnas + nColVacias
             AAdd( aBitmaps , SetImgUI( aBmps[ n ], nSzBmp, nSzBmp, , ) )
          endif
       else
          AAdd( aGruposHeader, { "Grupo: "+Strzero(y,2)+" a "+Strzero(n-1,2), y, n-1, nil } )
          y := 0
       endif
    Next n
    if y > 0
      AAdd( aGruposHeader, { "Grupo: "+Strzero(y,2)+" a "+Strzero(n-1,2), y, n-1, nil } )
    endif
    For n := 1 to Len( aTitGrps )
        if Len( aGruposHeader ) >= n
        aGruposHeader[ n ][ 1 ] := aTitGrps[ n ]
        endif
    Next n

   y := 0
   nHeight       := GetSysMetrics(1) - 68
                // ScreenHeight()
   DEFINE BRUSH oBrush1 COLOR METRO_AZUL3  //CLR_WHITE
   DEFINE FONT oFont1 NAME "Segoe UI LIGHT" SIZE 0, -22  //-12

   //oDlg  := oWClient

          //TXCBrowse
   oXBrw := TXBrowse():New( oWndUI  )    //oDlg )

   WITH OBJECT oXBrw

   :nStyle            -= WS_BORDER
   //nPonBorde          := 3

   :lTransparent      := .F.
   :cCaption          := ""    //"Prueba de Browse"
   :l2007             := .F.
   :lAllowColHiding   := .T.
   :lAllowColSwapping := .F.
   :lVScroll          := .F.
   :lHScroll          := .F.
   :nRowHeight        :=  124
   //:nFreeze           :=  1
   :nMarqueeStyle     :=  3  //4     //MARQSTYLE_HIGHLCELL   3

   nWidth   := 0
   For n = 1 to Len( aBmps )
       if !Empty( aBmps[ n ] )
          nWidth += ( oXBrw:nRowHeight ) //+ 4
       else
          nWidth += INT( oXBrw:nRowHeight / 3 ) //+ 4
       endif
   Next n
   nWidth += 2*Len( aBmps )

   :lHeader        := .T.
   :nHeaderHeight  :=  32

   :lFooter        := .F.
   :nFooterHeight  :=  0 //32

   :nTop           := 168 - IF( :lHeader, :nHeaderHeight, 0 )
   :nLeft          := Min( (100 - IF( !:lVScroll, 0, 18 ) - IF( Empty( nPonBorde ), -3 , nPonBorde )),;
                           (GetSysMetrics( 0 ) - nWidth - IF( !:lVScroll, 0, 18 ) - nPonBorde ))

   nHeight  := :nRowHeight * nNumFilas + :nTop + 1

   nWidth += :nLeft + nPonBorde - IF( Empty( nPonBorde ) , 0 , 1 )

   :nBottom        := nHeight + IF( !:lHScroll, 0 , 18 ) + ;
                      IF( :lFooter, :nFooterHeight, 0 )  + ;                 //+20
                      IF( !Empty( aGruposHeader ), :nHeaderHeight*IF(:lHeader,2,1), 0 )
                      //IF( :lHeader, :nHeaderHeight + 4, 0 ) + ;
   :nRight         := nWidth  + IF( !:lVScroll, 0 , 18 )
   :oBrush         := oBrush1
   :lDesign        := .F.
   :SetFont( oFont1 )

   // DATAs del XCBrowse
   if Upper( oXBrw:ClassName() ) == "TXCBROWSE"
      oXBrw:lHeadSelec          := .F.
      oXBrw:lLinBorder          := .F.
      oXBrw:lLinDataSep         := .F.
      oXBrw:lLinHeadVSep        := .F.
      oXBrw:lLinHeadHSep        := .F.
      oXBrw:lLinFootVSep        := .F.
      oXBrw:lLinFootHSep        := .F.
      oXBrw:lHeadBtton          := .F.
      oXBrw:lRowDividerComplete := .F.
      oXBrw:lNoEmpty            := .T.
      //:nWRecordSel              :=  24
      //:nSpRecordSel             :=  0
   else
      hOldWhite    := :hWhitePen
      hOldShadow   := :hBtnShadowPen
   
      :hWhitePen      := CreatePen( PS_SOLID, 1, METRO_AZUL3 )
      :hBtnShadowPen  := CreatePen( PS_SOLID, 1, METRO_AZUL3 )
   endif

   :lRecordSelector   := .F.
   :nRowDividerStyle  := LINESTYLE_NOLINES        //4
   :nColDividerStyle  := LINESTYLE_NOLINES        //4

   :nRecSelColor      := METRO_AZUL8  //APPWORKSPACE   //Rgb( 202, 162, 126 )
   //:nStretchCol       := STRETCHCOL_LAST
   :nDataLines        :=  1

   :bClrHeader  := { || { CLR_WHITE, METRO_AZUL3, METRO_AZUL3 } }
   :bClrFooter  := { || { CLR_WHITE, METRO_AZUL3, METRO_AZUL3 } }

   :bClrSel           := { || { CLR_BLACK, METRO_AZUL8 } }
   :bClrStd           := { || { CLR_BLACK, METRO_AZUL3 } }
   :bClrStds          := { || { CLR_BLACK, METRO_AZUL3 } }
   :bClrSelFocus      := { || { CLR_BLACK, ;
                              if( len( oXBrw:aCols[ oXBrw:nColSel ]:aBitmaps ) >= oXBrw:nRowSel,;
                                 METRO_AZUL8, METRO_AZUL3 ) } }
                                         //8
   :SetColor( CLR_BLACK, METRO_AZUL3 )

   :SetArray( aT )  //aT
   :lAutoSort         := .F.
   :bKeyChar                := {|x,y,nF,oCol| XBrw1Elige( oXBrw:nArrayAt, oXBrw, x, y, oXBrw:nRowSel, oXBrw:nColSel, nF, oCol ) }

   n := 0
   For n := 1 to Len( aBmps )
       if oXBrw:lHeader
          oXBrw:aCols[ n ]:bClrHeader  := { || { CLR_WHITE, METRO_AZUL3 } }
          //oXBrw:aCols[ n ]:nHeadStrAlign := 0
          if !Empty( aBmps[ n ] )
             oXBrw:aCols[ n ]:cHeader     := "" //"Columna"
          endif
       endif
       if oXBrw:lFooter
          oXBrw:aCols[ n ]:bClrFooter  := { || { CLR_WHITE, METRO_AZUL3 } }
          if !Empty( aBmps[ n ] )
             oXBrw:aCols[ n ]:cFooter     := "" //"Final"
          endif
       endif
       if !Empty( aBmps[ n ] )
          z++
          oXBrw:aCols[n]:nWidth          := oXBrw:nRowHeight
          oXBrw:aCols[n]:aBitmaps        := aBitmaps[z]
          oXBrw:aCols[n]:bStrData        := { || Nil }
          oXBrw:aCols[n]:bBmpData        := { | oB | oXBrw:nArrayAt }
          oXBrw:aCols[n]:nDataStrAlign   := 1
          oXBrw:aCols[n]:lBmpStretch     := .F. // Rellenar toda la celda con el BitMap
          oXBrw:aCols[n]:lAllowSizing    := .F.
          oXBrw:aCols[n]:nEditType       := 0
          oXBrw:aCols[n]:lColTransparent := .F. // No funciona si el del Browse SI es TRANSPARENT
          oXBrw:aCols[n]:lBmpTransparent := .F.
          oXBrw:aCols[n]:bClrSel         := { || { , METRO_AZUL3 } }
          //oXBrw:aCols[n]:bClrStd         := { || { CLR_BLACK, METRO_AZUL3 } }
          //oXBrw:aCols[n]:bClrSelFocus    := { || { CLR_BLACK, METRO_AZUL3 } }
          oXBrw:aCols[n]:bLDClickData    := {|x,y,nF,oCol| ;
                                                 XBrw1Elige( oXBrw:nArrayAt,;
                                                 oXBrw, x, y, oXBrw:nRowSel,;
                                                 oXBrw:nColSel, nF, oCol )  }
          if n < Len( aBmps )
             oXBrw:AddCol()
          endif
       else
          if n < Len( aBmps )
             oXBrw:AddCol()
             oXBrw:aCols[n]:nWidth            := Int( oXBrw:nRowHeight / 3 ) //+1
             oXBrw:aCols[n]:bClrSel           := { || { , METRO_AZUL3 } }
             oXBrw:aCols[n]:bClrStd           := { || { , METRO_AZUL3 } }
             oXBrw:aCols[n]:bClrSelFocus      := { || { , METRO_AZUL3 } }
          endif
       endif
   Next n

   For n = 1 to Len( aGruposHeader )
   :SetGroupHeader( aGruposHeader[n][1], aGruposHeader[n][2], aGruposHeader[n][3], oFont2 )
   Next n

   :CreateFromCode()


   //:hWhitePen      := hOldWhite
   //:hBtnShadowPen  := hOldShadow


   aBitmaps  := Nil
   aBmps     := Nil

   END

   while oFont1:nCount > 0
         oFont1:End()
   end
   //oFont1:End()
   oBrush1:End()
   oFont1   := Nil
   oBrush1  := Nil

Return oXBrw

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

Function SetImgUI( aBmps, nH, nW, oButton, nPos )
Local x
Local aBitmaps  := {}
Local aBmpPal
Local cExt      := ""
Local uFile     := ""

DEFAULT aBmps   := {}
DEFAULT nH      := 32
DEFAULT nW      := 32
DEFAULT oButton := Nil
DEFAULT nPos    := 0

if !empty( aBmps )
   Do Case
      Case Valtype( aBmps ) = "C"

           uFile         := aBmps
           cExt          :=  Right( Upper( uFile ), 3 )
           Do Case
              Case Upper( cExt ) = "BMP"

                    AAdd( aBitmaps, Array(6) )
                    aBmpPal   := PalBmpRead( , aBmps )
                    aBitmaps[ x, 1 ]   :=  aBmpPal[ 1 ]
                    aBitmaps[ x, 2 ]   :=  aBmpPal[ 2 ]
                    aBitmaps[ x, 3 ]   :=  nH   //64
                    aBitmaps[ x, 4 ]   :=  nW   //108
                    aBitmaps[ x, 5 ]   :=  0
                    aBitmaps[ x, 6 ]   :=  .F.
                    aBmpPal   := Nil

              Case Upper( cExt ) = "PNG"

                    AAdd( aBitmaps, Array(6) )
                    aBmpPal := FWOpenPngFile( aBmps )
                    aBitmaps[ x, 1 ]   :=  aBmpPal
                    aBitmaps[ x, 2 ]   :=  0
                    aBitmaps[ x, 3 ]   :=  nH   //64
                    aBitmaps[ x, 4 ]   :=  nW   //108
                    aBitmaps[ x, 5 ]   :=  0
                    aBitmaps[ x, 6 ]   :=  .F.
                    aBmpPal   := Nil


           EndCase

      Case Valtype( aBmps ) = "A"

        For x = 1 to Len( aBmps )
            uFile        := aBmps[ x ]
            cExt         :=  Right( Upper( uFile ), 3 )
            Do Case
               Case Upper( cExt ) = "BMP"

                    AAdd( aBitmaps, Array(6) )
                    aBmpPal   := PalBmpRead( , aBmps[x] )
                    aBitmaps[ x, 1 ]   :=  aBmpPal[ 1 ]
                    aBitmaps[ x, 2 ]   :=  aBmpPal[ 2 ]
                    aBitmaps[ x, 3 ]   :=  nH   //64
                    aBitmaps[ x, 4 ]   :=  nW   //108
                    aBitmaps[ x, 5 ]   :=  0
                    aBitmaps[ x, 6 ]   :=  .F.
                    aBmpPal   := Nil

               Case Upper( cExt ) = "PNG"

                    AAdd( aBitmaps, Array(6) )
                    aBmpPal := FWOpenPngFile( aBmps[ x ] )
                    //if Valtype( aBmpPal ) = "A"
                    aBitmaps[ x, 1 ]   :=  aBmpPal
                    aBitmaps[ x, 2 ]   :=  0
                    aBitmaps[ x, 3 ]   :=  nH   //64
                    aBitmaps[ x, 4 ]   :=  nW   //108
                    aBitmaps[ x, 5 ]   :=  0
                    aBitmaps[ x, 6 ]   :=  .F.
                    //endif
                    aBmpPal   := Nil
                Otherwise
                    if empty( aBmps[x] )// .and. aBmps[x] <> Nil
                       AAdd( aBitmaps, Array(6) )
                    endif

            EndCase
            uFile        := ""
            cExt         := ""
        Next x

   EndCase
endif
return aBitmaps

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

Function XBrw1Elige( nPos, oBrw, x, y, nRow, nCol, nF, oCol )
? nRow, nCol
Do Case
   Case nCol = 1
        Do Case
           Case nRow = 1
           Case nRow = 2
           Case nRow = 3
           Case nRow = 4
        EndCase
   Case nCol = 2
        Do Case
           Case nRow = 1
           Case nRow = 2
           Case nRow = 3
           Case nRow = 4
        EndCase
   Case nCol = 4
        Do Case
           Case nRow = 1
           Case nRow = 2
           Case nRow = 3
           Case nRow = 4
        EndCase
   Otherwise

EndCase

Return nil
//----------------------------------------------------------------------------//
 
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: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse y Grupo de Columnas

Postby cnavarro » Thu Aug 22, 2013 9:15 am

Ejemplo para poner texto en las celdas
Pero me gustaria no usar una funcion externa.
Estoy investigando para que la clase XBrowse pinte el bitmap y el texto en la misma celda: encima del bitmap o en lineas diferentes

Example to put text in the cells
But I would like to not use an external function.
I am researching for the class to paint xBrowse bitmap and text in the same cell: bitmap above or different lines

Añadir esta linea como ejemplo ( hay que definir la variable oFont2 )

Add this line as an example (you have to define the variable oFont2)

Code: Select all  Expand view

oXBrw:aCols[ 4 ]:bPaintText = { | oCol, hDC, cText, aCoors, aColors, lHighlight | DrawRow( oCol, hDC, cText, aCoors , oFont2 )  }
 


Esta funcion esta en el foro

This function is in the forum

Code: Select all  Expand view

function DrawRow( oCol, hDC, cText, aCoors , oFont )

   local hOldFont
   local aItems := { "Configurar",;
                           "Cambiar",;
                           "Ver",;
                           "Elegir" }

   SetTextColor( hDC, 128 )
   DrawText( hDC, cText, aCoors )
   aCoors[ 1 ] += oCol:nWidth - 25 //45
   aCoors[ 2 ] += 5
   hOldFont = SelectObject( hDC, oFont:hFont )
   DrawText( hDC, aItems[ oCol:oBrw:KeyNo ], aCoors )
   SelectObject( hDC, hOldFont )

return nil
 
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: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse y Grupo de Columnas

Postby cnavarro » Wed Aug 28, 2013 10:33 pm

Hola
He podido ver que XBrowse permite "unir" dos celdas de la misma columna
Es posible hacerlo con dos celdas de columnas consecutivas?
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: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse y Grupo de Columnas

Postby nageswaragunupudi » Thu Aug 29, 2013 5:52 am

Yes.
Need not be adjacent columns. Any columns.

Syntax:

oBrw:aCols[ x ]:SetColsAsRows( x, y, z )

Column y and column z will be painted below column x

Example
----------------
col - x
---------------
col - y
---------------
col - z
========

You can use this feature to show names under images

If Image is in column 4 and name is in column 5, then
oBrw:aCols[ 4 ]:SetColsAsRows( 4, 5 )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10313
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBrowse y Grupo de Columnas

Postby cnavarro » Thu Aug 29, 2013 7:53 am

Gracias Mr. Rao
Lo que quiero implementar es poder pintar una imagen que ocupe dos columnas.
Creo que va a ser dificil
Muy agradecido por su ayuda

Thanks Mr. Rao
What I want to implement is to paint a picture that spans two columns.
I think it will be difficult
Very grateful for your help
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: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBrowse y Grupo de Columnas

Postby nageswaragunupudi » Thu Aug 29, 2013 12:30 pm

You need to do with bPaintText()

bPaintText() of one column does not paint anything and bPaintText() of another column draws the image in the full width of both the columns
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10313
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 40 guests