lIncrFilter + MDI

lIncrFilter + MDI

Postby cpheraclio » Fri Jun 02, 2023 11:31 pm

Funciona perfecto
\samples\xbincflt.prg

MDI
oBrw:SetFocus() // con click NO RETORNA a oBrw

@ 10, 10 COMBOBOX oBrw:cFilterFld ;
ITEMS aHdrs ;
ON CHANGE ( oBrw:Seek( "" ), oBrw:SetFocus() ) ;
SIZE 50,400 PIXEL OF oDlg

oDlg:oClient := oBrw
oDlg:bPostEnd := {||oRs:Close(),oRs:=Nil}
ACTIVATE DIALOG oDlg CENTER AS MDICHILD

Fivewin 22.03, BCC 7.4
cpheraclio
 
Posts: 11
Joined: Thu Mar 17, 2022 6:47 pm

Re: lIncrFilter + MDI

Postby karinha » Sun Jun 04, 2023 5:30 pm

No comprendo. ¿Tienes un ejemplo completo para probar?

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

Re: lIncrFilter + MDI

Postby cpheraclio » Sun Jun 04, 2023 11:22 pm

karinha wrote:No comprendo. ¿Tienes un ejemplo completo para probar?

Saludos.


Gracias por responder.

#include 'fivewin.ch'

REQUEST DBFCDX

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

function Main()

local oWnd, oBar

SET DATE ITALIAN
SET CENTURY ON
RDDSETDEFAULT( "DBFCDX" )

DEFINE WINDOW oWnd MDI
DEFINE BUTTONBAR oBar OF oWnd SIZE 45,45 2007
DEFINE BUTTON OF oBar PROMPT "TEST" CENTER ACTION Test()

oWnd:oWndClient:bPainted := {||oWnd:oWndClient:DrawImage( "c:\fwh\bitmaps\logo.bmp", "BR" )}

ACTIVATE WINDOW oWnd

return nil


Function Test()

local oDlg, oBrw, oFont, nWild := 2
local cList, aFlds, aHdrs
local nChoice, uDataSource
local cAlias,oWndChild

cList := "First,Last,Street,State,HireDate"

cAlias = cGetNewAlias( cFileNoExt("CUSTOMER.DBF" ) )

USE CUSTOMER SHARED NEW ALIAS (cAlias)
SET ORDER TO TAG FIRST
GO TOP


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

DEFINE DIALOG oDlg SIZE 750,300 PIXEL FONT oFont ;
TITLE "XBrowse Incremental Filters"

aFlds := aHdrs := HB_ATokens( cList, ',' )

@ 30,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
COLUMNS aFlds HEADERS aHdrs ;
DATASOURCE (cAlias) AUTOSORT CELL LINES NOBORDER

WITH OBJECT oBrw
:lIncrFilter := .t.
:lSeekWild := ( nWild == 2 )
:cFilterFld := "FIRST"
:nStretchCol := STRETCHCOL_WIDEST
END

@ 10, 10 COMBOBOX oBrw:cFilterFld ;
ITEMS aHdrs ;
ON CHANGE ( oBrw:Seek( "" ), oBrw:SetFocus() ) ; // DEBE RETORNAR A oBrw
SIZE 50,400 PIXEL OF oDlg

@ 10, 70 COMBOBOX nWild ITEMS { "Starting With", "Containing" } ;
ON CHANGE ( oBrw:lSeekWild := ( nWild == 2 ), ;
oBrw:Seek( If( oBrw:lSeekWild, oBrw:cSeek, "" ) ), ;
oBrw:SetFocus() ) ;
SIZE 70,400 PIXEL OF oDlg

@ 11,160 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 200,10 PIXEL ;
OF oDlg COLOR CLR_BLACK,CLR_YELLOW PICTURE '@!'

oBrw:CreateFromCode()

oDlg:oClient := oBrw

oDlg:bPostEnd := { || DbCloseArea() }

