Filter on Xbrowse

Filter on Xbrowse

Postby Silvio.Falconi » Thu May 02, 2024 12:21 pm

I must change the nHeight of a Xbrowse on line and ask a filter to a end user and make the filter in a xbrowse , how I can make ?

sample : customer.dbf
I wish ask a filter


Image

for example
I would like to know the married and the unmarried

when I click on the first checkbox the procedure must raise the xbrowse and insert two married / not moved radio controls if I click on the second checkbox it must raise the xbrowse and insert
3 checkboxes 50 years, 25 years, 20 years and obviously I have to filter the archive and refresh the xbrowse
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: Filter on Xbrowse

Postby karinha » Thu May 02, 2024 5:59 pm

Algo asi?

https://imgur.com/N5rBcUG

Image

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Filter on Xbrowse

Postby Silvio.Falconi » Thu May 02, 2024 6:37 pm

karinha wrote:Algo asi?

https://imgur.com/N5rBcUG

Image

Regards, saludos.



NO

Unfortunately I see that perhaps you didn't understand
I know how to filter with ordscope/dbfilter but that's not what I meant

I would like it like this:

two checkboxes must be under the xbrowse next to the words "filter by"

1) if I click in the first checkbox (married) the procedure must change the size of the xbrowse and must display two radio items at the top above the words "filter by"
1) married 2) unmarried

2) if I click in the second checkbox (age) the procedure must further change the dimensions of the xbrowse and insert the three possibilities with radioitems above
1) 20 2) 40 3) over 50

Image

Code: Select all  Expand view  RUN
#include 'fivewin.ch'
#include 'xbrowse.ch'
#include 'constant.ch'

 #define DLG_nColorDlg     RGB(245,245,235)
 #define DLG_nColortitle1  RGB(219,230,244)
 #define DLG_nColortitle2  RGB(207,221,239)
 #define DLG_nColorBar1    RGB(250,250,245)
 #define DLG_nColorBar2    RGB(245,245,235)
 #define DLG_nColorBtn1    RGB(245,245,235)
 #define DLG_nColorBtn2    RGB(250,250,245)
 #define DLG_nColorBtnB    RGB(195,195,185)


REQUEST DBFCDX

Function test()
   local oDlg, oBrw, oFont,oBold, oList,oBrush
         local nBottom:= 32.4
         local nRight := 95
         local nHt       := nBottom * DLG_CHARPIX_H
         local nWd       := Max( nRight * DLG_CHARPIX_W, 180 )

   local  aCols    := { ;
                   { "FIRST",   "First"   ,,   80, },;
                   { "LAST",    "Last",,   80, },;
                   { "STREET",  "Address"   ,,   100, },;
                   { "CITY",    "City"        ,,   90, } }

   local oSayfiltro
   local oCbx1,lmarried:=.f.
   local oCbx2,lAge:=.f.
   local nMarried,oCbx3
   local nRow:= 400,nCol:= 10
   local nInterlinea := 20


       oList:=TCustomer():New()
       oList:setorder(1)
       oList:Gotop()

  oFont := TFont():New( "TAHOMA", 0, 14,, )
  oBold := TFont():New( "TAHOMA", 0, 14,,.t. )
  DEFINE BRUSH oBrush   STYLE BDIAGONAL COLOR  Rgb(195,195,185)

   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
       FONT oFont   COLOR CLR_BLACK, RGB(245,245,235)  ;
       STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
                  WS_MINIMIZEBOX)

   @ 40,10 XBROWSE oBrw SIZE -10,-100 PIXEL OF oDlg ;
          DATASOURCE oList COLUMNS aCols ;
          AUTOSORT FONT oFont;
          NOBORDER CELL LINES

   MyStyleBrowse(oBrw,oBrush)

 WITH OBJECT oBrw


   :nMarqueeStyle    = MARQSTYLE_HIGHLWIN7
   :CreateFromCode()
