Problem With searching customer Initial letter

Problem With searching customer Initial letter

Postby Silvio.Falconi » 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: Select all  Expand view

#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 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

Re: Problem With searching customer Initial letter

Postby dbmanfwh » Thu Dec 08, 2016 3:18 pm

slivio,
Try to
Code: Select all  Expand view

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
dbmanfwh
 
Posts: 38
Joined: Tue Mar 04, 2008 3:44 pm
Location: Korea


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Natter and 68 guests