I start to rewrite my old FWH programs from DBFs to MySql database with tDolphin and I am finish with scaning changes, to have do in source. I am very satisfied with this combination but I have one more thing to solve. I try do define fields on xBrowse/tDolphin query with array with field name, format and header, but without success. Example with xBrowse line below
- Code: Select all Expand view
- @ 0,0 XBROWSE oBrw OF oWnd FIELDS oData:first, oData:last, oData:city HEADERS "Head 1","Head 2","Head 3" FASTEDIT LINES CELL
working good, but when i try same thing with array of fields I get "{...}" in cell of xBrowse.
- Code: Select all Expand view
- aadd( aFields, "oData:first" ); aadd( aHead, "Head 1" ); aadd( aFormat, "" )
aadd( aFields, "oData:last" ); aadd( aHead, "Head 2" ); aadd( aFormat, "" )
aadd( aFields, "oData:city" ); aadd( aHead, "Head 3" ); aadd( aFormat, "" )
@ 0,0 XBROWSE oBrw OF oWnd FIELDS aFields HEADERS aHead LINES CELL FASTEDIT
Here is simple example:
- Code: Select all Expand view
- #include "Fivewin.ch"
#include "tdolphin.ch"
#include "xbrowse.ch"
///////////////////
Function Main()
local oServer
local cServer, cUser, cPassword, nPort, cDBName,nFlags
local oErr,oQry,nFld,oFont,oData
local oWnd, oBrw
local aFields:={}, aFormat:={}, aHead:={}, aAlias
SET DATE german
SET DELETED ON
SET EXCLUSIVE OFF
SET SOFTSEEK ON
SET WRAP ON
SET _3DLOOK ON
SET EPOCH TO YEAR(date()) - 50
SetHandleCount( 100 )
/* conexion al mysql servidor con tdolphin.lib */
cServer := "dolphintest.sitasoft.net"
cUser := "test_dolphin"
cPassword := "123456"
nPort := "3306"
cDBName := "dolphin_man"
nFlags := "0"
TRY
CONNECT oServer HOST cServer ;
USER cUser ;
PASSWORD cPassword ;
PORT nPort ;
FLAGS nFlags;
DATABASE cDBName
msgwait( "Connected ...",,1 )
CATCH oErr
MsgStop( "Konekcija na bazu nije ostvarena." )
RETURN NIL
END
*
*
*
oServer:Execute( "SET NAMES 'cp1250'" )
oQry = TDolphinQry():New( "SELECT * FROM customer where 1", oServer )
oData:=oQry
*
*
*
DEFINE WINDOW oWnd TITLE "Auto edit browse"
@ 0,0 XBROWSE oBrw OF oWnd FIELDS oData:first, oData:last, oData:city HEADERS "Head 1","Head 2","Head 3" FASTEDIT LINES CELL
/*
//-----------------------------------------------------------------------------------------
*
* xBrowse fields definition from array?
*
aadd( aFields, "oData:first" ); aadd( aHead, "Head 1" ); aadd( aFormat, "" )
aadd( aFields, "oData:last" ); aadd( aHead, "Head 2" ); aadd( aFormat, "" )
aadd( aFields, "oData:city" ); aadd( aHead, "Head 3" ); aadd( aFormat, "" )
@ 0,0 XBROWSE oBrw OF oWnd FIELDS aFields HEADERS aHead LINES CELL FASTEDIT
//-----------------------------------------------------------------------------------------
*/
oBrw:SetDolphin( oQry,.f. )
oBrw:CreateFromCode()
oWnd:oClient = oBrw
ACTIVATE WINDOW oWnd ON INIT oBrw:SetFocus()
oQry:End()
return nil
I welcome any idea.
Best regards,