END



    @ nRow,5 Say oSayfiltro Prompt "Filter by  " size 100,20 PIXEL of odlg TRANSPARENT

    @ nRow, 125 CHECKBOX oCbx1 VAR lmarried  ;
                          PROMPT "Married" OF oDlg SIZE 80,15 PIXEL ;
                          ON CHANGE  changeBrw(oBrw,lmarried)


    @ nRow, 250 CHECKBOX oCbx2 VAR lAge  ;
                          PROMPT "Age" OF oDlg SIZE 100,15 PIXEL

   nRow-=30
   @ nRow,5 Say oSayfiltro Prompt "Married :  " size 80,20 PIXEL of odlg TRANSPARENT
   @ nRow, 120 RADIO oCbx3 VAR nMarried ITEMS "Married" _3D SIZE 55, 25 PIXEL OF oDlg  WHEN lmarried
   @ nRow, 300 RADIOITEM "Not Married" RADIOMENU oCbx3  OF oDlg SIZE 110, 14 PIXEL      WHEN lmarried

   nRow-=30
   @ nRow,5 Say oSayfiltro Prompt "Age :  " size 80,20 PIXEL of odlg TRANSPARENT
   @ nRow, 120 RADIO oCbx3 VAR nMarried ITEMS "20" _3D SIZE 55, 25 PIXEL OF oDlg  WHEN lAge
   @ nRow, 300 RADIOITEM "over 50" RADIOMENU oCbx3  OF oDlg SIZE 110, 14 PIXEL      WHEN lAge


    */



   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

return nil
//----------------------------------------------------------------//
 Static function changeBrw(oBrw,lmarried)
    IF lmarried
    oBrw:nHeight -= 40
 else
    oBrw:nHeight += 40
 endif
    oBrw:refresh()
    return nil
//----------------------------------------------------------------//


Function Formato_Cod_conto(oList)
   local cString:=""
   If !empty(oList:codconto1)
      cString+=alltrim(oList:codconto1)
   Endif
   If !empty(oList:codconto2)
      cString+="."+alltrim(oList:codconto2)
   Endif
   If !empty(oList:codconto3)
      cString+="."+alltrim(oList:codconto3)
   Endif
   If !empty(oList:codconto4)
      cString+="."+alltrim(oList:codconto4)
   Endif
   If !empty(oList:codconto5)
      cString+="."+alltrim(oList:codconto5)
   Endif
  return ltrim(cString)

Function MyStyleBrowse(oBrw,oBrush)
   local nColorHeader  := DLG_nColorDlg
   local nColorFooter  := DLG_nColorDlg
   local nColorPigiama := RGB(243,243,238)

  WITH OBJECT oBrw
            :nRowHeight          := 25
            :l2007               := .F.
            :l2015               := .T.
            :lRecordSelector     := .F.
            :nColDividerStyle    := LINESTYLE_LIGHTGRAY
            :nRowDividerStyle    := LINESTYLE_LIGHTGRAY
            :nStretchCol         := STRETCHCOL_WIDEST
            :nMarqueeStyle        := MARQSTYLE_HIGHLROW

            :lDisplayZeros        := .f.

            :lAllowRowSizing     := .F.
            :lAllowColSwapping   := .F.
          *  :lAllowColHiding     := .F.
            :lAllowSizings       := .F.

             :lDrawBorder := .t.
             :nClrBorder := CLR_BROWN // Rgb(195,195,185)
             :lDrawBorderIn   := .F.


            :bRecSelHeader    := ""
       *     :bClrSelFocus := { || {,rgb(255,255,224)}}
            :bClrRowFocus := { || {, rgb(255,255,224)}}
           * :nRecSelColor     :=   nRgb( 245,244,234)
            :bClrHeader       := {|| { ,nColorHeader } }
            :bClrFooter       := {|| { ,nColorFooter } }
            :bClrStd := { || { CLR_BLACK, If( oBrw:KeyNo % 2 == 0, CLR_WHITE,nColorPigiama ) } }


           :oBrushs := { |o| If( o != nil .and. Empty( o:Value ) .and. ;
              Empty( XEval( o:bBmpData, o:Value, .t., o ) ) .and. ;
              Empty( XEval( o:bStrImage, o, o:oBrw ) ), oBrush, nil ) }


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

