FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem GetBar and Report in Xbrowse
Posts: 181
Joined: Thu Apr 17, 2008 02:38 PM
Problem GetBar and Report in Xbrowse
Posted: Mon Jun 12, 2017 10:13 PM
Hi All

When in xbrowse two columns belong at same Group headers
the position of get in getbar is not ok.
When in cHeader of the column is present CRLF sequence because
the header is composed of two rows, than the header of the report
is not. ok
try this sample :

Code (fw): Select all Collapse
#include "FiveWin.ch" 
#include "XBrowse.ch" 

*-----------------------------------------------------------------------------------------------------------------------
Function Main() 
*-----------------------------------------------------------------------------------------------------------------------

   local oWnd
   local oBrw
   local oCol 
   local CUSTOMER := cGetNewAlias( "CUSTOMER" )

   *--------------------------------------------------------------------------------------------------------------------
   *- Apertura files
   *--------------------------------------------------------------------------------------------------------------------
      
   USE Customer NEW ALIAS CUSTOMER SHARED

   DEFINE WINDOW oWnd 
    
   @ 0, 0 XBROWSE oBrw OF oWnd ALIAS CUSTOMER CELL LINES NOBORDER  
    
   oBrw:lFastEdit    := .T.       
   oBrw:lAutoAppend  := .T.       
   oBrw:lGetBar      := .T.
   oBrw:bPastEof     := { || AppendRow( oBrw ) }

   oCol := oBrw:AddCol() 
   oCol:bStrData     := FIELDWBLOCK("FIRST", select(CUSTOMER))
   oCol:bEditValue   := FIELDWBLOCK("FIRST", select(CUSTOMER))
   oCol:cHeader      := "Cognome"
   oCol:nEditType    := EDIT_GET
   oCol:uBarGetVal   := uValBlank( fieldGet( fieldpos("FIRST") ) )
   oCol:cBarGetPic   := "@!"
   oCol:cEditPicture := oCol:cBarGetPic
   oCol:nDataStyle   := oCol:DefStyle( AL_LEFT, .T.)
   oCol:bOnPostEdit  := { | oCol, xVal, nKey | If( RecCount() == 0, ( DbAppend(), oBrw:Refresh() ),), If( nKey == VK_RETURN, Customer->First := xVal,) } 
   
   oCol := oBrw:AddCol() 
   oCol:bStrData     := FIELDWBLOCK("LAST", select(CUSTOMER))
   oCol:bEditValue   := FIELDWBLOCK("LAST", select(CUSTOMER))
   oCol:cHeader      := "Nome" 
   oCol:nEditType    := EDIT_GET_BUTTON
   oCol:uBarGetVal   := uValBlank( fieldGet( fieldpos("LAST") ) )
   oCol:cBarGetPic   := "@!"
   oCol:cEditPicture := oCol:cBarGetPic
   oCol:nDataStyle   := oCol:DefStyle( AL_LEFT, .T.)
   oCol:bOnPostEdit  := { | oCol, xVal, nKey | If( RecCount() == 0, DbAppend(),), If( nKey == VK_RETURN, ( Customer->Last := xVal, DbAppend(), oBrw:Refresh() ),) } 
   
   oCol := oBrw:AddCol() 
   oCol:bStrData       := {|| if(CUSTOMER->MARRIED, "Sposato", "Nubile")}
   oCol:bEditValue     := FIELDWBLOCK("MARRIED", select(CUSTOMER))
   oCol:cHeader        := "Sposato/a" + CRLF + "Nubile"
   oCol:nEditType      := EDIT_LISTBOX
   oCol:aEditListTxt   := { "Sposato/a", "Nubile"}
   oCol:aEditListBound := { .T., .F. }
   oCol:nDataStyle     := oCol:DefStyle( AL_LEFT, .T.)
   oCol:bOnPostEdit    := { | oCol, xVal, nKey | If( RecCount() == 0, ( DbAppend(), oBrw:Refresh() ),), If( nKey == VK_RETURN, Customer->Married := xVal,) } 

   oCol := oBrw:AddCol() 
   oCol:bStrData     := FIELDWBLOCK("AGE", select(CUSTOMER))
   oCol:bEditValue   := FIELDWBLOCK("AGE", select(CUSTOMER))
   oCol:cHeader      := "Età"
   oCol:nEditType    := EDIT_GET
   oCol:uBarGetVal   := uValBlank( fieldGet( fieldpos("AGE") ) )
   oCol:cBarGetPic   := NumPict( FieldLen( fieldpos("AGE") ) + 1, FieldDec( fieldpos("AGE") ) )
   oCol:cEditPicture := oCol:cBarGetPic
   oCol:nDataStyle   := oCol:DefStyle( AL_RIGHT, .T.)
   oCol:bOnPostEdit  := { | oCol, xVal, nKey | If( RecCount() == 0, ( DbAppend(), oBrw:Refresh() ),), If( nKey == VK_RETURN, Customer->Age := xVal,) } 
   oCol:cGrpHdr      := "Test"
    
   oCol := oBrw:AddCol() 
   oCol:bStrData     := FIELDWBLOCK("SALARY", select(CUSTOMER))
   oCol:bEditValue   := FIELDWBLOCK("SALARY", select(CUSTOMER))
   oCol:cHeader      := "Salario" + CRLF + "mensile"
   oCol:nEditType    := EDIT_GET
   oCol:uBarGetVal   := uValBlank( fieldGet( fieldpos("SALARY") ) )
   oCol:cBarGetPic   := NumPict( FieldLen( fieldpos("SALARY") ) + 1, FieldDec( fieldpos("SALARY") ) )
   oCol:cEditPicture := oCol:cBarGetPic
   oCol:nDataStyle   := oCol:DefStyle( AL_RIGHT, .T.)
   oCol:bOnPostEdit  := { | oCol, xVal, nKey | If( RecCount() == 0, ( DbAppend(), oBrw:Refresh() ),), If( nKey == VK_RETURN, Customer->Salary := xVal,) } 
   oCol:cGrpHdr      := "Test"
  
   oBrw:CreateFromCode() 
    
   oWnd:oClient := oBrw 

   ACTIVATE WINDOW oWnd VALID ( CUSTOMER->(dbCloseArea()) , .T. )

return nil 


*-------------------------------------------------------------------------------------------------
Static function AppendRow( oBrw )
*-------------------------------------------------------------------------------------------------

 * CUSTOMER->(dbappend())
  
 * oBrw:GoBottom()
 * oBrw:refresh()
 
 oBrw:report()
  
return nil


thanks
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem GetBar and Report in Xbrowse
Posted: Wed Jun 14, 2017 07:01 AM
<quote>
When in xbrowse two columns belong at same Group headers the position of get in getbar is not ok.
</quote>

This was a problem in earliest versions, but fixed very soon later.



<quote>
When in cHeader of the column is present CRLF sequence because the header is composed of two rows, than the header of the report is not. ok
</quote>
That is the because of the behavior of Report object. Column header of report is not split at CRLF like in XBrowse.

However, in FWH version 17.06, xbrowse splits the column header at CRLF and builds the report column object with the split header.

FWH 17.06 also implemented Group Headers for reports.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion