FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xbrowse multisel
Posts: 253
Joined: Wed May 25, 2016 01:04 AM
xbrowse multisel
Posted: Mon Feb 17, 2025 12:54 AM

Hi,

How the best way to use multisel in xbrowse? I would not like to use a logical field in the dbf to select or unmark the record as there may be other users using the same record.

Thanks in advance!

Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
Re: xbrowse multisel
Posted: Wed Feb 19, 2025 01:55 AM

::nMarqueeStyle := MARQSTYLE_HIGHLROWMS

::select(1)

::seleect(2)

...

::aseleted stores Eval( ::bBookMark) //nrow

::select(0) clear selected rows ,::aselected:={}

Shuming Wang

http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: xbrowse multisel
Posted: Wed Feb 19, 2025 09:27 AM
wartiaga wrote: Hi,

How the best way to use multisel in xbrowse? I would not like to use a logical field in the dbf to select or unmark the record as there may be other users using the same record.

Thanks in advance!
You must not also use a field on your archive
WITH OBJECT oBrw
                    :SetMultiSelectCol()

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: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: xbrowse multisel
Posted: Wed Feb 19, 2025 10:38 AM

Respect and congratulations – I like the design.

Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: xbrowse multisel
Posted: Wed Feb 19, 2025 12:33 PM
Otto wrote: Respect and congratulations – I like the design.
Thanks
Otto, I created my applications with some C5 classes also used by a gentleman on this forum, to avoid being reported for plagiarism I had to change my applications and return to the old tables.


For a sample If I wish not set at init :SetMultiSelectCol() and then I wish select a record from menupopup the procedure can make it but before must insert :SetMultiSelectCol() I ask this to Rao last year and he not answered never for this topic

pratically I asked if I can insert on line the possibility to have :SetMultiSelectCol() into xbrowse


this is one of the many things I never got an answer to
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 multisel
Posted: Wed Feb 19, 2025 02:22 PM
wartiaga, see if it helps:


// C:\FWH\SAMPLES\MULTSEL.PRG by mister Rao.

#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"
#include "hbcompat.ch"

REQUEST DBFCDX

FUNCTION Main()

   LOCAL oDlg, oBrw, oFont

   XbrNumFormat( 'A', .T. )

   USE CUSTOMER NEW ALIAS "CUST" SHARED VIA "DBFCDX"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 14 BOLD

   DEFINE DIALOG oDlg SIZE 700, 400 PIXEL FONT oFont

   oDlg:lHelpIcon := .F.

   @ 10, 10 XBROWSE oBrw SIZE - 10, - 10 PIXEL OF oDlg ;
      DATASOURCE "CUST"                                ;
      COLUMNS "FIRST", "CITY", "AGE", "SALARY"         ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw:InsCol( 1 )

      :bEditValue    := {|| AScan( oBrw:aSelected, oBrw:BookMark ) > 0 }
      :SetCheck()
      :nHeadBmpNo    := {|| If( Len( oBrw:aSelected ) == oBrw:nLen, 1, 2 ) }

   END

   WITH OBJECT oBrw

      :nMarqueeStyle := MARQSTYLE_HIGHLROWMS // multisel does the job
      // :nMarqueeStyle := MARQSTYLE_HIGHLROW
      :lMultiSelect  := .F.
      :bClrSelFocus  := {|| { CLR_BLACK, CLR_HGRAY } }
      :nStretchCol   := 3

      :aCols[ 1 ]:bClrSelFocus := {|| {  CLR_BLACK, CLR_WHITE } }

      :bLClicked     := {| r, c, f, oBrw | If( oBrw:MouseColPos( c ) == 1, ;
         If( ( f := AScan( oBrw:aSelected, oBrw:BookMark ) ) == 0,         ;
         AAdd( oBrw:aSelected, oBrw:BookMark ),                            ;
         ADel( oBrw:aSelected, f, .T. ) ), NIL ),                          ;
         oBrw:RefreshCurrent() }

   :CreateFromCode()

   END

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

RETURN NIL

// FIN / END
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: xbrowse multisel
Posted: Wed Feb 19, 2025 02:27 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 253
Joined: Wed May 25, 2016 01:04 AM
Re: xbrowse multisel
Posted: Thu Feb 20, 2025 05:52 PM
ShumingWang wrote: ::nMarqueeStyle := MARQSTYLE_HIGHLROWMS
::select(1)
::seleect(2)
...
::aseleted stores Eval( ::bBookMark) //nrow

::select(0) clear selected rows ,::aselected:={}

Shuming Wang

Thank You!
Posts: 253
Joined: Wed May 25, 2016 01:04 AM
Re: xbrowse multisel
Posted: Thu Feb 20, 2025 05:53 PM
Silvio.Falconi wrote:
Hi,

How the best way to use multisel in xbrowse? I would not like to use a logical field in the dbf to select or unmark the record as there may be other users using the same record.

Thanks in advance!
You must not also use a field on your archive
WITH OBJECT oBrw
                    :SetMultiSelectCol()

Thank You for the tip Silvio!
Posts: 253
Joined: Wed May 25, 2016 01:04 AM
Re: xbrowse multisel
Posted: Thu Feb 20, 2025 06:02 PM
karinha wrote: wartiaga, see if it helps:


// C:\FWH\SAMPLES\MULTSEL.PRG by mister Rao.

#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"
#include "hbcompat.ch"

REQUEST DBFCDX

FUNCTION Main()

   LOCAL oDlg, oBrw, oFont

   XbrNumFormat( 'A', .T. )

   USE CUSTOMER NEW ALIAS "CUST" SHARED VIA "DBFCDX"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 14 BOLD

   DEFINE DIALOG oDlg SIZE 700, 400 PIXEL FONT oFont

   oDlg:lHelpIcon := .F.

   @ 10, 10 XBROWSE oBrw SIZE - 10, - 10 PIXEL OF oDlg ;
      DATASOURCE "CUST"                                ;
      COLUMNS "FIRST", "CITY", "AGE", "SALARY"         ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw:InsCol( 1 )

      :bEditValue    := {|| AScan( oBrw:aSelected, oBrw:BookMark ) > 0 }
      :SetCheck()
      :nHeadBmpNo    := {|| If( Len( oBrw:aSelected ) == oBrw:nLen, 1, 2 ) }

   END

   WITH OBJECT oBrw

      :nMarqueeStyle := MARQSTYLE_HIGHLROWMS // multisel does the job
      // :nMarqueeStyle := MARQSTYLE_HIGHLROW
      :lMultiSelect  := .F.
      :bClrSelFocus  := {|| { CLR_BLACK, CLR_HGRAY } }
      :nStretchCol   := 3

      :aCols[ 1 ]:bClrSelFocus := {|| {  CLR_BLACK, CLR_WHITE } }

      :bLClicked     := {| r, c, f, oBrw | If( oBrw:MouseColPos( c ) == 1, ;
         If( ( f := AScan( oBrw:aSelected, oBrw:BookMark ) ) == 0,         ;
         AAdd( oBrw:aSelected, oBrw:BookMark ),                            ;
         ADel( oBrw:aSelected, f, .T. ) ), NIL ),                          ;
         oBrw:RefreshCurrent() }

   :CreateFromCode()

   END

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

RETURN NIL

// FIN / END
Regards, saludos.
Thank You Karinha, works great!

Continue the discussion