CLASS TXData from TDatabase
      DATA cDbfPath   init ".\"
     ENDCLASS
CLASS TCustomer from TXData
   METHOD New()
ENDCLASS
 METHOD New( lShared ) CLASS TCustomer
   Default lShared := .t.
   ::super:New(,::cDbfPath + "
Customer" ,"DBFCDX", lShared)
   if ::use()
      ::setOrder(1)
      ::gotop()
   endif
RETURN Self
Last edited by Silvio.Falconi on Thu May 02, 2024 7:08 pm, edited 1 time in total.
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: Filter on Xbrowse

Postby Marc Venken » Thu May 02, 2024 7:06 pm

Silvio,

Consider this approuch :

From any Xbrowse I call the filter option from the buttonbar (Set Filter) :

Image

In admin modus I can build any filter from insite the xbrowse :

Image

In user mode, only the filter that you selected will be displayed for selection by the user.

Image

Selecting the filter will update the browse.

We all know that if we start building filters and use buttons etc... there will be alway short of options or complex screens. Now the customer simple read the filter name and select.

The way I generate my filters is that I use xbrowse filter headers, fill in some data and copy the filter expression into my filter DBF.

Image

If the idea is usable, i can post some code ....
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1439
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Filter on Xbrowse

Postby karinha » Thu May 02, 2024 7:11 pm

Silvio, Sorry. I really don't understand the logic you want.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Filter on Xbrowse

Postby Marc Venken » Thu May 02, 2024 7:16 pm

My idea is also not what you want ))
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1439
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Filter on Xbrowse

Postby Silvio.Falconi » Thu May 02, 2024 7:19 pm

karinha wrote:Silvio, Sorry. I really don't understand the logic you want.

Regards, saludos.


Marc Venken wrote:My idea is also not what you want ))



No I want another situation

Why do you want to impose something on me that I don't need?

I realized that I have to do a simulation to make you understand what I would like to create


First step init I see the xbrowse and the checkboxes under the xbrowse

Image


Second step the end user click first checkbox, the xbrowse change the size and sho first group of radiomenu

Image

third step the end user also clicks the age checkbox and the procedure further raises the xbrowse and shows the options

Image

obviously if the user clicks the age checkbox first the procedure must create the radioitems first

obviously if I uncheck the initial checkboxes the radio menus must disappear and lower the xbrowse
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: Filter on Xbrowse

Postby karinha » Fri May 03, 2024 4:39 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Filter on Xbrowse

Postby karinha » Fri May 03, 2024 4:41 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Filter on Xbrowse

Postby karinha » Fri May 03, 2024 4:43 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Filter on Xbrowse

Postby karinha » Fri May 03, 2024 4:49 pm

Good afternoon Silvio. I'm learning to use xBrowse, could you tell me if I made a mistake, please?

Buenas tardes Silvio. Estoy aprendiendo a usar xBrowse, ¿podría decirme si cometí un error, por favor?

Code: Select all  Expand view  RUN

// C:\SILVXBRW\TESTXBR5.PRG  - Simples teste de xBrowse com indices.
// MODIFICADO EM: 03/05/2024 - INDEX ou ORDSCOPE()? - kapiabafwh@gmail.com

#Include 'Fivewin.ch'
#Include 'xBrowse.ch'

ANNOUNCE RDDSYS
REQUEST OrdKeyNo, OrdKeyCount, OrdCreate, OrdKeyGoto
REQUEST DBFCDX, DBFFPT

STATIC nOpcRad := 3, oMarried, lMarried := .F., oAge, lAge := .F.

