Page 1 of 1

xBrowse: Vertical Merge

PostPosted: Wed Apr 22, 2020 9:14 am
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  Expand view

  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

Re: xBrowse: Vertical Merge

PostPosted: Wed Apr 22, 2020 10:40 am
by Silvio.Falconi
if you not give us a test sample we cannot help you

Re: xBrowse: Vertical Merge

PostPosted: Wed Apr 22, 2020 12:03 pm
by karinha
Mui bién Silvio. Asi és.

Re: xBrowse: Vertical Merge

PostPosted: Thu Apr 23, 2020 3:31 am
by hua
Here's a reduced, self-contained sample.

1. recur.rc
Code: Select all  Expand view

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  Expand view

#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
 

Re: xBrowse: Vertical Merge

PostPosted: Mon Apr 27, 2020 1:35 am
by hua
Hi Rao,
Could you offer some insight? TIA

Re: xBrowse: Vertical Merge

PostPosted: Thu Apr 30, 2020 4:44 am
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.

Re: xBrowse: Vertical Merge

PostPosted: Thu Apr 30, 2020 10:36 am
by nageswaragunupudi
This is how your program will look like from FWH2004 onwards.

Image

Re: xBrowse: Vertical Merge

PostPosted: Sat May 02, 2020 4:57 am
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

Re: xBrowse: Vertical Merge

PostPosted: Sat May 02, 2020 6:23 am
by nageswaragunupudi
After the line
Code: Select all  Expand view
   oBrw:aCols[2]:lMergeVert := .t.
 


Add this line of code:
Code: Select all  Expand view
  oBrw:aCols[2]:bMergeValue := { |oCol| oCol:oBrw:aRow[ 1 ] }
 

Re: xBrowse: Vertical Merge

PostPosted: Wed May 06, 2020 7:16 am
by hua
Hi Rao,

nageswaragunupudi wrote:Add this line of code:
Code: Select all  Expand view
  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

Re: xBrowse: Vertical Merge

PostPosted: Wed May 06, 2020 10:21 am
by nageswaragunupudi
1) Please try
Code: Select all  Expand view
oBrw:aCols[2]:bMergeValue := { |oCol| oCol:oBrw:aCols[ 1 ]:Value }
 


2) Please keep back color in all bClrStd as CLR_WHITE and see.

Re: xBrowse: Vertical Merge

PostPosted: Wed May 06, 2020 12:30 pm
by hua
Thanks for the prompt reply Rao!

All your suggestions works. Thanks!

Re: xBrowse: Vertical Merge

PostPosted: Fri May 15, 2020 9:42 am
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

Re: xBrowse: Vertical Merge

PostPosted: Fri May 15, 2020 9:58 am
by nageswaragunupudi
Please try:
Code: Select all  Expand view
oBrw:oDataFonts := { || If( <cond>, oFont1, oFont2 ) }

Re: xBrowse: Vertical Merge

PostPosted: Mon May 18, 2020 6:10 am
by hua
nageswaragunupudi wrote:Please try:
Code: Select all  Expand view
oBrw:oDataFonts := { || If( <cond>, oFont1, oFont2 ) }


Thanks Rao! It works!