ACTIVATE DIALOG oDlg AS MDICHILD SETUP oWndChild := oWnd // SIN ESTA INSTRUCCIÓN LO HACE CORRECTAMENTE

return nil

Saludos.
cpheraclio
 
Posts: 11
Joined: Thu Mar 17, 2022 6:47 pm

Re: lIncrFilter + MDI

Postby karinha » Mon Jun 05, 2023 2:22 pm

Mira se está bueno:

https://imgur.com/Ckm1lOE

Image

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

Re: lIncrFilter + MDI

Postby karinha » Mon Jun 05, 2023 2:48 pm

Code: Select all  Expand view  RUN

// C:\FWH..\SAMPLES\RACLIO.PRG - 05/06/2023 - kapiabafwg@gmail.com

#include 'fivewin.ch'
#Include "xBrowse.ch"

ANNOUNCE RDDSYS // IDEM: ANNOUNCE FPTCDX
REQUEST DBFCDX, DBFFPT

STATIC oFont1, oFont2, oFont3  // en INV1.PRG

FUNCTION Main()

   LOCAL oWnd, oBar, oBrush, oFont

   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

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

   SetBalloon( .T. )
   SkinButtons()

   DEFINE BRUSH oBrush FILE "..\bitmaps\sea.bmp" RESIZE

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

   DEFINE WINDOW oWnd MDI TITLE "XBrowse Incremental Filters" ;
      BRUSH oBrush

   DEFINE BUTTONBAR oBar OF oWnd SIZE 45, 45 2007

   oBar:nClrText := CLR_HBLUE
   oBar:Adjust()

   DEFINE BUTTON OF oBar PROMPT "&Test" FILENAME "..\bitmaps\16x16\new.bmp" ;
      FLAT ACTION( Test() ) TOOLTIP "Test xBrowse() lIncrFilter" GROUP      ;
      FONT oFont

   DEFINE BUTTON OF oBar PROMPT "Exit" FILENAME "..\bitmaps\16x16\Exit.bmp" ;
      FLAT ACTION( oWnd:End() ) TOOLTIP "Exit this app" GROUP FONT oFont

   // oWnd:oWndClient:bPainted := {|| oWnd:oWndClient:DrawImage( "..\bitmaps\logo.bmp", "BR" ) }

   SET MESSAGE OF oWnd TO "kapiabafwh@gmail.com - www.fivewin.com.br"        ;
      FONT oFont NOINSET CLOCK DATE KEYBOARD COLOR CLR_HBLUE, CLR_WHITE 2007

   ACTIVATE WINDOW oWnd CENTERED ON INIT( oWnd:oMenu:End() )

   oBrush:End()
   oFont:End()

RETURN NIL

