lgetbar on road

lgetbar on road

Postby Silvio.Falconi » Sat Mar 30, 2019 9:34 am

Mr Rao
I try the test xbgetbar.prg with My archive dbf
When I press set filter button it make error
sad there is not the dbf open ...why ?

Code: Select all  Expand view  RUN
DataBases in use
================

  1:    TDF00001                           RddName: DBFCDX
     ==============================
     RecNo    RecCount    BOF   EOF
          1         7959      .F.   .F.

     Indexes in use                        TagName
           CODICE                             COMCOD
        => UPPER(LOCALITA)                    COMLOC
           UPPER(PROVINCIA)                   COMPRO
           CAP                                COMCAP


image
https://ibb.co/fYW9Mm8




Code: Select all  Expand view  RUN
 Time from start: 0 hours 0 mins 29 secs
   Error occurred at: 30-03-2019, 10:26:34
   Error description: Error DBCMD/2001  Workarea not in use: DBSETFILTER

Stack Calls
===========
   Called from:  => DBSETFILTER( 0 )
   Called from: source\ut\ut_codFisc.prg => SETFILTER( 834 )
   Called from: source\ut\ut_codFisc.prg => (b)SELEZIONECOMUNI( 793 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 697 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 983 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1791 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 2006 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3541 )
   Called from:  => DIALOGBOXINDIRECT( 0 )


probable because I use tdatabase and function SetFilter( oBrw ) is wrong


How I can to not use buttons on dialog ?

Code: Select all  Expand view  RUN


#include "FiveWin.ch"
#include "Report.ch"
#include "dtpicker.ch"
#include "xBrowse.ch"

static oComuni,oProvince,oStati
static cPathDb

REQUEST DBFCDX


