ToAntonio and all : simply Tab and Xbrowse

ToAntonio and all : simply Tab and Xbrowse

Postby Silvio » Fri Apr 24, 2009 9:25 pm

I have a table dbf with I saved some information
it have some field as CveTab , Concep, desc, bitmap
On Field cveTab I insert only a Caracter and I set an array aKey:={"A","T","G","S"}

sample : all records have field CveTab="T" are types of customers
I want select a tab to select each group of records

I made a simply test but it not run ok
With the func ValPaint() I ordscope all record to --> aKey

Code: Select all  Expand view

#include "FiveWin.ch"

Stat oGrid,oTab,oDbf,aKey[4]

Function Test()
Local oDlg
Local nSplit:=00
Local aKey:={"A","T","G","S"}
use tabelle alias oDbf
Define dialog oDlg from 0,20 to 28,80

   oGrid := TXBrowse():New( oDlg )
   oGrid:nTop    := 00
   oGrid:nLeft   := nSplit+2
   oGrid:nBottom :=  200
   oGrid:nRight  :=  220

   oCol:= oGrid:AddCol()
   oCol:bStrData := { ||  oDbf->Concep}  // 6
   oCol:cHeader  := "Codice"
   oCol:nWidth   := 100

   oCol:= oGrid:AddCol()
   oCol:bStrData := { ||  oDbf->Descri}    // 50
   oCol:cHeader  := "Descrizione"
   oCol:nWidth   := 100

   oCol:= oGrid:AddCol()
   oCol:bStrData := { ||  oDbf->Bitmap}  //  60
   oCol:cHeader  := "Descrizione"
   oCol:nWidth   := 160

 oGrid:SetRDD()
 oGrid:CreateFromCode()


 @ oGrid:nBottom, nSplit+2 TABS oTab   ;
     OPTION nOrder SIZE oDlg:nWidth()-80, 12 PIXEL OF oDlg  ;
     ACTION ( nOrder := oTab:nOption  ,;
              oDbf->(DbSetOrder(nOrder)),;
              oDbf->(DbGoTop())         ,;
              oGrid:Refresh(.t.) )

                 oTab:aPrompts ={ "Banche","Tipo fornitore","Gradi","Squadra"}


activate dialog oDlg ON PAINT Val_Pant()


STAT FUNC Val_Pant()
   LOCAL nF:=oTab:nOption
   CursorWait()
   odbf->(OrdScope(0,aKey[nF]))
   oDbf->(OrdScope(1,aKey[nF]))
   SysRefresh()
    oGrid:GoTop()
    oGrid:Refresh()
    oGrid:SetFocus()
   oTab:SetOption(nF)
   CursorArrow()
RETURN (NIL)


here the test file sample : www.vdswin.it/tabelle.rar
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: ToAntonio and all : simply Tab and Xbrowse

Postby nageswaragunupudi » Sat Apr 25, 2009 9:28 am

Mr Silvio
Please try this code and adopt to your needs
Code: Select all  Expand view
#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'

REQUEST DBFCDX

//------------------------------------------------------------------//
function Main()

   local oWnd, oGrid, oTabs
   local aKey:={ "A", "T", "G", "S"}

   set deleted on
   set exclusive off

   use tabelle new alias tb via 'DBFCDX'
   set order to tag concep
   go top

   define window oWnd


   @ 0,0 xbrowse oGrid ;
      columns 'CveTab', 'Concep', 'Descri', 'Bitmap' ;
      colsizes 20, 100, 100, 160 ;
      alias 'tb' ;
      of oWnd

   @ 0,0 tabs oTabs of oWnd pixel ;
      prompts "Banche","Tipo fornitore","Gradi","Squadra" ;
      action TabAction( nOption, oGrid, aKey )

   oWnd:oBottom   := oTabs

   TabAction( 1, oGrid, aKey )

   oGrid:CreateFromCode()
   oWnd:oClient   := oGrid

   activate window oWnd


return ( 0 )

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