FUNCTION Main()

   FIELD FIRST, LAST, STREET, CITY, STATE, ZIP, HIREDATE, MARRIED, AGE, ;
         SALARY, NOTES

   LOCAL oDlg, oBrw, oFont, oFnt, ovFont, oSaida, cTitle, aGrad, cAlias

   hb_gcAll( .F. )

   RDDSETDEFAULT("DBFCDX")
   RDDREGISTER( "DBFCDX", 1 )

   SET CENTURY ON
   SET DATE BRITISH
   SET TIME FORMAT TO "HH:MM:SS"
   SET EPOCH TO YEAR( DATE() ) - 30
   SET SOFTSEEK OFF
   SET WRAP ON
   SETCANCEL( .F. )
   SET CONFIRM OFF
   SET DELETED ON
   SET _3DLOOK ON
   SET UNIQUE OFF
   SET ESCAPE OFF
   SET EXACT ON
   SET EXCLUSIVE OFF
   SET MULTIPLE OFF
   SET OPTIMIZE ON

   SetBalloon( .T. )
   SkinButtons()

   IF FILE( "CUSTOMER.CDX" )

      FErase( "CUSTOMER.CDX" )

   ENDIF

   USE CUSTOMER NEW EXCLUSIVE ALIAS CUSTOMER

   INDEX ON STREET  TAG 01 TO CUSTOMER FOR .NOT. DELETED()

   INDEX ON MARRIED TAG 02 TO CUSTOMER FOR .NOT. DELETED()

   INDEX ON AGE     TAG 03 TO CUSTOMER FOR .NOT. DELETED()

   CLOSE DATABASES

   USE CUSTOMER INDEX CUSTOMER NEW SHARED
   SET ORDER TO 01 // STREET
   GO TOP

   cAlias := ALIAS()

   cTitle := "xBrowse Filter Advanced 3.0 Model by Silvio Falconi"

   DEFINE FONT oFont  NAME 'TAHOMA' SIZE 0, - 14 BOLD
   DEFINE FONT oFnt   NAME 'TAHOMA' SIZE 0, - 12 BOLD
   DEFINE FONT oVfont NAME 'TAHOMA' SIZE 0, - 12 NESCAPEMENT 900 BOLD

   aGrad := { { 0.30, nRGB( 221, 245, 255 ), nRGB( 192, 221, 255 ) }, ;
              { 0.50, nRGB( 192, 221, 255 ), nRGB( 221, 245, 255 ) } }
                             // 460
   DEFINE DIALOG oDlg SIZE 560, 500 PIXEL TRUEPIXEL FONT oFont ;
      TITLE cTitle GRADIENT aGrad
     
   oDlg:lHelpIcon := .F.

   @ 20, 10 XBROWSE oBrw SIZE 540, 380 PIXEL OF oDlg FONT oFnt ;
      COLUMNS "First", "Last", "Street", "Married", "Age"      ;
      ALIAS 'CUSTOMER' LINES CELL

   xBrwColors( oBrw, .T. )

   oBrw:nColSel := 3

   oBrw:aCols[ 1 ]:nWidth :=  80  // First
   oBrw:aCols[ 1 ]:nDataStrAlign := AL_CENTER

   oBrw:aCols[ 2 ]:nWidth :=  80  // Last

   oBrw:aCols[ 2 ]:nDataStrAlign := AL_CENTER
   oBrw:aCols[ 3 ]:nWidth := 190  // Street

   oBrw:aCols[ 3 ]:bClrStd := { || { CLR_BLACK, RGB( 255, 255, 200 ) } }

   oBrw:aCols[ 4 ]:nWidth :=  60  // Married
   oBrw:aCols[ 4 ]:nDataStrAlign := AL_CENTER

   oBrw:aCols[ 5 ]:nWidth :=  40  // Age
   oBrw:aCols[ 5 ]:nDataStrAlign := AL_CENTER

   oBrw:nColDividerStyle := LINESTYLE_LIGHTGRAY
   oBrw:nRowDividerStyle := LINESTYLE_LIGHTGRAY
   oBrw:nStretchCol      := STRETCHCOL_WIDEST // Ajusta as colunas do xBrowse.

   oBrw:lDrawBorder := .T.
   oBrw:nClrBorder  := Rgb( 195, 195, 185 )

   WITH OBJECT oBrw:oCol( "First" )
      :oHeaderFont := oVFont
      :cHeader := "Primero"
   END

   WITH OBJECT oBrw:oCol( "Last" )
      :oHeaderFont := oVFont
      :cHeader := "Último"
   END

   WITH OBJECT oBrw:oCol( "Street" )
      :oHeaderFont := oVFont
      :cHeader := "Calle"
   END

   WITH OBJECT oBrw:oCol( "Married" )
      :oHeaderFont := oVFont
      :cHeader := "Cadado"
   END

   WITH OBJECT oBrw:oCol( "Age" )
      :oHeaderFont := oVFont
      :cHeader := "Edad"
   END

   oBrw:CreateFromCode()
   oDlg:oClient := oBrw

   @ 415, 075  SAY "Filtrar por: " SIZE 150, 20 OF oDlg PIXEL UPDATE   ;
     COLORS METRO_ORANGE, CLR_WHITE FONT oFnt TRANSPARENT

   @ 415, 150 CHECKBOX oMarried VAR lMarried PROMPT "&Casados" OF oDlg ;
      SIZE 100, 15 PIXEL UPDATE                                        ;
      ON CHANGE( MENU_SILVIO_FILTRO_MARRIED( cAlias, oBrw, oMarried ) )

   oMarried:cToolTip := OemToAnsi( "Búsqueda de casados(Married)" )

   @ 415, 250 CHECKBOX oAge     VAR lAge     PROMPT "&Edad" OF oDlg    ;
      SIZE 100, 15 PIXEL UPDATE                                        ;
      ON CHANGE( MENU_SILVIO_FILTRO_EDAD( cAlias, oBrw, oAge ) )

   oAge:cToolTip := OemToAnsi( "Búsqueda por Edad(Age)" )

   @ 470, 005  SAY "kapiabafwh@gmail.com" SIZE 200, 20 OF oDlg PIXEL UPDATE ;
     COLORS METRO_COBALT, CLR_WHITE FONT oFnt TRANSPARENT

   @ 440, 400 BUTTONBMP oSaida PROMPT "  &Salida" OF oDlg TEXTRIGHT PIXEL   ;
      BITMAP ".\EXIT.BMP" SIZE 100, 40 ACTION( oDlg:End(), LIBERA_TUDO() )  ;
      FONT oFont CANCEL

   oSaida:cToolTip := "Saida - Exit - Cancelar"

   ACTIVATE DIALOG oDlg CENTERED ON INIT( CTRLS_COLORS( oDlg ) )

   oFont:End()
   ovFont:End()

   dbCloseAll() // CLOSE DATABASES

   // seguridad
   lMarried := .F.
   lAge     := .F.

