xBrowse: Vertical Merge

Post Reply
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

xBrowse: Vertical Merge

Post by hua »

Hi,
Trying to set up vertical merge on Col 1 and Col 2. But doesn't seem to work.
Am using Harbour+FWH1912 for this.

What seems to be wrong:
1. Despite merging, horizontol lines are still painted in col 1
2. Only one checkbox appeared in col 2. Col 2 should have 2 check boxes. One for item 1 the other for item 2

Any help is appreciated TIA

Code: Select all

  redefine xbrowse ::oBrw id 101 of ::oDlg ;
     columns LN_CARGO, LN_SELECT, LN_REMA, LN_ACCN, LN_ACCNDESC, LN_AMOU                ;
     headers "No", "", "Remarks", "Code", "Account", "Amount (" + TRIM( zCurr ) + ") " ;
     lines ;
     array ::aFiledbf ;
     update

    ::oBrw:nStretchCol         := STRETCHCOL_WIDEST
    ::oBrw:bKeyDown            := { | nKey | ::FC_ONCHG( nKey )   }
    ::oBrw:bClrSel             := {|| {CLR_BLACK, CLR_HGRAY} }
    ::oBrw:bClrStd             := {|| {CLR_BLACK, bckClr(::oBrw)} }

    aeval(::oBrw:aCols,{|o| o:bLDClickData  := { || ::FC_ONCHG( VK_RETURN) }, o:nEditType := EDIT_GET})
    ::oBrw:aCols[2]:setCheck()
    ::oBrw:No:lMergeVert := .t.
    ::oBrw:aCols[2]:lMergeVert := .t.

 

Image
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: xBrowse: Vertical Merge

Post by Silvio.Falconi »

if you not give us a test sample we cannot help you
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: xBrowse: Vertical Merge

Post by karinha »

Mui bién Silvio. Asi és.
João Santos - São Paulo - Brasil
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: xBrowse: Vertical Merge

Post by hua »

Here's a reduced, self-contained sample.

1. recur.rc

Code: Select all

recur DIALOG 15, 19, 440, 303
EXSTYLE WS_EX_DLGMODALFRAME
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "Insert Recurring Items"
FONT 10, "System"
{
 CONTROL "&Ok", 102, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 165, 283, 50, 16
 CONTROL "", 101, "TXBrowse", WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 5, 21, 431, 251
}
 
2. recur.prg

Code: Select all

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

#define PIC "@Z 999,999.99"
#define LN_NO     1
#define LN_SELECT 2

function main()
  local aFiledbf := { {1, .f., "PAY A", "CL601", "ACCRUALS - AUDIT FEE", transform(100, PIC)}, ;
                      {1, .f., "PAY B", "CL600", "ACCRUALS - OTHERS"   , transform(200, PIC)}, ;
                      {1, .f., "Payee: PAYEE", "", "", transform(0, PIC)}, ;
                      {2, .f., "PAY C", "PD004", "ACCUM DEPRN. - MOTOR VEHICLE", transform(500, PIC)}, ;
                      {2, .f., "PAY D", "E0079", "ADT ALARM", transform(300, PIC)}, ;
                      {2, .f., "Payee: ADT ALARM", "", "", transform(0, PIC)}, ;
                      {3, .f., "PAY E", "PD001", "ACCUM DEPRN.", transform(150, PIC)}, ;
                      {3, .f., "Payee: SMITH", "", "", transform(0, PIC)} ;
                    }
  local oDlg, oBrw

  define dialog oDlg resource "recur" //font ofont
  redefine xbrowse oBrw id 101 of oDlg ;
    columns LN_NO, LN_SELECT, 3, 4, 5, 6          ;
    headers "No", "", "Remarks", "Code", "Account", "Amount" ;
    cell lines noborder ;
    array aFiledbf ;
    update

    oBrw:nStretchCol := STRETCHCOL_WIDEST
    oBrw:bKeyDown    := { | nKey | FC_ONCHG( nKey, oBrw )   }
    oBrw:bClrSel     := {|| {CLR_BLACK, CLR_HGRAY} }
    oBrw:bClrStd     := {|| {CLR_BLACK, bckClr(oBrw)} }

    aeval(oBrw:aCols,{|o| o:bLDClickData  := { || FC_ONCHG( VK_RETURN, oBrw) }})
    oBrw:aCols[2]:setCheck()
    oBrw:No:lMergeVert := .t.
    oBrw:aCols[2]:lMergeVert := .t.

    redefine button id 102 of oDlg action oDlg:end()

    activate dialog oDlg centered
