tDolphin y Browser

tDolphin y Browser

Postby caducca » Sun Mar 11, 2018 1:32 am

Please try this sample
CODE: SELECT ALL EXPAND VIEW
#include "fivewin.ch"

REQUEST DBFCDX

function Main()

local oDlg, oBar, oBrw

USE CUSTOMER

DEFINE DIALOG oDlg SIZE 900,500 PIXEL TRUEPIXEL
DEFINE BUTTONBAR oBar OF oDlg SIZE 56,56 2013

@ 70,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE Alias() AUTOCOLS FASTEDIT ;
CELL LINES NOBORDER

WITH OBJECT oBrw
:nEditTypes := EDIT_GET
:CreateFromCode()
END

BrwBarBtns( oBar, oBrw )

ACTIVATE DIALOG oDlg CENTERED

return nil

function BrwBarBtns( oBar, oBrw )

local n := 1

DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\top.bmp" PROMPT "Top" TOOLTIP "Go Top" ;
ACTION ( oBrw:GoTop(), oBrw:SetFocus() )
DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\16x16\goto.bmp" PROMPT "GoTo" TOOLTIP "Go To Record" ;
ACTION ( If( MsgGet( "GOTO RECORD", "Enter Rec No #", @n ), ;
( oBrw:BookMark := n, oBrw:Refresh() ), nil ), oBrw:SetFocus() )
DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\bottom.bmp" PROMPT "Bottom" TOOLTIP "GoBottom" ;
ACTION ( oBrw:GoBottom(), oBrw:SetFocus() )
DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\new2.bmp" PROMPT "Add" GROUP TOOLTIP "Add New Record" ;
ACTION oBrw:EditSource( .t. )
DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\edit.bmp" PROMPT "Edit" TOOLTIP "Edit Record" ;
ACTION oBrw:EditSource()
DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\16x16\delete0.bmp" PROMPT "Delete" TOOLTIP "Delete Record" ;
ACTION ( If( MsgYesNo( "Delete Record?" ), oBrw:Delete(), nil ), oBrw:SetFocus() )
DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\16x16\excel.bmp" PROMPT "Excel" GROUP TOOLTIP "Export to Excel" ;
ACTION oBrw:ToExcel()
DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\printquick16.bmp" PROMPT "Print" TOOLTIP "Print Report" ;
ACTION oBrw:Report()
DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\close.bmp" PROMPT "Close" GROUP TOOLTIP "Close" ;
ACTION oBrw:oWnd:End()

return nil


You can use this as a template.
You may adopt this to your taste, by changing bitmaps, prompts, bar style, size, etc.
The may also add some buttons or remove some buttons depending on your need.
Same code will work for RDD, ADO, MySql, etc
Regards

Esto puede ser usado con la Librería tDolphin? porque a mi me da error
caducca
 
Posts: 104
Joined: Wed Mar 08, 2006 2:24 pm

Re: tDolphin y Browser

Postby cnavarro » Sun Mar 11, 2018 1:59 am

Qué error?
Cómo defines el Browse para utilizar Dolphin?
Qué versión de Fw utilizas?
Utilizas la lib Dolphin que proporciona Fw?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: tDolphin y Browser

Postby caducca » Sun Mar 11, 2018 2:06 am

Este es el código que uso:

Public oBrw

oQryTar := oServer:Query( "SELECT * FROM tarjeta ORDER BY Id" )

DEFINE FONT oFont NAME "Times New Roman" SIZE 0, -12
DEFINE FONT oFont18 NAME "Times New Roman" SIZE 0, -18 BOLD

DEFINE DIALOG oDlg SIZE 900,500 PIXEL TRUEPIXEL
DEFINE BUTTONBAR oBarC OF oDlg SIZE 56,56 2013

@ 70,20 XBROWSE oBrwC SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE oQryTar ;
COLUMNS ;
"Id", ;
"tar_nombre" ;
COLSIZES 100,600 ;
HEADERS "Id Tarj.", "Nombre Tarjeta" ;
CELL LINES NOBORDER AUTOCOLS

WITH OBJECT oBrwC
:lSeekBar := .T.
:bClrEdits := { || { CLR_HRED, CLR_YELLOW } }
:lAutoSort := .T.
:l2013 := .T.
:CreateFromCode()
END

oBarC:bPainted := { || oBarC:SayText( "Listado de Tarjetas", ;
{ nil, nil, nil, -50 }, "R", oFont18, CLR_HRED ) }

BrwBarBtnsF( oBarC, oBrwC )

ACTIVATE DIALOG oDlg CENTERED

oFont18:End()
oFont:End()

Return Nil


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

FUNCTION BrwBarBtnsF( oBar, oBrw )

Local n := 1, cBuscaB:=Space(30)