FUNCTION Main()

   *   HB_LangSelect("IT")
    *  HB_SetCodePage("ITWIN")

   SET _3DLOOK ON
   SET CENTURY ON
   SET DATE ITALIAN

   RDDSetDefault( 'DBFCDX' )

         cPathDb:="DB\"
         oComuni:= TDatabase():Open( , cPathDb+"
COMUNI", "DBFCDX", .T. )
         oComuni:setorder(2)
         oComuni:gotop()

      SelezioneComuni(oComuni)

return nil

//-----------------------------------------------------------------------------//
Function SelezioneComuni(oComuni)
   local oDlg, oBrw, oFont, oBold
   local n
   DEFINE FONT oFont NAME "
TAHOMA" SIZE 0,-12
   DEFINE FONT oBold NAME "
TAHOMA" SIZE 0,-12 BOLD

   DEFINE DIALOG oDlg SIZE 800,500 PIXEL TRUEPIXEL ;
      FONT oFont TITLE FWVERSION + "
Ricerca Comuni"

   @ 110,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oComuni AUTOCOLS CELL LINES NOBORDER



   oBrw:aCols[2]:uBarGetVal:= Space(60)
   oBrw:aCols[3]:uBarGetVal:= Space(2)
   oBrw:nGetBarHeight:=33
   oBrw:lGetBar   := .t.


     WITH OBJECT oBrw
      :nHeaderHeight    := 40 // optional
      :oHeaderFonts     := oBold
      :bClrEdits        := { || { CLR_BLACK, CLR_YELLOW } }
      :AutoFit()
      //
      :CreateFromCode()
   END

    @ 10,20 SAY "
Gets under Headers. Entered values can be used" + ;
      "
for filtering or any othe purpose" + CRLF + ;
      "
Usage: oCol:uBarGetVal := Space( 10 ); oBrw:lGetBar := .t." ;
      SIZE oDlg:nWidth - 40,40 PIXEL OF oDlg CENTER

   @ 60, 20 BTNBMP PROMPT { || If( oBrw:lGetBar, "
Nascondi", "Mostra" ) } ;
      SIZE 100,40 PIXEL OF oDlg FLAT ;
      ACTION ( oBrw:lGetBar := ! oBrw:lGetBar, oBrw:Refresh() )

   @ 60,140 BTNBMP PROMPT "
Ricerca" ;
      SIZE 100,40 PIXEL OF oDlg FLAT ;
      ACTION ( oBrw:cAlias )->( SetFilter( oBrw ) )

   @ 60,250 BTNBMP PROMPT "
Pulisci" ;
      SIZE 100,40 PIXEL OF oDlg FLAT ;
      ACTION ( oBrw:cAlias )->( DBCLEARFILTER(), oBrw:Refresh(), oBrw:SetFocus() )

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont, oBold

   return nil
//-----------------------------------------------------------------------//

static function SetFilter( oBrw)

   local cFilter := "
"
   local n, oCol, uVal, cType

   for n := 1 to Len( oBrw:aCols )
      oCol  := oBrw:aCols[ n ]
      if ! Empty( uVal := oCol:uBarGetVal )
         if !Empty( cFilter )
            cFilter  += "
.AND. "
         endif
         cType    := ValType( uVal )

         do case
         case cType == 'C'
            uVal     := Upper( AllTrim( uVal ) )
            cFilter += '"
' + uVal + '" $ UPPER( ' + FieldName( n ) + " )"
         otherwise
            cFilter  += FieldName( n ) + "
== " + cValToChar( uVal )
         endcase
      endif

   next

   if Empty( cFilter )
      if ! Empty( DBFILTER() )
         DBCLEARFILTER()
         oBrw:Refresh()
      endif
   else
      if !( DBFILTER() == cFilter )
         SET FILTER TO &cFilter
         GO TOP
         oBrw:Refresh()
      endif
   endif

   oBrw:SetFocus()

return nil

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







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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: lgetbar on road

Postby Silvio.Falconi » Sat Mar 30, 2019 10:15 am

ok I resolved with ...DATASOURCE oComuni:cAlias

Now How resolve the search without use buttons on dialog ?

I made
oBrw:aCols[2]:uBarGetVal:= Space(60)
oBrw:aCols[2]:cBarGetBmp:= "search.bmp"
oBrw:aCols[2]:bBarGetAction:= { || ( oBrw:cAlias )->( SetFilter( oBrw ) ) }

oBrw:aCols[3]:uBarGetVal:= Space(2)
oBrw:aCols[3]:cBarGetBmp:= "search.bmp"
oBrw:aCols[3]:bBarGetAction:= { || ( oBrw:cAlias )->( SetFilter( oBrw ) ) }

but give me error when I press button on get
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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: lgetbar on road

Postby Marcelo Roggeri » Sun Mar 31, 2019 3:00 pm

Silvio es asi como se hace lo probe aqui y filtra lo que quieres
Code: Select all  Expand view  RUN
  oBrw:aCols[2]:uBarGetVal    := Space(60)
   oBrw:aCols[2]:cBarGetBmp    := "search.bmp"
   oBrw:aCols[2]:bBarGetAction := {|| (oBrw: cAlias) -> (SetFilter(oBrw))}

   oBrw:aCols[3]:uBarGetVal    := Space(2)
   oBrw:aCols[3]:cBarGetBmp    := "search.bmp"
   oBrw:aCols[3]:bBarGetAction := {|| (oBrw: cAlias) -> (SetFilter(oBrw))}
 


Tu parte del código tiene espacio en blanco tal vez sea eso.
Reemplaza tu código con este.
saludos
FWH - Harbour - BCC7 - PellesC
User avatar
Marcelo Roggeri
 
Posts: 342
Joined: Sat Jul 22, 2006 9:04 pm
Location: Venado Tuerto - Santa Fe -Argentina

Re: lgetbar on road

Postby Silvio.Falconi » Sun Mar 31, 2019 4:48 pm

Marcello ,
I have also problems
I call this function with

@ 82, 82 BUTTON oBut1 Prompt ".." SIZE 10, 9 PIXEL OF oFrmFiscale;
ACTION SelezioneComuni(@CodLuogoNascita,@cLuogoNascita,@cProvinciaNascita,oGet)

Code: Select all  Expand view  RUN
Function SelezioneComuni(oComuni,cCodice,cComune,cProvincia,oGet)
   local oDlg, oBrw, oFont, oBold
   local n
   Local  xComune
   Local  lRet:=.F.
   local nArea  := Select()

    IF ! EMPTY(cComune)
               xComune:=Upper(Alltrim(cComune))
               oComuni:seek(xComune)
            ENDIF



   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
   DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-12 BOLD


     DEFINE DIALOG oDlg TITLE "Ricerca Comuni" ;
     FROM 452, 774 to 880, 1303 PIXEL  FONT oFont COLOR 0, 14215660

   @ 32,0 XBROWSE oBrw SIZE -2, -2 PIXEL OF oDlg ;
      DATASOURCE oComuni AUTOCOLS CELL LINES NOBORDER


   oBrw:aCols[2]:uBarGetVal:= Space(60)
   oBrw:aCols[2]:cBarGetBmp:= "find.png"
   oBrw:aCols[2]:bBarGetAction:= { || ( oBrw:cAlias )->( SetFilter( oBrw ) ) }

   oBrw:aCols[3]:uBarGetVal:= Space(2)
   oBrw:aCols[3]:cBarGetBmp:= "find.png"
   oBrw:aCols[3]:bBarGetAction:= { || ( oBrw:cAlias )->( SetFilter( oBrw ) ) }

   oBrw:nGetBarHeight:=20
   oBrw:lGetBar   := .t.
   oBrw:bClrStd   := { || { CLR_BLACK, If( oBrw:KeyNo % 2 == 0, RGB(193,221,255), RGB(221,245,255) ) } }
   oBrw:bLDblClick:={ || ( lRet:=.T.,oDlg:End() )}
   oBrw:bKeyChar := { |n| If( n == 13, ( (lRet:=.T.,oDlg:End()) ), nil ) }



     WITH OBJECT oBrw
      *:nHeaderHeight    := 40 // optional
      :oHeaderFonts     := oBold
      :bClrEdits        := { || { CLR_BLACK, CLR_YELLOW } }
      :AutoFit()
      :lHscroll            := .F.
      :l2007               := .F.
      :l2015               := .T.
      :lRecordSelector     := .f.
      :nStretchCol         := STRETCHCOL_WIDEST
      :lAllowRowSizing     := .F.
      :lAllowColSwapping   := .F.
      :lAllowColHiding     := .F.

      //
      :CreateFromCode()
   END

                    for n := 1 to len(oBrw:aCols)
                      oBrw:aCols[n]:lAllowSizing := .f.
                   next

     oBrw:setStyle(2018)

     ACTIVATE DIALOG oDlg CENTERED  VALID !GETKEYSTATE( VK_ESCAPE );
     ON INIT BarSelezione(oDlg,oBrw)

      IF Empty(oComuni:localita)
         lRet:=.F.
      ENDIF


   IF lRet

      cCodice     := oComuni:Codice
      cComune     := oComuni:Localita
      cProvincia  := oComuni:Provincia

      oGet[5]:Refresh()
      oGet[6]:Refresh()
      oGet[7]:Refresh()

   ENDIF














   RELEASE FONT oFont, oBold

   return nil
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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: lgetbar on road

Postby Silvio.Falconi » Sun Mar 31, 2019 5:02 pm

Now run but I not understood
I had to enter oComuni but oComuni is static, probably there is another error somewhere else

SEE THIS IMAGE
https://ibb.co/0YxB1g2

Code: Select all  Expand view  RUN
Function SelezioneComuni(cCodice,cComune,cProvincia,oGet)
   local oDlg, oBrw, oFont, oBold
   local n
   Local  xComune
   Local  lRet:=.F.
   local nArea  := Select()

           IF ! EMPTY(cComune)
               xComune:=Upper(Alltrim(cComune))
               oComuni:seek(xComune)
            ENDIF



   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
   DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-12 BOLD


     DEFINE DIALOG oDlg TITLE "Ricerca Comuni" ;
     FROM 452, 774 to 880, 1303 PIXEL  FONT oFont COLOR 0, 14215660

     @ 32,0 XBROWSE oBrw SIZE -2, -2 PIXEL OF oDlg         ;
            COLUMNS  "CODICE","LOCALITA","PROVINCIA","CAP" ;
            HEADERS  "Codice","Località","Provincia","Cap" ;
            COLSIZES  40,120,60,50 ;
            CELL LINES NOBORDER ;
            DATASOURCE oComuni


   oBrw:aCols[2]:uBarGetVal:= Space(60)
   oBrw:aCols[2]:cBarGetBmp:= "find.png"
   oBrw:aCols[2]:bBarGetAction:= { || ( oBrw:cAlias )->( SetFilter( oBrw ) ) }

   oBrw:aCols[3]:uBarGetVal:= Space(2)
   oBrw:aCols[3]:cBarGetBmp:= "find.png"
   oBrw:aCols[3]:bBarGetAction:= { || ( oBrw:cAlias )->( SetFilter( oBrw ) ) }

   oBrw:nGetBarHeight:=20
   oBrw:lGetBar   := .t.
   oBrw:bClrStd   := { || { CLR_BLACK, If( oBrw:KeyNo % 2 == 0, RGB(193,221,255), RGB(221,245,255) ) } }
   oBrw:bLDblClick:={ || ( lRet:=.T.,oDlg:End() )}
   oBrw:bKeyChar := { |n| If( n == 13, ( (lRet:=.T.,oDlg:End()) ), nil ) }



     WITH OBJECT oBrw
      *:nHeaderHeight    := 40 // optional
      :oHeaderFonts     := oBold
      :bClrEdits        := { || { CLR_BLACK, CLR_YELLOW } }
      :AutoFit()
      :lHscroll            := .F.
      :l2007               := .F.
      :l2015               := .T.
      :lRecordSelector     := .f.
      :nStretchCol         := STRETCHCOL_WIDEST
      :lAllowRowSizing     := .F.
      :lAllowColSwapping   := .F.
      :lAllowColHiding     := .F.

      //
      :CreateFromCode()
   END

                    for n := 1 to len(oBrw:aCols)
                      oBrw:aCols[n]:lAllowSizing := .f.
                   next

     oBrw:setStyle(2018)

     ACTIVATE DIALOG oDlg CENTERED  VALID !GETKEYSTATE( VK_ESCAPE );
     ON INIT BarSelezione(oDlg,oBrw)

      IF Empty(oComuni:localita)
         lRet:=.F.
      ENDIF


   IF lRet

      cCodice     := oComuni:Codice
      cComune     := oComuni:Localita
      cProvincia  := oComuni:Provincia

      oGet[5]:Refresh()
      oGet[6]:Refresh()
      oGet[7]:Refresh()

   ENDIF


   RELEASE FONT oFont, oBold

   return nil
//-----------------------------------------------------------------------//

static function SetFilter( oBrw)

   local cFilter := ""
   local n, oCol, uVal, cType

   for n := 1 to Len( oBrw:aCols )
      oCol  := oBrw:aCols[ n ]
      if ! Empty( uVal := oCol:uBarGetVal )
         if !Empty( cFilter )
            cFilter  += " .AND. "
         endif
         cType    := ValType( uVal )

         do case
         case cType == 'C'
            uVal     := Upper( AllTrim( uVal ) )
            cFilter += '"' + uVal + '" $ UPPER( ' + FieldName( n ) + " )"
         otherwise
            cFilter  += FieldName( n ) + " == " + cValToChar( uVal )
         endcase
      endif

   next

   if Empty( cFilter )
      if ! Empty( DBFILTER() )
         DBCLEARFILTER()
         oBrw:Refresh()
      endif
   else
      if !( DBFILTER() == cFilter )
         SET FILTER TO &cFilter
         GO TOP
         oBrw:Refresh()
      endif
   endif

   oBrw:SetFocus()

return nil

//----------------------------------------------------------------------------//
Function BarSelezione(oDlg,oBrw)
   Local oBar

   DEFINE BUTTONBAR oBar SIZE 64,64  OF oDlg   2015

   oBar:bRClicked := { || .t. }

   DEFINE BUTTON OF oBar ;
       FILENAME "funnel.png"       ;
      Prompt { || If( oBrw:lGetBar, "Nascondi", "Mostra" ) } ;
      ACTION ( oBrw:lGetBar := ! oBrw:lGetBar, oBrw:Refresh() )

    DEFINE BUTTON OF oBar ;
       FILENAME "funnel.png"       ;
      PROMPT "Pulisci ricerca"     ;
      ACTION ( oBrw:cAlias )->( DBCLEARFILTER(), oBrw:Refresh(), oBrw:SetFocus() )



     RETURN NIL






 
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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: lgetbar on road

Postby Marcelo Roggeri » Sun Mar 31, 2019 6:41 pm

En mi caso nunca utilice la clase tDataBase
Te adjunto el ejemplo tuyo como lo hice:
Code: Select all  Expand view  RUN
#include "FiveWin.ch"
#include "Report.ch"
#include "dtpicker.ch"
#include "xBrowse.ch"

static oComuni,oProvince,oStati
static cPathDb

REQUEST DBFCDX


FUNCTION Main()

   *   HB_LangSelect("IT")
    *  HB_SetCodePage("ITWIN")

   SET _3DLOOK ON
   SET CENTURY ON
   SET DATE ITALIAN

   RDDSetDefault( 'DBFCDX' )

   CREODBF()
   CREOCDX()

/*
         cPathDb:="DB\"
         oComuni:= TDatabase():Open( , "COMUNI", "DBFCDX", .T. )
         oComuni:setorder(2)
         oComuni:gotop()
         */


use comuni
SET ORDER TO TAG COMLOC IN comuni


      SelezioneComuni(oComuni)

return nil

//-----------------------------------------------------------------------------//
Function SelezioneComuni(oComuni)
   local oDlg, oBrw, oFont, oBold
   local n
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
   DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-12 BOLD

   DEFINE DIALOG oDlg SIZE 800,500 PIXEL TRUEPIXEL ;
      FONT oFont TITLE FWVERSION + "Ricerca Comuni"

   @ 110,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
            DATASOURCE "comuni" AUTOCOLS CELL LINES NOBORDER


   oBrw:lGetBar   := .t.
   oBrw:nGetBarHeight:=33

   oBrw:aCols[2]:uBarGetVal    := Space(60)
   oBrw:aCols[2]:cBarGetBmp    := "search.bmp"
   oBrw:aCols[2]:bBarGetAction := {|| (oBrw: cAlias) -> (SetFilter(oBrw))}

   oBrw:aCols[3]:uBarGetVal    := Space(2)
   oBrw:aCols[3]:cBarGetBmp    := "search.bmp"
   oBrw:aCols[3]:bBarGetAction := {|| (oBrw: cAlias) -> (SetFilter(oBrw))}



     WITH OBJECT oBrw
      :nHeaderHeight    := 40 // optional
      :oHeaderFonts     := oBold
      :bClrEdits        := { || { CLR_BLACK, CLR_YELLOW } }
      :AutoFit()
      //
      :CreateFromCode()
   END

    @ 10,20 SAY "Gets under Headers. Entered values can be used" + ;
      "for filtering or any othe purpose" + CRLF + ;
      "Usage: oCol:uBarGetVal := Space( 10 ); oBrw:lGetBar := .t." ;
      SIZE oDlg:nWidth - 40,40 PIXEL OF oDlg CENTER

   @ 60, 20 BTNBMP PROMPT { || If( oBrw:lGetBar, "Ocultar", "Mostra" ) } ;
      SIZE 100,40 PIXEL OF oDlg FLAT ;
      ACTION ( oBrw:lGetBar := ! oBrw:lGetBar, oBrw:Refresh() )

   @ 60,140 BTNBMP PROMPT "Busqueda" ;
      SIZE 100,40 PIXEL OF oDlg FLAT ;
      ACTION ( oBrw:cAlias )->( SetFilter( oBrw ) )

   @ 60,250 BTNBMP PROMPT "Limpiar" ;
      SIZE 100,40 PIXEL OF oDlg FLAT ;
      ACTION ( oBrw:cAlias )->( DBCLEARFILTER(), oBrw:Refresh(), oBrw:SetFocus() )

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont, oBold

   return nil
//-----------------------------------------------------------------------//

static function SetFilter( oBrw)

   local cFilter := ""
   local n, oCol, uVal, cType

   for n := 1 to Len( oBrw:aCols )
      oCol  := oBrw:aCols[ n ]
      if ! Empty( uVal := oCol:uBarGetVal )
         if !Empty( cFilter )
            cFilter  += " .AND. "
         endif
         cType    := ValType( uVal )

         do case
         case cType == 'C'
            uVal     := Upper( AllTrim( uVal ) )
            cFilter += '"' + uVal + '" $ UPPER( ' + FieldName( n ) + " )"
         otherwise
            cFilter  += FieldName( n ) + " == " + cValToChar( uVal )
         endcase
      endif

   next

   if Empty( cFilter )
      if ! Empty( DBFILTER() )
         DBCLEARFILTER()
         oBrw:Refresh()
      endif
   else
      if !( DBFILTER() == cFilter )
         SET FILTER TO &cFilter
         GO TOP
         oBrw:Refresh()
      endif
   endif

   oBrw:SetFocus()

return nil

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

FUNCTION CREODBF()
         FIELD CODICE, LOCALITA, PROVINCIA, CAP

         IF .NOT. FILE ("COMUNI.DBF")
            DbCreate( "COMUNI", { { "CODICE"   ,"C", 10, 0 },;
                                     { "LOCALITA" ,"C", 50, 0 },;
                                     { "PROVINCIA","C", 50, 0 },;
                                     { "CAP"      ,"C", 10, 0 } } )
         ENDIF


return nil

FUNCTION CREOCDX()
         FIELD CODICE, LOCALITA, PROVINCIA, CAP

         IF .NOT. FILE ("COMUNI.CDX")

         USE COMUNI

         INDEX ON CODICE    TAG COMCOD TO COMUNI
         INDEX ON LOCALITA  TAG COMLOC TO COMUNI
         INDEX ON PROVINCIA TAG COMPRO TO COMUNI
         INDEX ON CAP       TAG COMCAP TO COMUNI

         CLOSE ALL

         ENDIF


return nil
FWH - Harbour - BCC7 - PellesC
User avatar
Marcelo Roggeri
 
Posts: 342
Joined: Sat Jul 22, 2006 9:04 pm
Location: Venado Tuerto - Santa Fe -Argentina

Re: lgetbar on road

Postby Silvio.Falconi » Sun Mar 31, 2019 7:05 pm

with oldest mode run ok
now with tdatabase make error on setfilter func
this line

if !( DBFILTER() == cFilter )
SET FILTER TO &cFilter
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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: lgetbar on road

Postby Silvio.Falconi » Sun Mar 31, 2019 7:13 pm

Now I changed
if Empty( cFilter )
if ! Empty( DBFILTER() )
oDbf:setfilter()
* DBCLEARFILTER()
oBrw:Refresh()
endif
else
if !( DBFILTER() == cFilter )
* SET FILTER TO &cFilter
oDbf:setfilter(cFilter)
oDbf:gotop()

*GO TOP
oBrw:Refresh()
endif
endif
make this error

Code: Select all  Expand view  RUN
Application
===========
   Path and name: C:\Work\Errori\Prg_ tdatabase\New_clienti_tdatabase\Clienti.Exe (32 bits)
   Size: 4,264,960 bytes
   Compiler version: Harbour 3.2.0dev (r1703231115)
   FiveWin  version: FWH 18.12
   C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
   Windows version: 6.2, Build 9200

   Time from start: 0 hours 0 mins 17 secs
   Error occurred at: 31-03-2019, 21:11:45
   Error description: Error BASE/1102  Argument error: UPPER

Stack Calls
===========
   Called from:  => UPPER( 0 )
   Called from: .\source\classes\DATABASE.PRG => (b)COMPILE( 1133 )
   Called from:  => DBGOTOP( 0 )
   Called from: .\source\classes\DATABASE.PRG => (b)TDATABASE( 189 )
   Called from: .\source\classes\DATABASE.PRG => TDATABASE:GOTOP( 0 )
   Called from: source\ut\ut_codFisc.prg => SETFILTER( 877 )
   Called from: source\ut\ut_codFisc.prg => (b)SELEZIONECOMUNI( 779 )
   Called from: .\source\classes\TGET.PRG => (b)TGET_CREATEBUTTON( 943 )
   Called from: .\source\classes\BUTTON.PRG => TBUTTONBMP:CLICK( 179 )
   Called from: .\source\classes\CONTROL.PRG => TBUTTON:HANDLEEVENT( 1755 )
   Called from: .\source\classes\BUTTONB.PRG => TBUTTONBMP:HANDLEEVENT( 261 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3541 )
   Called from:  => SENDMESSAGE( 0 )
   Called from: .\source\classes\WINDOW.PRG => TGET:COMMAND( 1125 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1801 )
   Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 1151 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3541 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
   Called from: source\ut\ut_codFisc.prg => SELEZIONECOMUNI( 818 )
   Called from: source\ut\ut_codFisc.prg => (b)CREA_CODFISCALE( 103 )
   Called from: .\source\classes\BUTTON.PRG => TBUTTON:CLICK( 179 )
   Called from: .\source\classes\CONTROL.PRG => TBUTTON:HANDLEEVENT( 1755 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3541 )
   Called from:  => SENDMESSAGE( 0 )



need help of Rao

oBrw:aCols[2]:uBarGetVal:= Space(60)
oBrw:aCols[2]:cBarGetBmp:= "find.png"
oBrw:aCols[2]:bBarGetAction:= { || ( oBrw:cAlias )->( SetFilter( oBrw,oComuni ) ) }

oBrw:aCols[3]:uBarGetVal:= Space(2)
oBrw:aCols[3]:cBarGetBmp:= "find.png"
oBrw:aCols[3]:bBarGetAction:= { || ( oBrw:cAlias )->( SetFilter( oBrw,oComuni ) ) }



Code: Select all  Expand view  RUN
static function SetFilter( oBrw,oDbf)

   local cFilter := ""
   local n, oCol, uVal, cType

   for n := 1 to Len( oBrw:aCols )
      oCol  := oBrw:aCols[ n ]
      if ! Empty( uVal := oCol:uBarGetVal )
         if !Empty( cFilter )
            cFilter  += " .AND. "
         endif
         cType    := ValType( uVal )

         do case
         case cType == 'C'
            uVal     := Upper( AllTrim( uVal ) )
            cFilter += '"' + uVal + '" $ UPPER( ' + FieldName( n ) + " )"
         otherwise
            cFilter  += FieldName( n ) + " == " + cValToChar( uVal )
         endcase
      endif

   next

   if Empty( cFilter )
      if ! Empty( DBFILTER() )
          oDbf:setfilter()
        * DBCLEARFILTER()
         oBrw:Refresh()
      endif
   else
      if !( DBFILTER() == cFilter )
       *  SET FILTER TO &cFilter
         oDbf:setfilter(cFilter)
         oDbf:gotop()
         *GO TOP
         oBrw:Refresh()
      endif
   endif

   oBrw:SetFocus()

return nil
 
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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: lgetbar on road

Postby Silvio.Falconi » Sat Apr 06, 2019 6:39 am

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: 7075
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 33 guests