Headers in xBrowse

Headers in xBrowse

Postby Armando » Wed Oct 18, 2023 5:02 am

Mr. Rao:

Is it possible to get these headers in xBrowse, if yes how can I do it?
Please an example

Image

With Best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3229
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Headers in xBrowse

Postby nageswaragunupudi » Thu Oct 19, 2023 8:07 pm

Code: Select all  Expand view  RUN
#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local oDlg, oBrw, oFont

   USE CUSTOMER SHARED NEW VIA "DBFCDX"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 800,500 PIXEL TRUEPIXEL ;
      FONT oFont RESIZABLE

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" AUTOCOLS ;
      CELL LINES NOBORDER STYLE FLAT

   WITH OBJECT oBrw
      :bClrHeader    := { || { 0, CLR_WHITE } }
      :bClrGrad      := { || { { 1, CLR_WHITE, CLR_WHITE } } }
      :nHeadStrAligns   := AL_CENTER
      :nTopBarHeight := 30
      :cCaption      := ""
      :SetChecks()
      :SetGroupHeader( "NAME",  2, 3 )
      :SetGroupHeader( "GROUP2",5, 7 )
      :AutoFit()
      :bPainted := { |hDC| oBrw:SayText( "CUSTOMER", { 0,0,30,nil } ) }
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil


Image
Regards

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

Re: Headers in xBrowse

Postby Armando » Thu Oct 19, 2023 8:25 pm

Mr. & Master Rao:

Great !

With best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3229
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Headers in xBrowse

Postby nageswaragunupudi » Fri Oct 20, 2023 2:59 am

Also add
Code: Select all  Expand view  RUN
oBrw:lDrawBorder := .t.
Regards

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

Re: Headers in xBrowse

Postby Armando » Fri Oct 20, 2023 3:00 am

Mr. Rao:

Ok,

Thanks
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3229
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Headers in xBrowse

Postby Silvio.Falconi » Fri Oct 20, 2023 8:15 am

nageswaragunupudi wrote:Also add
Code: Select all  Expand view  RUN
oBrw:lDrawBorder := .t.



Nages,
when multiheaders as this ?

Image


I have to insert 3 headers

Code: Select all  Expand view  RUN
local aSuperGroup:= {"Venus Nord","Venus Centro","Venus Sud"}


each of which has these headers

Code: Select all  Expand view  RUN

//aSuperGroup 1
   local aHeader1:= {"Milano","Genova","Torino","Venezia"}
        //aSuperGroup 2
   local aHeader2:= {"Roma","Firenze","Cagliari","Nazionale"}
       //aSuperGroup 3
   local aHeader3:= {"Napoli","Bari","Palermo"}



each header has the following pattern


oBrw:SetGroupHeader( aSuperGroup[1], 2, 21 )
oBrw:SetGroupHeader( aSuperGroup[2], 22, 41 )
oBrw:SetGroupHeader( aSuperGroup[3], 42, 56 )

I try but it not run

Image