DEFINE BUTTON OF oBar FILE ".\BMP\Anterior.PNG" PROMPT "Primero" TOOLTIP "Ir al Primero" ;
ACTION Nada() // ( oBrw:GoTop(), oBrw:SetFocus() )
DEFINE BUTTON OF oBar FILE ".\BMP\Buscar.PNG" PROMPT "Buscar" TOOLTIP "Buscar" ;
ACTION Nada()
DEFINE BUTTON OF oBar FILE ".\BMP\Siguiente.PNG" PROMPT "Ultimo" TOOLTIP "Ir al Ultimo" ;
ACTION Nada() // ( oBrw:GoBottom(), oBrw:SetFocus() )
DEFINE BUTTON OF oBar FILE ".\BMP\Agregar.PNG" PROMPT "Agergar" GROUP TOOLTIP "Agregar Registro" ;
ACTION CargaTarje(.T.)
DEFINE BUTTON OF oBar FILE ".\BMP\editar.PNG" PROMPT "Modificar" TOOLTIP "Modificar Registro" ;
ACTION CargaTarje(.F.) // nCodiAl:=oRsAlu:Id, EditAlum(.F.,nCodiAl))
DEFINE BUTTON OF oBar FILE ".\BMP\Borrar.PNG" PROMPT "Borrar" TOOLTIP "Borrar Registro" ;
ACTION Nada()
DEFINE BUTTON OF oBar FILE ".\BMP\Excel.PNG" PROMPT "Excel" GROUP TOOLTIP "Exportar a Excel" ;
ACTION Nada() // oBrw:ToExcel()
DEFINE BUTTON OF oBar FILE ".\BMP\Print.PNG" PROMPT "Imprimir" TOOLTIP "Imprimir Reporte" ;
ACTION Nada() // oBrw:Report()
DEFINE BUTTON OF oBar FILE ".\BMP\Salir2.PNG" PROMPT "Salir" GROUP TOOLTIP "Cerrar Ventana" ;
ACTION oBrw:oWnd:End()

Return Nil

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

FUNCTION CargaTarje(lAppend)

If lAppend
oQryTar:GetBlankRow(.F.)
Else
oQryTar:GetRow()
EndIf
DEFINE DIALOG oDlgT1 RESOURCE "DATOSTARJE"

REDEFINE GET oQryTar:tar_nombre ID 4004 OF oDlgT1

REDEFINE BTNBMP oBtnA ID 250 OF oDlgT1 MESSAGE "Graba el Cliente..." ;
FILE "./BMP/Grabar.BMP" PROMPT "Grabar" LEFT ;
ACTION (lSave:=.T., oDlgT1:End())

REDEFINE BTNBMP oBtnC ID 240 OF oDlgT1 MESSAGE "Cancela el Movimiento..." ;
FILE "./BMP/Cancelar.BMP" PROMPT "Cancelar" LEFT ;
ACTION oDlgT1:End()

ACTIVATE DIALOG oDlgT1 CENTERED


Lo probé con DBFs y funciona pero con Mysql y tDolphin me arroja el siguiente reusltado
pplication
===========
Path and name: D:\Programs\Tarjetas\Tarjetas.Exe (32 bits)
Size: 1,297,920 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20161218)
FiveWin version: FWHX 17.03
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 2 secs
Error occurred at: 10/03/2018, 23:06:05
Error description: Error BASE/1004 Message not found: FWMARIAROWSET:GETROW

Stack Calls
===========
Called from: .\source\function\HARBOUR.PRG => _CLSSETERROR( 247 )
Called from: .\source\internal\FWROWSET.PRG => FWMARIAROWSET:GETROW( 1180 )
Called from: D:\Programs\Tarjetas\PRG\tarjeabm.prg => CARGATARJE( 91 )
Called from: D:\Programs\Tarjetas\PRG\tarjeabm.prg => (b)BRWBARBTNSF( 72 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 665 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 901 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1721 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 1848 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3325 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 296 )
Called from: D:\Programs\Tarjetas\PRG\tarjeabm.prg => TARJE( 49 )
Called from: D:\Programs\Tarjetas\PRG\tarjetas.prg => (b)MAIN( 123 )
Called from: .\source\classes\TRBTN.PRG => TRBTN:CLICK( 717 )
Called from: .\source\classes\TRBTN.PRG => TRBTN:LBUTTONUP( 917 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1721 )
Called from: .\source\classes\TRBTN.PRG => TRBTN:HANDLEEVENT( 1575 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3325 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1036 )
Called from: D:\Programs\Tarjetas\PRG\tarjetas.prg => MAIN( 196 )
caducca
 
Posts: 104
Joined: Wed Mar 08, 2006 2:24 pm

Re: tDolphin y Browser

Postby cnavarro » Sun Mar 11, 2018 12:57 pm

Antes del CreateFromCode, prueba a poner oBrw:SetDolphin(oQryTar)

Aqui tienes la documentación del xBrowse
http://wiki.fivetechsoft.com/doku.php?i ... s_txbrowse
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: tDolphin y Browser

Postby caducca » Mon Mar 12, 2018 12:52 pm

Gracias Navarro, solucionado
caducca
 
Posts: 104
Joined: Wed Mar 08, 2006 2:24 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 42 guests