RETURN NIL

FUNCTION MENU_SILVIO_FILTRO_MARRIED( cAlias, oBrw, oMarried )

   LOCAL oDlg, oFont, oFnt, ovFont, oSaida, cTitle, aGrad, oSay, oRadmenu

   nOpcRad := 3

   oMarried:Disable()
   oMarried:Refresh()

   cTitle := "xBrowse: Filtrar: Elija una opción:"

   DEFINE FONT oFont  NAME 'TAHOMA' SIZE 0, - 14 BOLD
   DEFINE FONT oFnt   NAME 'TAHOMA' SIZE 0, - 12 BOLD
   DEFINE FONT oVfont NAME 'TAHOMA' SIZE 0, - 12 NESCAPEMENT 900 BOLD

   aGrad := { { 0.30, nRGB( 221, 245, 255 ), nRGB( 192, 221, 255 ) }, ;
              { 0.50, nRGB( 192, 221, 255 ), nRGB( 221, 245, 255 ) } }

   DEFINE DIALOG oDlg SIZE 250, 200 PIXEL TRUEPIXEL FONT oFont ;
      TITLE cTitle GRADIENT aGrad
     
   oDlg:lHelpIcon := .F.

   @ 12, 090 SAY oSay PROMPT "Filtrar Por: " SIZE 100, 24 PIXEL OF oDlg ;
      FONT oFont COLORS METRO_COBALT, CLR_WHITE TRANSPARENT

   @ 50.5, 070 RADIO oRadMenu VAR nOpcRad ITEMS "Casados" OF oDlg ;
      SIZE 100, 16 PIXEL UPDATE                                   ;
      ON CHANGE( CHANGE_INDICES_CASADO( nOpcRad, cAlias, oBrw ),  ;
                 oBrw:Refresh(), oBrw:SetFocus() )

   @ 80.5, 070 RADIOITEM "No Casados" RADIOMENU oRadMenu OF oDlg  ;
      SIZE 100, 16 PIXEL UPDATE

   @ 140, 072 BUTTONBMP oSaida PROMPT "  &Salida" OF oDlg TEXTRIGHT PIXEL ;
      BITMAP ".\EXIT.BMP" SIZE 100, 40 ACTION( oDlg:End() ) FONT oFont CANCEL

   oSaida:cToolTip := "Saida - Exit - Cancelar"

   ACTIVATE DIALOG oDlg CENTERED ON INIT( CTRLS_COLORS( oDlg ) )

   lMarried := .F.

   oMarried:Enable()
   oMarried:Refresh()

   oBrw:SetFocus()

