nageswaragunupudi wrote:As the name suggests, oBrw:cFilterFld is to be assigned with a Field Name, not cHeader of a column.
When the user selects a column in the combobox, you need to find of the name of the field used for that column and assign that name to oBrw:cFilterFld.
Rao,
U're right
but
on sample test (xbincflt.prg) I assign the field name on oBrw:cFilterFld with oBrw:cFilterFld:=aFlds[::nat], what is wrong ?
Code: Select all
@ 10, 10 COMBOBOX oBrw:cFilterFld ;
ITEMS aHdrs ;
ON CHANGE ( CUST->(OrdSetFocus(::nat)),;
oBrw:refresh(),;
oBrw:cFilterFld:=aFlds[::nat],;
Msginfo(oBrw:cFilterFld, aFlds[::nat]),;
oBrw:Seek( "" ),;
oBrw:SetFocus() ) ;
SIZE 50,400 PIXEL OF oDlg
on your sample test modified, adding the combobox, I made the same
Code: Select all
#include "fivewin.ch"
REQUEST DBFCDX
//----------------------------------------------------------------------------//
function Main()
local oDlg, oGet, oBrw
local cSeek := Space( 100 )
local oCbx
local aColumns :={"ID","FIRST","LAST"}
LOCAL nField:= 2
SetGetColorFocus()
FERASE( "CUSTOMER.CDX" )
USE CUSTOMER NEW EXCLUSIVE VIA "DBFCDX"
FW_CdxCreate()
SET ORDER TO TAG FIRST
GO TOP
DEFINE DIALOG oDlg SIZE 500,500 PIXEL TRUEPIXEL
@ 20,20 GET oGet VAR cSeek SIZE 160,20 PIXEL OF oDlg
@ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE "CUSTOMER" ;
COLUMNS 1,2,3 ;
HEADERS "Codice","Nome","Cognome" ;
AUTOCOLS AUTOSORT CELL LINES NOBORDER
WITH OBJECT oBrw
:lIncrFilter := .t.
:cFilterFld := aColumns[nField]
:oSeek := oGet // Required before :CreateFromCode()
:CreateFromCode()
END
@ 20, 195 COMBOBOX oCbx Var oBrw:cFilterFld ;
ITEMS {"Codice","Nome","Cognome"} ;
SIZE 150,400 PIXEL OF oDlg HEIGHTGET 22
oCbx:bchange := <|Self|
nField:= ::nat
oBrw:cFilterFld := aColumns[nField]
Msginfo(oBrw:cFilterFld, aColumns[nField]) //CHECK
cSeek := Space( 100 )
oGet:refresh()
oBrw:Seek( "" )
oBrw:SetFocus()
oBrw:refresh()
oGet:setfocus()
return nil
>
ACTIVATE DIALOG oDlg CENTERED
return nil
Msginfo(oBrw:cFilterFld, aColumns[nField])
So, the oBrw:cFilterFld is changed but the xbrowse search allways the name of the Header