FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem With searching customer Initial letter
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Problem With searching customer Initial letter
Posted: Wed Dec 07, 2016 10:39 PM
I wish the final user when click on tab th eproedure must show only the customer have the first letter as the oTab prompt
the test run but sometimes not run ok

Perhaps there is a another method ?

the code

Code (fw): Select all Collapse
 
#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"

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

REQUEST DBFCDX

static cFwhPath   := "c:\\work\\fwh\\"

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

function Main()
lOCAL oDlg,oTab,oFont
Local nOrder:= 1
local cPath    := cFwhPath + "samples\\"


   USE ( cPath + "CUSTOMER" ) NEW ALIAS CU SHARED
   INDEX ON FIRST TAG FIRST TO CTMP MEMORY

DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
 DEFINE DIALOG oDlg SIZE 620,700 PIXEL FONT oFont ;
      TITLE "Test telephon list"


  @ 10,20 XBROWSE oBrw OF oDlg SIZE -10,-70 PIXEL ;
      COLUMNS "First", "State", "Age", "HireDate", "Salary" ;
      ALIAS 'CUST' NOBORDER

   oBrw:lRecordSelector := .f.
   oBrw:nMarqueeStyle   := MARQSTYLE_HIGHLWIN7

   oBrw:CreateFromCode()


   @ 280, 3 TABS oTab ;
      OPTION nOrder SIZE oBrw:nWidth()-80, 12 PIXEL OF oDlg ;
      ITEMS "All","A","B","C","D","E","F","G","H","I","L","M","N","O","P","Q","R","S","T","U","V","Z";
      ACTION CuFiltrar(oBrw,oTab,oTab:nOption,nOrder)




 ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil




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

init procedure PrgInit

   SET DATE ITALIAN
   SET CENTURY ON
   SET TIME FORMAT TO "HH:MM:SS"
   SET EPOCH TO YEAR(DATE())-50

   SET DELETED ON
   SET EXCLUSIVE OFF

   RDDSETDEFAULT( "DBFCDX" )

   XbrNumFormat( 'E', .t. )
   SetKinetic( .f. )
   SetGetColorFocus()
   SetBalloon( .t. )

return
//-----------------------------------------------------------------------------------//
Function CuFiltrar(oGrid,oTab,n,nOrder)
     msginfo(n)
if n=1
CU->(DbClearFilter())
CU->(DbGoTop())
oGrid:Refresh(.t.)
return nil
endif

do case
case nOrder= 1
set filter to left(CU->FIRST,1)=oTab:aPrompts[n]
case nOrder= 2
set filter to left(CU->FIRST,1)=oTab:aPrompts[n]
endcase
CU->(DbGoTop())
oGrid:Refresh(.t.)
return ni
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 38
Joined: Tue Mar 04, 2008 03:44 PM
Re: Problem With searching customer Initial letter
Posted: Thu Dec 08, 2016 03:18 PM
slivio,
Try to
Code (fw): Select all Collapse
Function CuFiltrar(oGrid,oTab,n ) // ,nOrder)

if n=1
   CU->(DbClearFilter())
else
   set filter to left(CU->FIRST,1)=oTab:aPrompts[n]
endif

CU->(DbGoTop())
oGrid:Refresh(.t.)

return nil
Regards,

Moon

FWH 16.11 | xHarbour | Harbour | BCC72 | DBF | ADS | MySQL | DrLib

Continue the discussion