check xbrowse from array

check xbrowse from array

Postby Silvio.Falconi » Wed Apr 11, 2018 4:50 pm

This is a sample of Rao but I have an array with customer allready checked

Local cTAgs:="Homer; Tom; Johnny;"

I convert eit on array

Local aTags := iif(AT(';',cTAGS)!=0, HB_ATokens( cTAGS, ";"), {})

When I open the xbrowse I wish check this customers

How I can make ?



Code: Select all  Expand view

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

//----------------------------------------------------------------------------//

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oBrw, oFont
   Local  cTAgs:="Homer; Tom; Johnny;"
   Local  aTags := iif(AT(';',cTAGS)!=0, HB_ATokens( cTAGS, ";"), {})

    XbrNumFormat( 'A', .t. )
    xbrowser  aTags

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

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 700,400 PIXEL FONT oFont

   @ 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_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

   xbrowser oBrw:aSelected

return (0)

//----------------------------------------------------------------------------//
 



where I can insert checkbox with the records allready selected ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: check xbrowse from array

Postby Silvio.Falconi » Mon Apr 16, 2018 8:24 pm

any solution please ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: check xbrowse from array

Postby nageswaragunupudi » Tue Apr 17, 2018 9:13 am

Please wait
Regards

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

Re: check xbrowse from array

Postby Silvio.Falconi » Tue Apr 17, 2018 2:49 pm

I 'm thinking perhaps ...
local aselected := {}
USE CUSTOMER NEW ALIAS "CUST" SHARED VIA "DBFCDX"

Do while .not. cust->(eof())
cText := alltrim(cust->First)
IF !Empty( ascan( aTags,cText) )
aadd(aselected,cust->(recno()))
Endif

cust->(dbskip())
enddo


xbrowser aselected
and we have the numbers of record
Now How insert them on xbrowse ?

it is as we make a filter as FIRST = "Homer" .OR. FIRST = "Tom" .OR. FIRST = "Johnny" but there is a problem

this is good only for a dbf of one field but if we have First+Last it is too hard to check
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: check xbrowse from array

Postby Silvio.Falconi » Fri Apr 20, 2018 11:20 am

I'm waiting for....

Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: check xbrowse from array

Postby nageswaragunupudi » Tue Apr 24, 2018 10:18 pm

Thanks for the Italian Coffee!
Code: Select all  Expand view
#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   field FIRST,LAST
   local oDlg, oFont, oBrw
   local cSelected   := ";"

   if File( "CUSTSEL.TXT" )
      cSelected   := MEMOREAD( "CUSTSEL.TXT" )
   endif
   if Empty( cSelected )
      cSelected   := ";"
   endif

   USE CUSTOMER NEW ALIAS CUST SHARED VIA "DBFCDX"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 800,600 PIXEL TRUEPIXEL FONT oFont

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUST" ;
      COLUMNS { || .F. }, "FIRST", "LAST", "CITY" ;
      HEADERS "", "FirstName", "LastName", "City" ;
      CELL LINES NOBORDER FOOTERS

   WITH OBJECT oBrw
      WITH OBJECT oBrw:aCols[ 1 ]
         :bEditValue    := < |x,o|
            local cTag        := UPPER( TRIM( FIRST ) ) + "," + UPPER( TRIM( LAST ) ) + ";"
            local lSelected   := ";" + cTag $ cSelected
            if x != nil
               if x
                  if !lSelected
                     cSelected   += + cTag
                  endif
               else
                  if lSelected
                     cSelected   := StrTran( cSelected, cTag, "" )
                  endif
               endif
               lSelected   := x
            endif
            return lSelected
            >

         :SetCheck( nil, .t. )
         :bOnChange     := { |o| o:RefreshFooter() }
         :nHeadBmpNo    := 2
         :bLClickHeader := { || cSelected := ";", oBrw:Refresh() }
         :bFooter       := { || Str( OCCURS( ";", cSelected ) - 1, 4 ) }
      END
      :bKeyChar   := { |k| If( k == VK_SPACE, ( oBrw:oCol( 1 ):CheckToggle(), oBrw:RefreshCurrent(), 0 ), nil ) }
      :bLDblClick := { || oBrw:oCol( 1 ):CheckToggle(), oBrw:RefreshCurrent() }
      :bClrStd    := { || { CLR_BLACK, If( oBrw:oCol( 1 ):Value, 0x80ffff, CLR_WHITE ) } }
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

   MEMOWRIT( "CUSTSEL.TXT", cSelected )

   ? cSelected

return nil
 

1. Displays number of selected items in the footer.
2. Space key or double-click any where on the row toggles selection
3. Click on header of selection column, clears entire selection
Regards

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

Re: check xbrowse from array

Postby Silvio.Falconi » Tue Apr 24, 2018 10:59 pm

I not see the footer

Image

Sorry I not understood why CUSTSEL.TXT ?
I have a only a string cTAgs:="Homer; Tom; Johnny;"
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: check xbrowse from array

Postby Silvio.Falconi » Tue Apr 24, 2018 11:06 pm

ok now I see the footer...
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: check xbrowse from array

Postby Silvio.Falconi » Wed Apr 25, 2018 8:37 am

thanks Mr Rao !!!!

Image


it was just what I was trying to build!!! :D
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 53 guests