FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse: Vertical Merge
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
xBrowse: Vertical Merge
Posted: Wed Apr 22, 2020 09:14 AM
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 (fw): Select all Collapse
  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.



FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: xBrowse: Vertical Merge
Posted: Wed Apr 22, 2020 10:40 AM

if you not give us a test sample we cannot help you

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: xBrowse: Vertical Merge
Posted: Wed Apr 22, 2020 12:03 PM

Mui bién Silvio. Asi és.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: xBrowse: Vertical Merge
Posted: Thu Apr 23, 2020 03:31 AM
Here's a reduced, self-contained sample.

1. recur.rc
Code (fw): Select all Collapse
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 (fw): Select all Collapse
#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.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: xBrowse: Vertical Merge
Posted: Mon Apr 27, 2020 01:35 AM

Hi Rao,
Could you offer some insight? TIA

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse: Vertical Merge
Posted: Thu Apr 30, 2020 04:44 AM

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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse: Vertical Merge
Posted: Thu Apr 30, 2020 10:36 AM
This is how your program will look like from FWH2004 onwards.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: xBrowse: Vertical Merge
Posted: Sat May 02, 2020 04:57 AM

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.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse: Vertical Merge
Posted: Sat May 02, 2020 06:23 AM
After the line
Code (fw): Select all Collapse
    oBrw:aCols[2]:lMergeVert := .t.


Add this line of code:
Code (fw): Select all Collapse
   oBrw:aCols[2]:bMergeValue := { |oCol| oCol:oBrw:aRow[ 1 ] }
Regards



G. N. Rao.

Hyderabad, India
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: xBrowse: Vertical Merge
Posted: Wed May 06, 2020 07:16 AM
Hi Rao,

nageswaragunupudi wrote:
Add this line of code:
Code (fw): Select all Collapse
   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.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse: Vertical Merge
Posted: Wed May 06, 2020 10:21 AM
1) Please try
Code (fw): Select all Collapse
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
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: xBrowse: Vertical Merge
Posted: Wed May 06, 2020 12:30 PM

Thanks for the prompt reply Rao!

All your suggestions works. Thanks!

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: xBrowse: Vertical Merge
Posted: Fri May 15, 2020 09:42 AM

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.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse: Vertical Merge
Posted: Fri May 15, 2020 09:58 AM
Please try:
Code (fw): Select all Collapse
oBrw:oDataFonts := { || If( <cond>, oFont1, oFont2 ) }
Regards



G. N. Rao.

Hyderabad, India
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: xBrowse: Vertical Merge
Posted: Mon May 18, 2020 06:10 AM
nageswaragunupudi wrote:Please try:
Code (fw): Select all Collapse
oBrw:oDataFonts := { || If( <cond>, oFont1, oFont2 ) }


Thanks Rao! It works!
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour

Continue the discussion