RETURN NIL

FUNCTION MENU_SILVIO_FILTRO_EDAD( cAlias, oBrw, oAge )

   LOCAL oDlg, oFont, oFnt, ovFont, oSaida, cTitle, aGrad, oSay, oRadmenu

   nOpcRad := 3

   oAge:Disable()
   oAge:Refresh()

   cTitle := "xBrowse: Filtrar: Elija una opción:"

   DEFINE FONT oFont  NAME 'TAHOMA' SIZE 0, - 14 BOLD
   DEFINE FONT oFnt   NAME 'TAHOMA' SIZE 0, - 12 BOLD
   DEFINE FONT oVfont NAME 'TAHOMA' SIZE 0, - 12 NESCAPEMENT 900 BOLD

   aGrad := { { 0.30, nRGB( 221, 245, 255 ), nRGB( 192, 221, 255 ) }, ;
              { 0.50, nRGB( 192, 221, 255 ), nRGB( 221, 245, 255 ) } }

   DEFINE DIALOG oDlg SIZE 250, 200 PIXEL TRUEPIXEL FONT oFont ;
      TITLE cTitle GRADIENT aGrad
     
   oDlg:lHelpIcon := .F.

   @ 12, 090 SAY oSay PROMPT "Filtrar Por: " SIZE 100, 24 PIXEL OF oDlg   ;
      FONT oFont COLORS METRO_COBALT, CLR_WHITE TRANSPARENT

   @ 50.5, 070 RADIO oRadMenu VAR nOpcRad ITEMS "Hasta 20 años" OF oDlg   ;
      SIZE 130, 16 PIXEL UPDATE                                           ;
      ON CHANGE( CHANGE_INDICES_EDAD( nOpcRad, cAlias, oBrw ),            ;
                 oBrw:Refresh(), oBrw:SetFocus() )

   @ 80.5, 070 RADIOITEM "Más de 50 años" RADIOMENU oRadMenu OF oDlg      ;
      SIZE 130, 16 PIXEL UPDATE

   @ 140, 072 BUTTONBMP oSaida PROMPT "  &Salida" OF oDlg TEXTRIGHT PIXEL ;
      BITMAP ".\EXIT.BMP" SIZE 100, 40 ACTION( oDlg:End() ) FONT oFont CANCEL

   oSaida:cToolTip := "Saida - Exit - Cancelar"

   ACTIVATE DIALOG oDlg CENTERED ON INIT( CTRLS_COLORS( oDlg ) )

   lAge := .F.

   oAge:Enable()
   oAge:Refresh()

   oBrw:SetFocus()