return nil
//----------------------------------------------------------------------
function bckClr(oXbrw)
  local aRow := oXbrw:aRow(), nRet := CLR_WHITE

  if aRow[LN_SELECT]
     nRet := nRGB(216, 76, 216)
  else
     if aRow[LN_NO] != nil
        nRet := if(mod(aRow[LN_NO],2) == 0, 12706303, 16772310)
     endif
  endif
return nRet
//----------------------------------------------------------------------
procedure fc_onchg(nKey, oBrw)
     local no, i

     DO CASE
        CASE nKey == VK_RETURN .or. nKey == VK_SPACE
             no := oBrw:aRow()[LN_NO]
             for i := 1 to len(oBrw:aArrayData)
                 if oBrw:aArrayData[i, LN_NO] == no
                    oBrw:aArrayData[i, LN_SELECT] := !oBrw:aArrayData[i, LN_SELECT]
                 endif
                 if oBrw:aArrayData[i, LN_NO] > no
                    exit
                 endif
             next
             oBrw:Refresh()
             oBrw:SetFocus()
     ENDCASE
return
 
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: xBrowse: Vertical Merge

Post by hua »

Hi Rao,
Could you offer some insight? TIA
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: xBrowse: Vertical Merge

Post by nageswaragunupudi »

In the present implementation, we see the horizontal lines if the back color of bClrStd is not the same as oBrw:nClrPane (by default CLR_WHITE).
So, if you choose CLR_WHITE as the back color in bClrStd, you will not see these lines.

We improved this in the version FWH2004 to be released soon. With this improvement, your example will look fine.
Regards

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

Re: xBrowse: Vertical Merge

Post by nageswaragunupudi »

This is how your program will look like from FWH2004 onwards.

Image
Regards

G. N. Rao.
Hyderabad, India
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: xBrowse: Vertical Merge

Post by hua »

Thank you for solving the line issue Rao. Great work!

Can you advice me on the 2nd column? It is also merged. I expected to see 3 check boxes. One for each No but only one is shown.

The checkbox will be toggled when user double click on any of the row to indicate which sets are selected by user

TIA
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: xBrowse: Vertical Merge

Post by nageswaragunupudi »

After the line

Code: Select all

    oBrw:aCols[2]:lMergeVert := .t.
 
Add this line of code:

Code: Select all

   oBrw:aCols[2]:bMergeValue := { |oCol| oCol:oBrw:aRow[ 1 ] }
 
Regards

G. N. Rao.
Hyderabad, India
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: xBrowse: Vertical Merge

Post by hua »

Hi Rao,
nageswaragunupudi wrote: Add this line of code:

Code: Select all

   oBrw:aCols[2]:bMergeValue := { |oCol| oCol:oBrw:aRow[ 1 ] }
 
The above works in my reduced self-contained sample but in my actual program it causes the checkbox to appear on each row of items.
Both were linked with FWH1912.

1. Any idea on what can I do to start finding why the different behaviour?
2. Can you share what need to be changed in xbrowse source to eliminate the white lines?

TIA
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: xBrowse: Vertical Merge

Post by nageswaragunupudi »

1) Please try

Code: Select all

oBrw:aCols[2]:bMergeValue := { |oCol| oCol:oBrw:aCols[ 1 ]:Value }
 
2) Please keep back color in all bClrStd as CLR_WHITE and see.
Regards

G. N. Rao.
Hyderabad, India
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: xBrowse: Vertical Merge

Post by hua »

Thanks for the prompt reply Rao!

All your suggestions works. Thanks!
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: xBrowse: Vertical Merge

Post by hua »

Hi Rao,
Can I have zebra effect by playing with fonts for each set of No.?

If it's possible can you share the snippet to do it?

TIA
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: xBrowse: Vertical Merge

Post by nageswaragunupudi »

Please try:

Code: Select all

oBrw:oDataFonts := { || If( <cond>, oFont1, oFont2 ) }
Regards

G. N. Rao.
Hyderabad, India
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: xBrowse: Vertical Merge

Post by hua »

nageswaragunupudi wrote:Please try:

Code: Select all

oBrw:oDataFonts := { || If( <cond>, oFont1, oFont2 ) }
Thanks Rao! It works!
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
Post Reply