the test
Code: Select all  Expand view  RUN
#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local oDlg, oBrw, oFont
   local aSuperGroup:= {"Venus Nord","Venus Centro","Venus Sud"}

        //aSuperGroup 1
   local aHeader1:= {"Milano","Genova","Torino","Venezia"}
        //aSuperGroup 2
   local aHeader2:= {"Roma","Firenze","Cagliari","Nazionale"}
       //aSuperGroup 3
   local aHeader3:= {"Napoli","Bari","Palermo"}
   local cdbfPath:=".\data\"
   local oDbf
   local aArray

   oDbf := TDatabase():Open( , cdbfPath+"
LOTTO", "DBFCDX", .T. )
   oDbf:setorder(1)
   oDbf:GoTop()

   aArray := Build_Array_Venus(oDbf)
   //xbrowser aArray


   DEFINE FONT oFont NAME "
TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 800,500 PIXEL TRUEPIXEL ;
      FONT oFont RESIZABLE

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
       ARRAY aArray  AUTOCOLS ;
      CELL LINES NOBORDER STYLE FLAT

      SetupBrowseHorizontal(oBrw)

      oBrw:aCols[1]:cHeader := "
Data"
      oBrw:SetGroupHeader( aSuperGroup[1],  2, 21 )
      oBrw:SetGroupHeader( aSuperGroup[2],  22, 41 )
      oBrw:SetGroupHeader( aSuperGroup[3],  42, 56 )
      oBrw:CreateFromCode()


/*   WITH OBJECT oBrw
      :bClrHeader    := { || { 0, CLR_WHITE } }
      :bClrGrad      := { || { { 1, CLR_WHITE, CLR_WHITE } } }
      :nHeadStrAligns   := AL_CENTER
      :nTopBarHeight := 30
      :cCaption      := "
"
      :SetChecks()

      :SetGroupHeader( aSuperGroup[1],  2, 21 )
      :SetGroupHeader( aSuperGroup[2],  22, 41 )
      :SetGroupHeader( aSuperGroup[3],  42, 56 )


      :AutoFit()
      :bPainted := { |hDC| oBrw:SayText( "
LOTTO", { 0,0,30,nil } ) }
      //
      :CreateFromCode()
   END
  */

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

   return nil

//---------------------------------------------------------//
 static function  Build_Array_Venus(oDbf,n,nOpt)
   local aTemp:={}, i, nIni

   default n := 0
   default nOpt := 1

  oDbf:GoTop()

  If nOpt=1
      i := 1
   Endif

  do while !oDbf:Eof
     AaDd(aTemp, { oDbf:data,;
                    oDbf:mi1,oDbf:mi2,oDbf:mi3,oDbf:mi4,oDbf:mi5,;
                    oDbf:ge1,oDbf:ge2,oDbf:ge3,oDbf:ge4,oDbf:ge5,;
                    oDbf:to1,oDbf:to2,oDbf:to3,oDbf:to4,oDbf:to5,;
                    oDbf:ve1,oDbf:ve2,oDbf:ve3,oDbf:ve4,oDbf:ve5,;
                    oDbf:rm1,oDbf:rm2,oDbf:rm3,oDbf:rm4,oDbf:rm5,;
                    oDbf:fi1,oDbf:fi2,oDbf:fi3,oDbf:fi4,oDbf:fi5,;
                    oDbf:ca1,oDbf:ca2,oDbf:ca3,oDbf:ca4,oDbf:ca5,;
                    oDbf:nz1,oDbf:nz2,oDbf:nz3,oDbf:nz4,oDbf:nz5,;
                    oDbf:na1,oDbf:na2,oDbf:na3,oDbf:na4,oDbf:na5,;
                    oDbf:ba1,oDbf:ba2,oDbf:ba3,oDbf:ba4,oDbf:ba5,;
                    oDbf:pa1,oDbf:pa2,oDbf:pa3,oDbf:pa4,oDbf:pa5} )
     oDbf:Skip()

   If nOpt=1
    if i >= n .and. n > 0
       exit
    endif
    i++
 Endif

  enddo
RETURN aTemp
//---------------------------------------------------------------//

Function  SetupBrowseHorizontal(oBrw)

        WITH OBJECT oBrw
                      :nRowHeight    := 30
                      :nClrBorder := CLR_GRAY

                      :lHscroll            := .t.
                      :l2007               := .F.
                      :l2015               := .T.
                      :lRecordSelector     := .F.
                      :lAllowRowSizing     := .F.
                      :lAllowColSwapping   := .F.
                      :lAllowColHiding     := .F.
                      :lRecordSelector     := .F.
                      :nColDividerStyle    := LINESTYLE_LIGHTGRAY
                      :nRowDividerStyle    := LINESTYLE_LIGHTGRAY

                   /*   :SetGroupHeader( "
Estrazione",  1,  2)
                      :SetGroupHeader( "
Bari",        3,  7 )
                      :SetGroupHeader( "
Cagliari",    8, 12 )
                      :SetGroupHeader( "
Firenze",    13, 17 )
                      :SetGroupHeader( "
Genova",     18, 22 )
                      :SetGroupHeader( "
Milano",     23, 27 )
                      :SetGroupHeader( "
Napoli",     28, 32 )
                      :SetGroupHeader( "
Palermo",    33, 37 )
                      :SetGroupHeader( "
Roma",       38, 42 )
                      :SetGroupHeader( "
Torino",     43, 47 )
                      :SetGroupHeader( "
Venezia",    48, 52 )
                      :SetGroupHeader( "
Nazionale",  53, 57 )
                    */
      FOR i := 3 TO LEN(:aCols)
         oCol := :aCols[ i ]
         oCol:nWidth   := 17
      NEXT

          FOR i := 1 TO 1
             oCol := :aCols[ i ]
             oCol:nWidth   := 60
             oCol:nColDividerStyle    := LINESTYLE_BLACK
             oCol:bClrStd := {|| { CLR_WHITE, RGB(255,0,0) } }
          NEXT
       END

       RETURN NIL
//---------------------------------------------------------------------


















I could also display the array by reducing the fields in this way

Code: Select all  Expand view  RUN

 AaDd(aTemp, { oDbf:data,;
                    strzero(oDbf:mi1,2)+" "+strzero(oDbf:mi2,2)+" "+strzero(oDbf:mi3,2)+" "+strzero(oDbf:mi4,2)+" "+strzero(oDbf:mi5,2),;
                    strzero(oDbf:ge1,2)+" "+strzero(oDbf:ge2,2)+" "+strzero(oDbf:ge3,2)+" "+strzero(oDbf:ge4,2)+" "+strzero(oDbf:ge5,2),;
                    strzero(oDbf:to1,2)+" "+strzero(oDbf:to2,2)+" "+strzero(oDbf:to3,2)+" "+strzero(oDbf:to4,2)+" "+strzero(oDbf:to5,2),;
                    strzero(oDbf:ve1,2)+" "+strzero(oDbf:ve2,2)+" "+strzero(oDbf:ve3,2)+" "+strzero(oDbf:ve4,2)+" "+strzero(oDbf:ve5,2),;
                    strzero(oDbf:rm1,2)+" "+strzero(oDbf:rm2,2)+" "+strzero(oDbf:rm3,2)+" "+strzero(oDbf:rm4,2)+" "+strzero(oDbf:rm5,2),;
                    strzero(oDbf:fi1,2)+" "+strzero(oDbf:fi2,2)+" "+strzero(oDbf:fi3,2)+" "+strzero(oDbf:fi4,2)+" "+strzero(oDbf:fi5,2),;
                    strzero(oDbf:ca1,2)+" "+strzero(oDbf:ca2,2)+" "+strzero(oDbf:ca3,2)+" "+strzero(oDbf:ca4,2)+" "+strzero(oDbf:ca5,2),;
                    strzero(oDbf:nz1,2)+" "+strzero(oDbf:nz2,2)+" "+strzero(oDbf:nz3,2)+" "+strzero(oDbf:nz4,2)+" "+strzero(oDbf:nz5,2),;
                    strzero(oDbf:na1,2)+" "+strzero(oDbf:na2,2)+" "+strzero(oDbf:na3,2)+" "+strzero(oDbf:na4,2)+" "+strzero(oDbf:na5,2),;
                    strzero(oDbf:ba1,2)+" "+strzero(oDbf:ba2,2)+" "+strzero(oDbf:ba3,2)+" "+strzero(oDbf:ba4,2)+" "+strzero(oDbf:ba5,2),;
                    strzero(oDbf:pa1,2)+" "+strzero(oDbf:pa2,2)+" "+strzero(oDbf:pa3,2)+" "+strzero(oDbf:pa4,2)+" "+strzero(oDbf:pa5,2)} )

 



So the header become

Code: Select all  Expand view  RUN
      :SetGroupHeader( aSuperGroup[1],  2, 5 )
      :SetGroupHeader( aSuperGroup[2],  6, 9 )
      :SetGroupHeader( aSuperGroup[3],  10, 12)

         oBrw:aCols[2]:cHeader := aHeader1[1]
         oBrw:aCols[3]:cHeader := aHeader1[2]
         oBrw:aCols[4]:cHeader := aHeader1[3]
         oBrw:aCols[5]:cHeader := aHeader1[4]
         oBrw:aCols[6]:cHeader := aHeader2[1]
         oBrw:aCols[7]:cHeader := aHeader2[2]
         oBrw:aCols[8]:cHeader := aHeader2[3]
         oBrw:aCols[9]:cHeader := aHeader2[4]
         oBrw:aCols[10]:cHeader := aHeader3[1]
         oBrw:aCols[11]:cHeader := aHeader3[2]
         oBrw:aCols[12]:cHeader := aHeader3[3]



it might work

Image

but then I can't use the number search procedures to color them because I need the individual columns of numbers,I don't know if you remember...
my application of lotto
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: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: Headers in xBrowse

Postby nageswaragunupudi » Fri Oct 20, 2023 10:35 am

Sorry, multi-headers not possible
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

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