RETURN NIL

FUNCTION CHANGE_INDICES_CASADO( nOpcRad, cAlias, oBrw )

   LOCAL lCasado := .T., lNoCasado := .F.

   IF nOpcRad     == 2 // No Casados

      SET ORDER TO 02  // MARRIED

      ORDSCOPE( 0, lNoCasado )
      ORDSCOPE( 1, lNoCasado )
      GO TOP

      IF EOF()

         ORDSCOPE( 0, Nil )
         ORDSCOPE( 1, Nil )
         GO TOP

         SELECT( cAlias )
         SET ORDER TO 01
         GO TOP

      ENDIF

   ELSEIF nOpcRad == 1 //->  CASADOS

      SET ORDER TO 02  // MARRIED

      ORDSCOPE( 0, lCasado )
      ORDSCOPE( 1, lCasado )
      GO TOP

      IF EOF()

         ORDSCOPE( 0, Nil )
         ORDSCOPE( 1, Nil )
         GO TOP

         SELECT( cAlias )
         SET ORDER TO 01
         GO TOP

      ENDIF

   ENDIF

   GO TOP

   oBrw:GoBottom()
   oBrw:Refresh()
   oBrw:Gotop()

RETURN NIL

FUNCTION CHANGE_INDICES_EDAD( nOpcRad, cAlias, oBrw )

   LOCAL cEdad20I := 20, cEdad20F := 29, cEdadIni := 50, cEdadFin := 100 //->anos

   IF nOpcRad     == 2 // mas de 50 anos

      SET ORDER TO 03  // EDAD/AGE

      ORDSCOPE( 0, cEdadIni )
      ORDSCOPE( 1, cEdadFin )
      GO TOP

      IF EOF()

         ORDSCOPE( 0, Nil )
         ORDSCOPE( 1, Nil )
         GO TOP

         SELECT( cAlias )
         SET ORDER TO 01
         GO TOP

      ENDIF

   ELSEIF nOpcRad == 1 //->  EDAD/AGE // 20/29 anos.

      SET ORDER TO 03  // EDAD/AGE

      ORDSCOPE( 0, cEdad20I )
      ORDSCOPE( 1, cEdad20F )
      GO TOP

      IF EOF()

         ORDSCOPE( 0, Nil )
         ORDSCOPE( 1, Nil )
         GO TOP

         SELECT( cAlias )
         SET ORDER TO 01
         GO TOP

      ENDIF

   ENDIF

   GO TOP

   oBrw:GoBottom()
   oBrw:Refresh()
   oBrw:Gotop()

RETURN NIL
// ESTA EM: INV1.PRG
STATIC FUNCTION xBrwColors( oBrw, lFoot )

   LOCAL cClrBack

   DEFAULT lFoot          := .F.

   oBrw:l2007             := .T.

   // oBrw:nRowHeight        := 24
   // oBrw:nHeaderHeight     := 24
   oBrw:lFooter           := lFoot
   
   // oBrw:lRecordSelector     := .F.
   // oBrw:lColDividerComplete := .F.
   // oBrw:lRowDividerComplete := .F.
   
   oBrw:lFlatStyle        := .F.
   oBrw:bClrHeader        := { || { CLR_BLACK, CLR_WHITE, CLR_WHITE } }
   oBrw:lFullGrid         := .F.

   // tira as linhas, nao gostei.
   // oBrw:nRowDividerStyle  := LINESTYLE_NOLINES
   // oBrw:nColDividerStyle  := LINESTYLE_NOLINES

   // oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW // Marca toda as celula, nao gostei.

   oBrw:bClrStd = { || If( oBrw:KeyNo() % 2 == 0, ;
                   { If( ( oBrw:cAlias )->( DELETED() ), CLR_HRED, CLR_BLUE ),;
                      RGB( 198, 255, 198 ) }, ;
                  { If( ( oBrw:cAlias )->( DELETED() ), CLR_HRED, CLR_BLUE ),;
                      RGB( 232, 255, 232 ) } ) }

   oBrw:bClrSel = { || { If( ( oBrw:cAlias )->( DELETED() ), CLR_HRED, CLR_WHITE ),;
                           RGB( 34, 177, 76 ) } }
   
   cClrBack = Eval( oBrw:bClrSelFocus )[ 2 ]

   oBrw:bClrSelFocus  := { || { If( ( oBrw:cAlias )->( DELETED() ), CLR_HRED, CLR_WHITE ),;
                              cClrBack } }

   oBrw:SetColor( CLR_CYAN, RGB( 232, 255, 232 ) )