static function TabAction( nOption, oGrid, aKey )

   FIELD CVETAB

   local cFilter

   cFilter     := "CVETAB = '" + aKey[ nOption ] + "'"

   ( oGrid:cAlias )->( DbSetFilter( &( '{ || ' + cFilter + ' }' ), cFilter ) )
   ( oGrid:cAlias )->( DbGoTop() )
   if oGrid:lCreated
      oGrid:Refresh()
   endif

return nil

//------------------------------------------------------------------//
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: ToAntonio and all : simply Tab and Xbrowse

Postby Silvio » Sat Apr 25, 2009 1:20 pm

thanks Nages I wrote on your private email
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: ToAntonio and all : simply Tab and Xbrowse

Postby Silvio » Sat Apr 25, 2009 1:59 pm

Nages your sample run ok and I insert it on my application but I have another problem

On table dbf I have many field

concep
Descri
TipMov
DesCor
CtaCon
Sueldo
Viatic
Importe
cantidad
Bitmap

and for the akey "A" I must use only the fields concep Descri

whil e for the akey "G" or akey "S" I must use only concep Descri bitmap

How I must to show only these fields in you sample ?

thanks
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: ToAntonio and all : simply Tab and Xbrowse

Postby nageswaragunupudi » Sat Apr 25, 2009 2:41 pm

Modified TabAction function
Code: Select all  Expand view
static function TabAction( nOption, oGrid, aKey )

   FIELD CVETAB

   local cFilter, cKey

   cKey        := aKey[ nOption ]
   cFilter     := "CVETAB = '" + cKey + "'"

   ( oGrid:cAlias )->( DbSetFilter( &( '{ || ' + cFilter + ' }' ), cFilter ) )
   ( oGrid:cAlias )->( DbGoTop() )

   do case
   case cKey == 'A'
      oGrid:bitmap:lHide   := .t.
   case cKey $ 'GS'
      oGrid:bitmap:lHide   := .f.
   otherwise
      oGrid:bitmap:lHide   := .f.
   endcase


   if oGrid:lCreated
      oGrid:Refresh()
   endif

return nil
 

You may make modifications to suit your requirements
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: ToAntonio and all : simply Tab and Xbrowse

Postby Silvio » Sat Apr 25, 2009 6:36 pm

Nages,
-----------------------------------------------------------------------------
do case
case cKey == 'A'
oGrid:bitmap:lHide := .t.
case cKey $ 'GS'
oGrid:bitmap:lHide := .f.
otherwise
oGrid:bitmap:lHide := .f.
endcase
----------------------------------------------------------------------------------
I wanted show any field and not the oGrid:bitmap

do case
case cKey == 'A'
oCol:= oApp():oGrid:AddCol()
oCol:bStrData := { || (oDTab)->Concep} // 6
oCol:cHeader := "Codice"
oCol:nWidth := 80


oCol:= oApp():oGrid:AddCol()
oCol:bStrData := { || (oDTab)->Descri} // 50
oCol:cHeader := "Descrizione"
oCol:nWidth := 200

case cKey $ 'GS'

oCol:= oApp():oGrid:AddCol()
oCol:bStrData := { || (oDTab)->Concep} // 6
oCol:cHeader := "Codice"
oCol:nWidth := 80


oCol:= oApp():oGrid:AddCol()
oCol:bStrData := { || (oDTab)->Descri} // 50
oCol:cHeader := "Descrizione"
oCol:nWidth := 200

oCol:= oApp():oGrid:AddCol()
oCol:bStrData := { || (oDTab)->Bitmap} // 60
oCol:cHeader := "loghetto"
oCol:nWidth := 80

endcase

I hope U understand


But I try and when I click on tab it add new columns to xbrowse
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: ToAntonio and all : simply Tab and Xbrowse

Postby Silvio » Sat Apr 25, 2009 7:28 pm

Found the solution !

do case
case cKey == 'A'
oApp:oGrid:aCols[3]:lHide := .t.
case cKey == 'T'
oApp:oGrid:aCols[3]:lHide := .t.
case cKey == 'G'
oApp:oGrid:aCols[3]:lHide := .f.
case cKey == 'S'
oApp:oGrid:aCols[3]:lHide := .f.
endcase
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy


Return to FiveWin for Harbour/xHarbour

Who is online

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