where do I get an example xBrowse (TDolphin)? *Fixed*

Post Reply
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

where do I get an example xBrowse (TDolphin)? *Fixed*

Post by dutch »

Dear All,

I try to move to MySql with xBrowse but I cannot fine absolutely simple example in the group.

Can anyone show an example to use xBrowse MySql via TDolphin or TMySql.
Like

Code: Select all

@  0, 0 XBROWSE COLUMNS oQry:Field1, oQry:Field2 ;
                          HEADERS 'Field1 Header', 'Field2 Header' ;
                          DATASOURCE oQry ;
                          ....
 
I can make from XBROWSER( oQry ) but it is not user define columns.

Thanks in advance,
Last edited by dutch on Thu Jun 19, 2014 6:54 am, edited 1 time in total.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: where do I get an example xBrowse & (TMySql or TDolphin)?

Post by FranciscoA »

dutch: This is the way I do. Maybe it helps you. (MYSQL)

Code: Select all

1-
oQry:=oServer:Query("SELECT fechemis,td,numdoc,concepto,SUM(debe) debitos, SUM(haber) creditos, SUM(debe-haber) Diferencia, codibancos FROM " + cTablaFuente + " GROUP BY numdoc HAVING SUM(debe-haber) != 0;")

if oQry:LastRec() != 0
   xBrowse(oQry," DOCUMENTOS")
endif
oQry:End()
Return nil

.or.
//---------------------------------//
2-
oQry := oServer:Query("SELECT * FROM comprobd ORDER BY numdoc ;")
oQry:Gotop()
   
  oLbx := TXBrowse():New( oDlg ) 
  oLbx:SetMySql(oQry,.f.)

  oCol = oLbx:AddCol()
  oCol:bStrData = { || Transform( oQry:NumCD,"9999999999")  }
  oCol:cHeader = "Num/CD" 
  oCol:nWidth = 70
  oCol:nFootStrAlign := 1

  oCol = oLbx:AddCol()
  oCol:bStrData = { || DtoC(oQry:Fechemis) }
  oCol:nDataStrAlign := 1
  oCol:cHeader = "Fecha" 
  oCol:nWidth = 66
 
Regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
Adolfo
Posts: 815
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile
Contact:

Re: where do I get an example xBrowse & (TMySql or TDolphin)?

Post by Adolfo »

Ducth, I tested all the options to work with Mysql, now I'm working with tDolphin with no problem at all, locally, in LAN, WEB.

There´s plenty of samples in tDolphin's web http://tdolphin.blogspot.com/ and in samples directory in tDolhpin´s installation

If you have any problem, send me a private mail

From Chile
Adolfo
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
ShumingWang
Posts: 454
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Re: where do I get an example xBrowse & (TMySql or TDolphin)?

Post by ShumingWang »

User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: where do I get an example xBrowse & (TMySql or TDolphin)?

Post by nageswaragunupudi »

dutch wrote:Dear All,

I try to move to MySql with xBrowse but I cannot fine absolutely simple example in the group.

Can anyone show an example to use xBrowse MySql via TDolphin or TMySql.
Like

Code: Select all

@  0, 0 XBROWSE COLUMNS oQry:Field1, oQry:Field2 ;
                          HEADERS 'Field1 Header', 'Field2 Header' ;
                          DATASOURCE oQry ;
                          ....
 
I can make from XBROWSER( oQry ) but it is not user define columns.

Thanks in advance,
Just the same way as you write code for DBF or ADO RecordSet.

Code: Select all

oQry := oSrv:Query( "SELECT * FROM CUSTOMER" )
@ 0,0 XBROWSE oBrw OF oWnd DATASOURCE oQry ;
COLUMNS "First", "Last", "Salary"  ;
HEADERS "FirstName", "SurName", "Salary" <otherclauses>
 
If anyone knows how to code xbrowse for DBF, he already knows coding for any other datasource, be it TDataBase, ADO RecordSet, TMySql or TDolphin or any other.

Exactly the same code works for all. Only difference is the value for the clause DATASOURCE.

For example, in this statement:

Code: Select all

@ 0,0 XBROWSE oBrw OF oWnd DATASOURCE uVar ;
COLUMNS "First", "Last", "City", "Salary" <otherclauses>
 
if uVar is caharacter variable and is an alias name, it is DBF browse.
If uvar is an object and a recordset, it is ADO browse
If uvar is an object and TMySql/TDolphin Query, then it is TMySql/TDolphin Query
If uVar is an object and TDatabase class, it is TDatabase browse.
If uvar is an object and is oTree it is tree browse.
If uvar is an object and has Ado properties, it is properties browse.
If uvar is any other object, it browses the datas of the object.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: where do I get an example xBrowse (TDolphin)? *Fixed*

Post by nageswaragunupudi »

You modified the title as *Fixed*.
Is the xbrowse with Dolphin working well for you?
If so can you post a sample xbrowse command you have used?
Regards

