Queridos todos,
Emigro de DBF a MySQL y el uso TWBrowse (Hernan)? Que han modificado TWBrowse (Hernan) que es compatible con los delfines.
Gracias por cualquier ayuda y sugerencia.
Dutch
Willi Quintana wrote:Hola Dutch,
Muéstrame el código fuente
Salu2
#include "FiveWin.Ch"
#include "tdolphin.ch"
#include "xbrowse.ch"
static cpw := "nimda"
//----------------------------------------------------------------------------//
function Main()
local oDlg, oBrw, oLbx, oFont, oBtn
local oQry
FW_SetUnicode( .T. )
db()
oQry := TDolphinQry():New( "SELECT * FROM namesutf8", db() )
DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-16
DEFINE DIALOG oDlg SIZE 600,750 PIXEL TITLE VERSION()+'/'+FWVERSION + " : TDolphin" ;
FONT oFont
@ 15,10 XBROWSE oBrw SIZE 280,150 PIXEL OF oDlg ;
DATASOURCE oQry ;
COLUMNS "code", "name" ;
CELL LINES NOBORDER AUTOSORT FASTEDIT
WITH OBJECT oBrw
:nEditTypes := EDIT_GET
:CreateFromCode()
END
@ 2,140 SAY 'XBrowse' OF oDlg SIZE 80,12 PIXEL COLOR CLR_BLUE
@ 185,140 SAY 'TWBrowse' OF oDlg SIZE 80,12 PIXEL COLOR CLR_RED
oQry:GoTop()
@ 200, 10 LISTBOX oLbx FIELDS oQry:code, oQry:name ; //
HEADERS 'Code', 'Name' ;
FIELDSIZES 50, 200 ;
SIZE 280, 150 PIXEL ;
OF oDlg
oLbx:lCellStyle := .T.
oLbx:aHJustify := { 2, 2 }
oLbx:nHeaderHeight:= 26
oLbx:nLineHeight:= 24
MySetBrowse( oLbx, oQry )
@ 170, 10 BUTTON oBtn PROMPT 'Classes' SIZE 50, 20 PIXEL ACTION Msginfo(oLbx:ClassName())
ACTIVATE DIALOG oDlg CENTERED
db():End()
return nil
//----------------------------------------------------------------------------//
function db()
static oCn
if oCn == nil
CONNECT oCn ;
HOST "localhost" USER "root" PASSWORD cpw DATABASE "easyfo"
endif
return oCn
//----------------------------------------------------------------------------//
Function MySetBrowse( oBrw, oDataSource )
local lRet := .t.
local bGoTop, bGoBottom, bSkipper
local cClsName
if ValType( oBrw ) != "O" .or. ValType( oDataSource ) != "O"
lRet := .f.
else
bGoTop := { || oDataSource:GoTop() }
bGoBottom := { || oDataSource:GoBottom() }
bSkipper := { | n | oDataSource:Skip( n ) }
cClsName := upper( oBrw:ClassName() )
if cClsName == "TBROWSE" // El nativo de Harbour y xHarbour
oBrw:goTopBlock := bGoTop
oBrw:goBottomBlock := bGoBottom
oBrw:SkipBlock := bSkipper
elseif cClsName $ "TWBROWSE TCBROWSE TSBROWSE TGRID TXBROWSE" // Para windows
oBrw:cAlias := ""
oBrw:bGoTop := bGoTop
oBrw:bGoBottom := bGoBottom
oBrw:bSkip := bSkipper
if cClsName == "TXBROWSE"
oBrw:bBof := { || oDataSource:Bof() }
oBrw:bEof := { || oDataSource:Eof() }
oBrw:bBookMark :={ | n | if( n == nil, oDataSource:RecNo(), ;
oDataSource:GoTo( n ) ) }
oBrw:bKeyNo := { || oDataSource:RecNo() }
oBrw:bKeyCount := { || oDataSource:RecCount() }
else
oBrw:bLogicLen := { || oDataSource:RecCount() }
endif
if oBrw:oVScroll() != nil
oBrw:oVscroll():SetRange( 1, oDataSource:RecCount() )
endif
oBrw:Refresh()
else
oDataSource:oError:Say( "Browse no implementado en SetBrowse", .f. )
endif
endif
return( lRet )
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 34 guests