RETURN NIL
// By Giovanny Vecchi - TESTRAD.PRG
FUNCTION CTRLS_COLORS( f_oDlgContainer )

   LOCAL lc_aCtrls := {}, lc_iFor := 0
   LOCAL lc_aItemsRadio := {}

   lc_aCtrls := f_oDlgContainer:aControls

   FOR lc_iFor := 1 TO Len( lc_aCtrls )

      IF ValType( lc_aCtrls[lc_iFor] ) == "O"

         IF lc_aCtrls[lc_iFor]:ClassName() == "TRADIO"

            aEval( lc_aCtrls[lc_iFor]:oRadMenu:aItems,                 ;
                   {|_oRadId|{ SetWindowTheme( _oRadId:hWnd, "", "" ), ;
                   _oRadId:SetColor( METRO_ORANGE, METRO_AMBER ) } } )
                   
         ELSEIF lc_aCtrls[lc_iFor]:ClassName() == "TCHECKBOX"

            SetWindowTheme( lc_aCtrls[lc_iFor]:hWnd, "", "" )

            // C:\FWH\INCLUDE\COLORS.CH
            lc_aCtrls[lc_iFor]:SetColor( METRO_RED, METRO_AMBER )

         ENDIF

      ENDIF

   NEXT

RETURN NIL

FUNCTION LIBERA_TUDO()

   IF File( "testxbr5.log" )
      DELETEFILE( "testxbr5.log" )
   ENDIF

   dbCommitAll()
   dbUnlockAll()
   dbCloseAll()
   FreeResources()
   RELEASE ALL
   SysRefresh()

   hb_gcAll( .T. )

   CLEAR MEMORY

   PostQuitMessage( 0 )

   QUIT

RETURN NIL

// FIM / END                 kapiabafwh@gmail.com
 


Tks, gracias.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Filter on Xbrowse

Postby karinha » Fri May 03, 2024 4:53 pm

Download completo:

https://mega.nz/file/lddkkLDZ#IV5u-OlmofxiPWf2ccQwxD3xwxqFgmtiwaNBW3Au9EM

Gracias, thanks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Filter on Xbrowse

Postby Otto » Sat May 04, 2024 7:45 am

For anyone interested in solutions with mod_harbour or WebView2:
There is a solution with mod_harbour for this issue.
Here is the link: Feel free to check it out!


viewtopic.php?f=45&t=44482
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: Filter on Xbrowse

Postby karinha » Sat May 04, 2024 10:52 am

Good Morning Master Otto, later I will learn MOD_HARBOUR, this name is very bad, it should have a more commercial name. Master Otto, how do I change the MARRIED FIELD .T., .F., for SI ó NO? Yes or No?

Buenos días Maestro Otto, más tarde aprenderé MOD_HARBOUR, este nombre es muy malo, debería tener un nombre más comercial. Maestro Otto, ¿cómo cambio el CAMPO CASADO .T., .F., por SI ó NO? ¿Yes o No?

Tks, gracias.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Filter on Xbrowse

Postby Otto » Sat May 04, 2024 1:16 pm

Dear João,

Do you mean in the Mod Harbour program?


Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: MaxP and 75 guests