G. N. Rao.
Hyderabad, India
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: where do I get an example xBrowse (TDolphin)? *Fixed*

Post by dutch »

Dear Mr.Rao,

Thank you for your kind help, this is the code (sample from Daniel Blog) that working now.

Code: Select all

#include "fivewin.ch"
#include "xbrowse.ch"
#include "ribbon.ch"
#include "hbcompat.ch"

FUNCTION Main()

   LOCAL oDlg
   LOCAL aBtns := Array( 5 )
   LOCAL oBrw, oQry, oServer
   local cValType

   
   D_SetCaseSensitive( .T. )
   
   IF ( oServer := ConnectTo() ) == NIL
      msgalert('cannot connect to server')
      RETURN NIL
   ENDIF
   oServer:bDebug = {| cQry | LogFile( "debuf.log", {cQry} ) }
   
   oQry = oServer:Query( "SELECT * FROM rmty_avl") // where rta_rmty='LOB'" )
   
   oQry:SetPages( 100 )
   oQry:bOnChangePage = { || oBrw:Refresh(), ChangeTitle( oQry, oDlg ) }

//   cValType := valtype( oQry:FieldGet( 'rta_stamp' )) return "C"
//   cValType := oQry:FieldType( 'rta_stamp' )      return "T"
//   cValType := valtype( oQry:rta_stamp )          return "C"

//   msginfo(cValType)

   DEFINE DIALOG oDlg TITLE "Current Page: " + StrZero( oQry:nCurrentPage, 5 ) + " / " + StrZero( oQry:nMaxPages, 5 ) SIZE 565, 480 
   

   BuildButtons( aBtns, oDlg, oQry )

   @ 30, 10 XBROWSE oBrw OF oDlg DATASOURCE oQry ;
            COLUMNS "rta_date", "rta_rmty", "rta_tlrm", "rta_occ" ;
            COLSIZES 100, 100, 100, 100 ;
            HEADERS "Date", "RmTy", "Total Room", "Occupied" ;
            PIXEL SIZE 260, 200 LINES ;
            UPDATE

//          AUTOCOLS AUTOSORT PIXEL SIZE 260, 200 LINES

// Uncomment this line for fivewin version < 10.7   
//   SetDolphin( oBrw, oQry )
   
   oBrw:CreateFromCode()
      
   ACTIVATE DIALOG oDlg CENTERED
   
   
RETURN NIL


PROCEDURE BuildButtons( aBtns, oDlg, oQry )
   LOCAL nPage


   @ 10, 10 RBBTN aBtns[ 1 ] PROMPT "&First" OF oDlg SIZE 20, 15 ;
            GROUPBUTTON FIRST  CENTER ;
            ROUND ROUNDSIZE 2;
            ACTION( oQry:FirstPage() ) ;
            WHEN( oQry:nCurrentPage > 1 )                    

   @ 10, 30 RBBTN  aBtns[ 2 ] PROMPT "&Prev" OF oDlg SIZE 20, 15 ;
            GROUPBUTTON  CENTER ;
            ROUND ROUNDSIZE 2;
            ACTION( oQry:PrevPage() ) ;
            WHEN( oQry:nCurrentPage > 1 )

   @ 10, 50 RBBTN aBtns[ 3 ] PROMPT "&Goto" OF oDlg SIZE 20, 15 ;
             GROUPBUTTON  CENTER ;
             ROUND ROUNDSIZE 2;
             ACTION( nPage := oQry:nCurrentPage,;
                     MsgGet( "Select Page:", "Page", @nPage ),;
                     oQry:GoToPage( nPage ) )

  
   @ 10, 70 RBBTN aBtns[ 4 ] PROMPT "&Next" OF oDlg SIZE 20, 15 ;
             GROUPBUTTON  CENTER ;
             ROUND ROUNDSIZE 2;
             ACTION( oQry:NextPage() ) ;
             WHEN( oQry:nCurrentPage < oQry:nMaxPages )

   @ 10, 90 RBBTN aBtns[ 5 ] PROMPT "&Last" OF oDlg SIZE 20, 15 ;
             GROUPBUTTON END  CENTER ;
             ROUND ROUNDSIZE 2;             
             ACTION( oQry:LastPage() ) ;
             WHEN( oQry:nCurrentPage < oQry:nMaxPages )


RETURN 

PROCEDURE ChangeTitle( oQry, oDlg )

   oDlg:cTitle = "Current Page: " + StrZero( oQry:nCurrentPage, 5 ) + " / " + StrZero( oQry:nMaxPages, 5 )
   
RETURN

#include "connto.prg"
#include "setbrw.prg"  
 
nageswaragunupudi wrote:You modified the title as *Fixed*.
Is the xbrowse with Dolphin working well for you?
If so can you post a sample xbrowse command you have used?
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Post Reply