Search a value into xbrowse

Search a value into xbrowse

Postby Silvio.Falconi » Sun Mar 12, 2017 10:47 am

I wish search a value into a xbrowse but into a specific field

But when I open the dialog I not Lnow the fields og dbf
I have only a Dbf and I wish open a dialog with xbrowse and search a specific value into a field

sample :
"Frank" into cu-> First

if the field is a memo I wish search the value inside of this memo

and refresh the xbrowse must show the record found

How I must make it ?


I made this test , I use customer,dbf

Code: Select all  Expand view

#include "fivewin.ch"
#include "constant.ch"




function Main()

   local oDlg, oBrw, oBtn1, oBtn2, oRect
   Local oBar
   local aGet[2]
   local oSay[2]

    Local   nLen,aCampos,aTitulos,aTipos
    local  cField,n,cSearch


   Local nBottom   := 31
   Local nRight    := 130
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H

      // settaggio per le coordinate della dialog
     local nMINWidth := 947
     local nMINHeight := 614
     local nMAXWidth := GETSYSMETRICS( 0 ) //risoluzione orizzontale
     local nMAXHeight := GETSYSMETRICS( 1 ) //risoluzione verticale

   USE CUSTOMER

   DEFINE DIALOG oDlg            ;
   TITLE "Customers"             ;
   SIZE nWidth, nHeight   PIXEL  ;
    STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
              WS_MAXIMIZEBOX, WS_MINIMIZEBOX, WS_THICKFRAME )



   @ 40,10 XBROWSE oBrw SIZE -10,-40 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" AUTOCOLS NOBORDER

   oBrw:CreateFromCode()



    // search the fields of the dbf
   // to create the combobox

        nLen := Len( oBrw:aCols )
        aCampos :=  array( nLen )
        aTitulos:=  array( nLen )
        aTipos  :=  array( nLen )


      FOR n = 1 TO nLen
           aCampos   [ n ]:= oBrw:aCols[ n ]:cExpr
           aTitulos  [ n ]:= oBrw:aCols[ n ]:cHeader
           aTipos    [ n ]:= oBrw:aCols[ n ]:cDataType
       NEXT



   @ 12, 5 SAY oSay[1] Prompt "Cerca :" SIZE 40,15 PIXEL OF oDlg
   @ 10, 35 GET aGet[1] VAR cSearch  SIZE 200,15 PIXEL OF oDlg

   @ 12, (aGet[1]:nWidth+40) SAY oSay[2] Prompt "in " SIZE 10,15 PIXEL OF oDlg
   @ 10, (aGet[1]:nWidth+80)   COMBOBOX aGet[2] VAR cField     ITEMS aTitulos      OF oDlg   SIZE 120,60 PIXEL  STYLE CBS_DROPDOWN



   @ 10,450 BUTTON oBtn1 PROMPT "Search" SIZE 40,15 PIXEL OF oDlg

   @ 10,550 BUTTON oBtn2 PROMPT "&Clear" SIZE 40,15 PIXEL OF oDlg ACTION oDlg:End()



   DEFINE BUTTONBAR oBar  OF oDlg  BOTTOM SIZE 60, 30  2015 NOBORDER

   DEFINE BUTTON OF oBar PROMPT "Add"
   DEFINE BUTTON OF oBar PROMPT "Delete"
   DEFINE BUTTON OF oBar PROMPT "Print"
   DEFINE BUTTON OF oBar PROMPT "Quit"    



   // setta la dialog entro certe coordinate e non diventa più piccola
          oDlg:aMinMaxInfo = { GETSYSMETRICS( 0 ), GETSYSMETRICS( 1 ),;  // xMaxSize,      yMaxSize
                                                                0,  0,;  // xMaxPosition,  yMaxPosition
                                               nMINWidth,  nMINHeight,;  // xMinTrackSize, yMinTrackSize
                                               nMAXWidth, nMAXHeight }  // xMaxTrackSize, yMaxTrackSize

   oDlg:bResized := { || ;
      oRect          := oDlg:GetCliRect(), ;
      oSay[1]        := oRect:nRight - 100 ,;
      oSay[2]        := aGet[1]:nWidth+40 ,;
      aGet[1]:nLeft  := oRect:nLeft  +  70 ,;
      aGet[2]:nLeft  := aGet[1]:nWidth+100 ,;
      oBtn2:nLeft    := oRect:nRight - 180, ;
      oBtn1:nLeft    := oRect:nRight - 90  }

   ACTIVATE DIALOG oDlg CENTERED

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

Return to FiveWin for Harbour/xHarbour

Who is online

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