FUNCTION Test()

   LOCAL oDlg, oBrw, oFont, nWild := 2
   LOCAL cList, aFlds, aHdrs
   LOCAL nChoice, uDataSource
   LOCAL cAlias, oWndChild

   // Si Cambiar aquí, debe cambiar el índice en tiempo real.
   cList := "First,Last,Street,State,HireDate"

   cAlias = cGetNewAlias( cFileNoExt( "CUSTOMER.DBF" ) )

   USE CUSTOMER SHARED NEW ALIAS ( cAlias )
   SET ORDER TO TAG FIRST // Si Cambiar aquí, debe cambiar el índice
   GO TOP

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

   DEFINE DIALOG oDlg SIZE 750, 300 PIXEL FONT oFont ;
      TITLE "XBrowse Incremental Filters" COLORS CLR_BLACK, CLR_WHITE

   aFlds := aHdrs := hb_ATokens( cList, ',' )

   @ 30, 10 XBROWSE oBrw SIZE - 10, - 10 PIXEL OF oDlg ;
      COLUMNS aFlds HEADERS aHdrs ;
      DATASOURCE ( cAlias ) AUTOSORT CELL LINES NOBORDER

   BrwColors( oBrw, .F. )

   WITH OBJECT oBrw

      oBrw:aCols[ 1 ]:nWidth := 60
      oBrw:lFlatStyle  := .T.

      oBrw:lIncrFilter := .T. // Liga o Filtro incremental
      oBrw:lSeekWild   := .T. // Liga a busca incremental
      // :lSeekWild := ( nWild == 2 )  // ??? no me gusta asi. mi gosto personal.

      /* // Original
      :lIncrFilter := .T.
      :lSeekWild := ( nWild == 2 )
      */


      :cFilterFld := "FIRST"
      :nStretchCol := STRETCHCOL_WIDEST

      oBrw:bKeyDown    := { |nKey| If( nKey == VK_RETURN, ( oDlg:End() ), nil ) }
      oBrw:bKeyChar    := { |nKey| If( nKey == VK_ESCAPE, ( oBrw:Seek( "" ), oDlg:End() ), nil ) }

      oBrw:AutoFit() // Auto ajuste / ajuste automatico do xBrowse()

   END

   @ 01, 160 SAY "Digite o Que Deseja Procurar: " SIZE 120, 10 PIXEL OF oDlg ;
      COLOR CLR_CYAN, CLR_WHITE TRANSPARENT UPDATE

   @ 10, 10 COMBOBOX oBrw:cFilterFld ITEMS aHdrs     ;
      ON CHANGE ( oBrw:Seek( "" ), oBrw:SetFocus() ) ; // DEBE RETORNAR A oBrw
      SIZE 50, 400 PIXEL OF oDlg

   @ 10, 70 COMBOBOX nWild ITEMS { "Starting With", "Containing" } ;
      ON CHANGE ( oBrw:lSeekWild := ( nWild == 2 ),                ;
      oBrw:Seek( If( oBrw:lSeekWild, oBrw:cSeek, "" ) ),           ;
      oBrw:SetFocus() )                                            ;
      SIZE 70, 400 PIXEL OF oDlg

   @ 11, 160 SAY oBrw:oSeek PROMPT oBrw:cSeek PICTURE "@!" SIZE 200, 10 PIXEL ;
      OF oDlg COLOR CLR_BLACK, CLR_YELLOW FONT oFont UPDATE // BORDER

   /*
   @ 10, 150 SAY oBrw:oSeek PROMPT oBrw:cSeek PICTURE "@!" SIZE 120, 10      ;
      PIXEL OF oDlg COLOR CLR_CYAN, CLR_WHITE FONT oFont UPDATE BORDER
   */


   oBrw:CreateFromCode()

   oDlg:oClient := oBrw

   // oDlg:bPostEnd := {|| dbCloseArea() } ??? Porque?

   ACTIVATE DIALOG oDlg AS MDICHILD SETUP oWndChild := oWnd CENTERED ;
      ON INIT ( oBrw:cSeek( "" ), oBrw:SetFocus(), .F. )

   oFont:End()
   oFont1:End()

RETURN NIL

STATIC FUNCTION BrwColors( 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        := .T.
   oBrw:bClrHeader        := { || { CLR_BLACK, CLR_WHITE, CLR_WHITE } } //RGB( 232, 255, 232 ), RGB( 232, 255, 232 ) }}
   oBrw:lFullGrid         := .F.

   oBrw:nRowDividerStyle  := LINESTYLE_NOLINES //DARKGRAY  //LINESTYLE_LIGHTGRAY      //
   oBrw:nColDividerStyle  := LINESTYLE_NOLINES //LIGHTGRAY // LINESTYLE_NOLINES

   oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW

   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 ) } } //RGB( 0x33, 0x66, 0xCC ) } }
   
   cClrBack = Eval( oBrw:bClrSelFocus )[ 2 ]

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

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

   oBrw:SetFont( oFont1 )

RETURN NIL

// FIN / END
 


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


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 94 guests