Problem With searching customer Initial letter

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Problem With searching customer Initial letter

Post by Silvio.Falconi »

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: Select all

 
#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
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
dbmanfwh
Posts: 38
Joined: Tue Mar 04, 2008 3:44 pm
Location: Korea

Re: Problem With searching customer Initial letter

Post by dbmanfwh »

slivio,
Try to

Code: Select all

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
Post Reply