Code: Select all
oBrw:EditSource(.T., "klant_nr,Naam_1,Straat,Postcode,Gemeente" )
I don't see a array of predefined values in the xbrowse source code, but I can be wrong.
Maybe I need to use the : oBrw:bEdit := { |oRec| Editfunction( oRec ) }
Code: Select all
oBrw:EditSource(.T., "klant_nr,Naam_1,Straat,Postcode,Gemeente" )
Code: Select all
oBrw:bDataRow := <|oBrw,cFieldList,lNew|
local oRec := TDataRow():New( oBrw:uDataSource, cFieldList, lNew )
if oRec:RecNo == 0 // new record
oRec:SetDefault( fieldname, yourvalue )
endif
return oRec
>
Code: Select all
oBrw:EditSource(.T., "klant_nr,Naam_1,Straat,Postcode,Gemeente" , { nil, "somename", nil, nil, cGemeente })
Very Nice.. Waiting to update ))nageswaragunupudi wrote:From FWH 1904 we can writeThe non empty values in the array in the 3rd paramter will be initially assigned to the fileds in that order.Code: Select all
oBrw:EditSource(.T., "klant_nr,Naam_1,Straat,Postcode,Gemeente" , { nil, "somename", nil, nil, cGemeente })
It works for getting the data into the editdialog, but the data that are displayed in the edit dialog will not be saved ? Data that I change saves, but not the predifined data.nageswaragunupudi wrote:Can you please try this?Code: Select all
oBrw:bDataRow := <|oBrw,cFieldList,lNew| local oRec := TDataRow():New( oBrw:uDataSource, cFieldList, lNew ) if oRec:RecNo == 0 // new record oRec:SetDefault( fieldname, yourvalue ) endif return oRec >
Code: Select all
function klantbrowse(oDlg,oDbfklant)
local oDlg1, obrw , nWild:=2 , oSay, oGet, cUpper
public a_Veldnaam:={}
dbselectarea("klant")
klant->(dbsetorder("klantnaam"))
klant->(dbgotop())
DEFINE FONT oBold NAME 'CALIBRI' SIZE 0,-12 BOLD
DEFINE FONT oFont NAME "CALIBRI" SIZE 0,-14
DEFINE FONT oFontBig NAME "CALIBRI" SIZE 0,-24
DEFINE DIALOG oDlg1 SIZE 1000,730 PIXEL TRUEPIXEL ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU,WS_MAXIMIZEBOX, WS_MINIMIZEBOX, WS_THICKFRAME );
TITLE "Klantenlijst : ";
GRADIENT { { 1, nRGB( 125, 155, 175 ), nRGB( 125, 155, 175 ) } }
aVelden := { ;
{ "klant_nr" , "Code" ,nil, 65 }, ;
{ "Naam_1" , "Naam" ,nil, 250 }, ;
{ "straat" , "Straat" ,nil, 250 }, ;
{ "gemeente" , "Gemeente",nil, 150 }, ;
{ "selectie" , "Sel" ,nil, 40 }}
@ 0,0 XBROWSE oBrw size -1,-50 PIXEL OF oDlg1 font oFont ;
DATASOURCE "klant" ;
COLUMNS aVelden ;
AUTOSORT CELL LINES NOBORDER FOOTERS
oBrw:SetChecks()
oBrw:lHScroll := .F.
oBrw:nHeadStrAligns := AL_CENTER
oBrw:naam:bLClickHeader := {|| oBrw:Seek( "" ), oBrw:cFilterFld := "Naam_1" }
oBrw:straat:bLClickHeader := {|| oBrw:Seek( "" ), oBrw:cFilterFld := "Straat" }
oBrw:bDataRow := <|oBrw,cFieldList,lNew|
local oRec := TDataRow():New( oBrw:uDataSource, cFieldList, lNew )
if oRec:RecNo == 0 // new record
// Working
oRec:SetDefault( "klant_nr", "120" )
oRec:SetDefault( "naam_1", "Naam Test" )
oRec:SetDefault( "straat", oBrw:cSeek )
// not working yet because I can't find the current Col Number
//xbrowser(oBrw)
//msginfo(oBrw:oCol:nColadvance)
//msginfo(oBrw:oCol():nCreationorder)
// Here I want based on the current colomn to put the Seek data in that field
/*
if oBrw:oCol() = 2
oRec:SetDefault( "naam_1", oBrw:cSeek )
elseif oBrw:oCol() = 3
oRec:SetDefault( "straat", oBrw:cSeek )
endif
*/
endif
return oRec
>
WITH OBJECT oBrw
:lIncrFilter := .t.
:lSeekWild := ( nWild == 2 ) // 1 left/right : 2 wild
:lHScroll := .f.
:cFilterFld := "straat"
:bFooters := { |oCol| If( Empty( oCol:cOrder ), "", oBrw:cSeek("") ) }
:nStretchCol := 2
:bClrEdits := { || { CLR_BLACK, CLR_YELLOW }}
:bLDblClick := { || oBrw:EditSource(.F., "klant_nr,Naam_1,Straat,Postcode,Gemeente" ) }
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
:bClrSelFocus = {|| { CLR_WHITE, RGB(0, 128, 128) } } // CUANDO TIENE EL FOCUS
:oHeaderFonts := oBold
:bKeyDown := { |k| If( k == VK_RETURN,( oDlg1:end() ),nil ) }
END
oBrw:CreateFromCode()
@ 690,500 BTNBMP PROMPT "<- Blanco" ;
SIZE 100,25 PIXEL OF oDlg1;
ACTION ( addnewprospect(oDlg1,oBrw ) )
ACTIVATE DIALOG odlg1 centered
oFont:end()
return NIL
function addnewprospect(oDlg1,oBrw)
DEFINE CLIPBOARD oClp
cCode := oBrw:cSeek
oClp:SetText( cCode )
oBrw:EditSource(.T., "klant_nr,Naam_1,Straat,Postcode,Gemeente" )
return NIL
// Here I want based on the current colomn to put the Seek data in that field
/*
if oBrw:oCol() = 2
oRec:SetDefault( "naam_1", oBrw:cSeek )
elseif oBrw:oCol() = 3
oRec:SetDefault( "straat", oBrw:cSeek )
Code: Select all
oRec:SetDefault( oBrw:SelectedCol():cExpr, oBrw:cSeek )
You need to pad the strings to the correct length while assigning.It also seems that the lenght of the data input is not as long as the fields are.
Code: Select all
oRec:FieldPut( fldname, value )
Code: Select all
oRec:SetDefault( fldname, value )