FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posted: Wed Feb 20, 2013 06:37 PM
Hola a todos

Antonio, Daniel o el master que pueda echar una mano:
Ya he posteado el tema de los SetCheck que en la versi贸n 12.06 lo ten茅is comentado y he tenido que descomentarlo para que me funcionen las casillas de verificaci贸n en los TxBrowses, no se si est谩 bien o mal, ya que si hab茅is comentado el tema es por algo, pero yo lo necesitaba urgente, y de momento en lo que uso no he recibido ning煤n error, espero que me dig谩is a que puede afectar el descomentar el hChecked.

Por otro lado estoy intentando que el usuario vea lo que teclea cuando se hace una b煤squeda incremental con ADO, pero me encuentro que en el methodo seek(cSeek) ,
l铆neas 5850 a 5925 de la versi贸n 12.04 y l铆neas 6000 a 6108 de la versi贸n 12.06 la data oSeek hace cascar al browse en el momento en que no sea Nil.
El error que da es Error description: Error BASE/1004 Class: 'CHARACTER' has no exported method: SETTEXT
la instrucci贸n que es la misma en las dos versiones es la siguiente : ::SetText( cSeek )

驴Hay alguna manera de que no casque y se pueda ver lo que el usuario escribe en un Say de un di谩logo? :-)

He visto adem谩s que, aunque en el programa, a la data bSeek le de un valor de bloque de c贸digo con su funci贸n correspondiente de b煤squeda, nunca toma ese valor, siempre toma el de la clase. :-)
Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
Re: TXBROWSE para Antonio Linares o Daniel Gil
Posted: Thu Feb 21, 2013 06:13 PM

Lo seguir茅 intentando, no creo que sea tan dificil

:oops::roll::|

Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TXBROWSE para Antonio Linares o Daniel Gil
Posted: Fri Feb 22, 2013 08:17 AM

oBrw:oSeek should be a Say object.
Somewhere in the application oBrw:oSeek appears to have been set to some character value.

Finally for may we know for which version of FWH you need help now?

Regards



G. N. Rao.

Hyderabad, India
Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
Re: TXBROWSE para Antonio Linares o Daniel Gil
Posted: Fri Feb 22, 2013 09:22 AM
Hello Mister Nao
I've posted the sources that use versions 12.04 and 12.06. If you wonder why, say that you mentioned in FWH 12.06 9621 el hChecked line and I caused errors using
oBrw: aCols [X]: SetCheck ({"CHECKON", "checkoff"}).

The oSeek object is an object in the application Say
Code (fw): Select all Collapse
 聽 聽 聽DEFINE DIALOG oDlgBus RESOURCE "BUSCARCLIE" COLOR RGB(0,0,0),RGB(153,204,153)
聽 聽 聽 
聽 聽 聽 oBrwCli := TXBrowse():New( oDlgBus ) 
* 聽 聽 聽oBrwCli:bSeek := { |c| BuscaIncr( oRsClie,c,"Nombre",oDlgBus) } 聽<--------------Esto no funciona, no va nunca a esta funci贸n, siempre va a la funci贸n/m茅thdo definida                                                              *                                                                                                                          en xBrowse.prg. Comentado

聽 聽 聽 oBrwCli:SetAdo(oRsClie,.T.,.T.)
聽 聽 聽 聽
聽 聽 聽 oBrwCli:nMarqueeStyle 聽 聽 聽 := MARQSTYLE_HIGHLCELL 
聽 聽 聽 oBrwCli:nColDividerStyle 聽 聽:= LINESTYLE_BLACK 
聽 聽 聽 oBrwCli:nRowDividerStyle 聽 聽:= LINESTYLE_BLACK 
聽 聽 聽 oBrwCli:lColDividerComplete := .t. 

聽 聽 聽 for nFor := 1 to len( oBrwCli:aCols ) 
聽 聽 聽 聽 聽 oCol := oBrwCli:aCols[ nFor ] 
聽 聽 聽 聽 聽 oCol:nEditType := 0 
聽 聽 聽 next 
聽 聽 聽 oBrwCli:aCols[1]:nWidth := 60
聽 聽 聽 oBrwCli:aCols[2]:nWidth := 500
聽 聽 聽 oBrwCli:CreateFromResource(2001)


聽 聽 聽 REDEFINE SAY cTexto ID 4001 OF oDlgBus 聽;
聽 聽 聽 聽 聽 聽 聽 聽COLOR RGB(0,0,0),RGB(153,204,153)
聽 聽 聽 聽 聽 聽 聽 聽
聽 聽 聽 REDEFINE SAY oTexto Var cNombre ID 4002 PICTURE "@!" of oDlgBus UPDATE;
聽 聽 聽 聽 聽 聽 聽 聽COLOR RGB(0,0,0),RGB(204,204,102) 
聽 聽 聽 聽 聽 聽 聽 聽
聽 聽 聽 REDEFINE BUTTONBMP ID 221 OF oDlgBus BITMAP "ACEPTAR" TEXTRIGHT ;
聽 聽 聽 聽 聽 聽 聽 聽 聽ACTION (aDatosFac[1] := oRsClie:Fields("Codigo"):Value, ;
聽 聽 聽 聽 聽 聽 聽 聽 聽cNombre := oRsClie:Fields("Nombre"):Value,;
聽 聽 聽 聽 聽 聽 聽 聽 聽oRsClie:Close(), oDlgBus:End() )
聽 聽 聽 REDEFINE BUTTONBMP ID 222 OF oDlgBus BITMAP "CANCELAR" TEXTRIGHT ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 ACTION (cNombre := Space(40), oRsClie:Close(), oDlgBus:End())
聽 聽 聽 
聽 聽 聽 oBrwCli:oSeek := oTexto    //<------------- Esto funciona aqui, si lo pongo antes del redefine say no funciona y casca el browse

聽 聽 聽ACTIVATE DIALOG oDlgBus CENTERED;
聽 聽 聽 聽 聽 聽 聽 ON INIT oBrwCli:SetFocus()
聽 聽 聽SysRefresh()


The problem is that not what keyed assignment, why is always nil.
Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
Re: TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posted: Fri Feb 22, 2013 09:59 AM

Por fin lo econtr茅 :lol: :lol:

En la versi贸n 12.04 falta en la Funci贸n AdoSeek(( oRs, uSeek, lSoft, lWildSeek) falta enviar Self (al no ser un Methodo) y colocar al final del Do Case EndCase la siguiente l铆nea
Self:cSeek := uSeek en mi caso lo hice as铆

L铆nea 4196 ::bSeek := { |c| AdoSeek( ::oRs, c,, ::lSeekWild, Self ) } <------------------ Env铆o Self

Static Function AdoSeek(( oRs, uSeek, lSoft, lWildSeek, oBrw)
......
.....
Do Case
.....
EndCase
oBrw:cSeek := uSeek
.....

Para los que usan la versi贸n 12.06 la Funcion AdoSeek se ha convertido en el Methodo AdoIncrSeek y al igual que en la versi贸n anterior
METHOD AdoIncrSeek( cSeek)
......
.....
Do Case
.....
EndCase
::cSeek := uSeek <--------------- cSeek es una Data
.....

Por otro lado hay que declarar la asignaci贸n oBrw:oSeek despu茅s de declarar la variable del SAY en el DEFINE o REDEFINE.

Lo que no logro entender es el motivo por el cual si yo quiero hacer un bSeek fuera del que hay en el TxBrowse 茅ste es ignorado por la clase.

Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posted: Fri Feb 22, 2013 03:01 PM
In both the versions of XBrowse, incremental seeks works perfectly well while browsing ADO also.

Instead of
Code (fw): Select all Collapse
 聽 聽 聽REDEFINE SAY oTexto Var cNombre ID 4002 PICTURE "@!" of oDlgBus UPDATE;
聽 聽 聽 聽 聽 聽 聽 聽COLOR RGB(0,0,0),RGB(204,204,102)

Please substitute
Code (fw): Select all Collapse
聽 聽 聽 REDEFINE SAY oBrwCli:oSeek Var oBrw:cSeek ID 4002 PICTURE "@!" of oDlgBus ;
聽 聽 聽 聽 聽 聽 聽 聽COLOR RGB(0,0,0),RGB(204,204,102)

This is the recommended way.
We better do not touch any other internals of XBrowse to avoid any confusion.
If you still find any problem, I shall post a complete working sample.

Even checkboxes work correctly with these version we better use the xbrowse of FWH without any modifications.

If you still find any problem, I shall post a complete working sample.
Regards



G. N. Rao.

Hyderabad, India
Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
Re: TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posted: Fri Feb 22, 2013 03:32 PM
Mister Nao

http://forums.fivetechsupport.com/viewtopic.php?f=6&t=25630

Lineas 9621 a 9636 originales en xBrowse.prg FWH ver 12.06
Code (fw): Select all Collapse
9621 聽 if ::bStrData != nil 聽 聽//.and. !::hChecked 聽 聽"<<====================="
9622 聽 聽 聽cData := Eval( ::bStrData )
9623 聽 聽 聽if ValType( cData ) != 'C'
9624 聽 聽 聽 聽 cData := cValToChar( cData )
9625 聽 聽 聽endif
9626 聽 聽 聽if ! Empty( ::nDataStrAlign )
9627 聽 聽 聽 聽cData := AllTrim( cData )
9628 聽 聽 聽endif
9629 聽 聽 聽if isrtf( cData )
9630 聽 聽 聽 聽 cData := "<RichText>"
9631 聽 聽 聽elseif isGtf( cData )
9632 聽 聽 聽 聽 cData := GtfToTxt( cData )
9633 聽 聽 聽endif
9634 聽 else
9635 聽 聽 聽cData := ""
9636 聽 endif

Produce el error que describo. En cambio si en la linea 9621 quitamos el comentario
9621 if ::bStrData != nil .and. !::hChecked
el programa funciona correctamente. Mi preocupaci贸n es simple, 驴qu茅 motivo hay para comentar el hChecked?
En la versi贸n 12.04 linea 9265 de la clase xBrowse.prg est谩 correcta y sin comentar.
En las WastNews Mayo 2012 (FWH 12.05) y June 2012 (FWH 12.06) no aparecen comentarios sobre el motivo por el que se ha comentado dicha Data. 驴A qu茅 afecta o afectaba el tener esa data o no tenerla?. A mi desde luego me afecta que el programa da un error en las columnas del TxBrowse cuando quiero tener casillas de verificaci贸n.

Por otro lado me gustar铆a, si es posible, me indicara el motivo por el que el bSeek de la clase no hace caso al bSeek que se le indica.
Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posted: Fri Feb 22, 2013 04:28 PM
SetCheck
======

Please do not modify the xbrowse program at all.
SetCheck() should work without any errors.
I am giving a sample using SetCheck method using an array.
If you code the same way you will not get any errors.

Code (fw): Select all Collapse
#include "fivewin.ch"
#include "xbrowse.ch"


function Main()

   local oDlg, oBrw
   local aData := { ;
      { "Sunday", .t., "abcd" }, ;
      { "Monday", .f., "bcde" }, ;
      { "Tuesda", .f., "cdef" }, ;
      { "Wednes", .f., "defg" }  }

   DEFINE DIALOG oDlg SIZE 300,300 PIXEL
   @ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE aData AUTOCOLS ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :aCols[ 2 ]:SetCheck( nil, ;   // use default bitmaps ( or provide array of bitmaps )
                           .t. )    // user can edit/toggle
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED ON INIT ( oBrw:SetFocus(), .f. )

return nil


Please compile the above code and test with the original FWH library without modifications.
This sample works correctly.

If you are getting errors, it may have to do something with the application code.
I need to see how the columns are defined and how SetCheck is used in the program.

SetCheck Parameters:
1. [Optional: Array of bitmaps]. If omitted, default bitmaps are used.
2. [Optional: lEdit] If the parameter is .t., the user is allowed to modify the values.
3. [Optional: Array of prompts] If specified, in addition to the checkbox we can show prompts for true / false values.
Regards



G. N. Rao.

Hyderabad, India
Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
Re: TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posted: Fri Feb 22, 2013 05:36 PM
Mister Nao

Code (fw): Select all Collapse
#Include "Fivewin.ch"
#Include "Xbrowse.CH"
#Include "ADODEF.CH"

#define ID_ALT      1   // Alta
#define ID_MOD      3   // Modificar

Static oFontCli, oRsClien
*------------------------------------------------------------------------------
function Clientes(oBarMain)
*------------------------------------------------------------------------------
Local oWChild, oBar, oBrw
Local oError
Local aRowGrad,aSelGrad ,aCampos

      oBarMain:Disable()
     
      If oConex <> nil
         oRsClien := TOLEAUTO():NEW("ADODB.RecordSet")
         oRsClien:Activeconnection(oConex)
         oRsClien:Locktype       := adLockOptimistic
         oRsClien:CursorType     := adOpenDynamic
         oRsClien:CursorLocation := adUseClient
         oRsClien:Source         := "SELECT * FROM CLIENTES ORDER BY CODIGO"

         TRY
             oRsClien:Open()             
         CATCH
             FOR EACH oError IN oCone:Errors
                 ShowError(oError)
             NEXT
         END
      //--------------------------------------------------------------//
      Else  
         MsgStop("No hay conexi贸n con la base de datos","ATENCION")
         oBarMain:Enable()
         Return nil
      EndIf  
      aRowGrad := { { .5, RGB( 232, 241, 252 ), RGB(  232, 241, 252 ) }, ;
                 { .5, RGB( 210, 225, 244 ), RGB(  235, 243, 253 ) } }

      aSelGrad := { { .5, RGB( 255, 255, 251 ), RGB( 255, 237, 178 ) }, ;
                 { .5, RGB( 255, 218, 103 ), RGB( 255, 233, 162 ) } }
     
      DEFINE FONT oFontCli NAME "VERDANA" SIZE 0, -11
      DEFINE WINDOW oWChild MDICHILD NOSYSMENU;
             TITLE "Fichero de Clientes" OF oWMain

             SET FONT OF oWChild TO oFontCli

    

      DEFINE BUTTONBAR oBar SIZE 70,60 OF oWChild 2007
      DEFINE BUTTON NAME "Crear" OF oBar ;
             PROMPT "NUEVO";
               ACTION CtrCliente( ID_ALT,oWChild,oBrw) TOOLTIP "Nuevos Clientes"
      DEFINE BUTTON NAME "Editar" OF oBar ;
             PROMPT "EDITAR";      
               ACTION CtrCliente( ID_MOD,oWchild,oBrw ) TOOLTIP "Editar Clientes"
      DEFINE BUTTON NAME "Borrar" OF oBar ;
             PROMPT "BORRAR";      
               ACTION  BorraCliente(oBrw ) TOOLTIP "Borrar Clientes"
      DEFINE BUTTON NAME "Buscar"         ;
             PROMPT "BUSCAR";      
               OF oBar TOOLTIP "Busca un Registro";
               ACTION BuscaTbrw( oRsClien,oBrw,cBusca )
      DEFINE BUTTON NAME "Salir"         ;
             PROMPT "SALIR";      
               OF oBar TOOLTIP "Salir de esta pantalla";
               ACTION oWChild:End() 

                  
      oBrw := TXBrowse():New( oWChild ) 
      oBrw:SetAdo( oRsClien, .T.,.T.)
      
      WITH OBJECT oBrw
           :lColDividerComplete := .t. 
           :nMarqueeStyle       := 3
           :nColDividerStyle    := 1
           :nHeaderLines        := 2
           :lFooter             := .t.
           :nStretchCol         := 1
           :bClrSelFocus  := { || { CLR_BLACK, aSelGrad } }
           :bClrRowFocus  := { || { CLR_BLACK, aRowGrad } }  
           :bClrStd       := {|| IIF(oRsClien:AbsolutePosition % 2 == 0,{ CLR_BLACK, RGB( 224, 236, 255 ) }, { CLR_BLACK, RGB( 189, 211, 253 ) } )} 
           :CreateFromCode()  
           :Adjust() 
           :l2007 := .t.
      END
      For nFor := 1 to len( oBrw:aCols ) 
          oCol := oBrw:aCols[ nFor ] 
          oCol:nEditType := 0 
          If oCol:Value = nil
             oCol:cEditPicture := Space(10)
          EndIf   
          oCol:blDClickData := {|| CtrCliente(ID_MOD,oWChild,oBrw),oBrw:Refresh() }
      next 

*      oBrw:aCols[13]:SetCheck ({"CHECKON","CHECKOFF"} )
*      oBrw:aCols[14]:SetCheck ({"CHECKON","CHECKOFF"} )
      oBrw:aCols[13]:SetCheck(nil,.F.)
      oBrw:aCols[14]:SetCheck(nil,.F.)         
     
      oWChild:oClient := oBrw 
      
      ACTIVATE WINDOW oWChild MAXIMIZED ;
             ON INIT oBrw:SetFocus();
             VALID( oBarMain:Enable(),oRsClien:Close(),oRsClien := "Nothing",.t. )
    SysRefresh()
    RELEASE FONT oFontCli
       
return( nil )


En este c贸digo, con una Base de datos Access abierta, y accediendo a la tabla Clientes, cuando se mueve el cursor hacia la derecha para ver los campos, al llegar al campo
13 que es un campo l贸gico, tipo 11, salta el error comentado :
Application
===========
Path and name: D:\ProyectosADO\Pizarro\GFACTU.Exe (32 bits)
Size: 974,336 bytes
Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 9656)
FiveWin Version: FWHX 12.06
Windows version: 6.1, Build 7600

Time from start: 0 hours 0 mins 7 secs
Error occurred at: 22-02-2013, 17:07:03
Error description: Error BASE/1004 Class: 'LOGICAL' has no exported method: EVAL
Args:
[ 1] = L .F.

Stack Calls
===========
Called from: => EVAL( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTCELL( 9622 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA( 9574 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 1434 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 1253 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1666 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11649 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3154 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 270 )
Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 426 )
Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 31 )
Called from: => EVAL( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTCELL( 9622 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA( 9574 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 1434 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 1253 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1666 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11649 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3154 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 270 )
Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 426 )
Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 31 )
Called from: => EVAL( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTCELL( 9622 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA( 9574 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 1434 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 1253 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1666 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11649 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3154 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 980 )
Called from: D:\PROYEC~4\Pizarro\SOURCE\geshinic.prg => MAIN( 155 )


Acabo de hacer una prueba ahora mismo con la biblioteca original, sin poner el c贸digo fuente en mi m贸dulo de compilaci贸n y salta el error.
Como podr谩 comprobar por el encabezado del error, uso xHarbour y la versi贸n de FWH es la 12.06.
Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posted: Sun Feb 24, 2013 02:11 PM
Please make the following important corrections in your program.

1. Please remove ":CreateFromCode()" from the present place and place it at the end just before oWndClie:oClient := oBrw. This is the reason for the error you are getting.

oBrw:CreateFromCode should be called LAST, after setting all other browse data and variables.

2. Please remove the call " :Adjust()".
This method is used internally by xbrowse and should not be called from the application program.

Please recompile and test.

Suggested rearrangement of code:
Code (fw): Select all Collapse
/*
聽 聽// not necessary
聽 聽// If needed this should be placed before calling oBrw:CreateFromCode()
聽 聽 
聽 聽For nFor := 1 to len( oBrw:aCols ) 
聽 聽 聽 聽oCol := oBrw:aCols[ nFor ] 
聽 聽 聽 聽oCol:nEditType := 0 聽// default. 聽not necessary
聽 聽 聽 聽If oCol:Value = nil
聽 聽 聽 聽 聽 oCol:cEditPicture := Space(10) // nil values are not displayed. not necessary
聽 聽 聽 聽EndIf 聽 
聽 聽 聽 聽oCol:blDClickData := {|| CtrCliente(ID_MOD,oWChild,oBrw),oBrw:Refresh() }
聽 聽next 
*/

聽 聽WITH OBJECT oBrw
聽 聽 聽 聽 :lColDividerComplete := .t. 
聽 聽 聽 聽 :nMarqueeStyle 聽 聽 聽 := 3
聽 聽 聽 聽 :nColDividerStyle 聽 聽:= 1
聽 聽 聽 聽 :nHeaderLines 聽 聽 聽 聽:= 2
聽 聽 聽 聽 :lFooter 聽 聽 聽 聽 聽 聽 := .t.
聽 聽 聽 聽 :nStretchCol 聽 聽 聽 聽 := 1
聽 聽 聽 聽 :bClrSelFocus 聽:= { || { CLR_BLACK, aSelGrad } }
聽 聽 聽 聽 :bClrRowFocus 聽:= { || { CLR_BLACK, aRowGrad } } 聽
聽 聽 聽 聽 :bClrStd 聽 聽 聽 := {|| IIF(oRsClien:AbsolutePosition % 2 == 0,{ CLR_BLACK, RGB( 224, 236, 255 ) }, { CLR_BLACK, RGB( 189, 211, 253 ) } )} 
聽 聽 聽 聽 //
聽 * 聽 聽 :aCols[13]:SetCheck ({"CHECKON","CHECKOFF"} )
聽 * 聽 聽 :aCols[14]:SetCheck ({"CHECKON","CHECKOFF"} )
聽 聽 聽 聽 :aCols[13]:SetCheck(nil,.F.)
聽 聽 聽 聽 :aCols[14]:SetCheck(nil,.F.) 聽 聽 聽 聽 
聽 聽 聽 聽 //
聽 聽 聽 聽 :blDClickDatas := {|| CtrCliente(ID_MOD,oWChild,oBrw),oBrw:Refresh() }
聽 聽 聽 聽 // by using plural tense this applies to all columns

聽 聽 聽 聽 :CreateFromCode() 聽// Should be the LAST
聽 聽 聽 聽 // 聽:Adjust() 聽// SHOULD NOT BE CALLED IN PROGRAM 
聽 聽 聽 聽 // :l2007 := .t. 聽// default. not necessary
聽 聽END

聽 聽oWChild:oClient := oBrw
Regards



G. N. Rao.

Hyderabad, India
Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
Re: TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posted: Sun Feb 24, 2013 05:04 PM
Estimado Mister Nao

Despu茅s de un mont贸n de pruebas con el ejemplo xbincflt.prg y una vez adaptado a mi programa, sin que los fallos que a mi me dan se produjesen, miro en ambos .prgs las diferencias que hay, y s贸lo encuentro una : En el ejemplo xbincflt.prg hay dos includes que yo no tengo, son ord.ch y hbcompat.ch.
Coloco en el m贸dulo que me da el error esos dos includes y como dicen los franceses "et voila" el programa funciona correctamente sin problemas y adem谩s con el tercer par谩metro del setcheck(arraybitmaps, lEdit, ArrayCaracteres).
No ha sido necesario tocar las l铆neas que usted me indica, no obstante har茅 los cambios oportunos por si de esa manera funcionara igualmente.
De todas formas le digo que ahora mismo est谩 funcionando correctamente con tan solo adicionar al inicio esos includes.

Modulo original que no funciona
Code (fw): Select all Collapse
#Include "Fivewin.ch"
#Include "Xbrowse.CH"
#Include "ADODEF.CH"

#define ID_ALT      1   // Alta
#define ID_MOD      3   // Modificar

Static oFontCli, oRsClien
*------------------------------------------------------------------------------
function Clientes(oBarMain)
*------------------------------------------------------------------------------
Local oWChild, oBar, oBrw
Local oError
Local aRowGrad,aSelGrad ,aCampos

      oBarMain:Disable()
      oRsClien := FW_OpenRecordSet( oConex, "SELECT * FROM CLIENTES ORDER BY CODIGO", 3 )     
*      If oConex <> nil
*         oRsClien := TOLEAUTO():NEW("ADODB.RecordSet")
*         oRsClien:Activeconnection(oConex)
*         oRsClien:Locktype       := adLockOptimistic
*         oRsClien:CursorType     := adOpenDynamic
*         oRsClien:CursorLocation := adUseClient
*         oRsClien:Source         := "SELECT * FROM CLIENTES ORDER BY CODIGO"
*
*         TRY
*             oRsClien:Open()             
*         CATCH
*             FOR EACH oError IN oCone:Errors
*                 ShowError(oError)
*             NEXT
*         END
*      //--------------------------------------------------------------//
*      Else  
*         MsgStop("No hay conexi贸n con la base de datos","ATENCION")
*         oBarMain:Enable()
*         Return nil
*      EndIf  
      aRowGrad := { { .5, RGB( 232, 241, 252 ), RGB(  232, 241, 252 ) }, ;
                 { .5, RGB( 210, 225, 244 ), RGB(  235, 243, 253 ) } }

      aSelGrad := { { .5, RGB( 255, 255, 251 ), RGB( 255, 237, 178 ) }, ;
                 { .5, RGB( 255, 218, 103 ), RGB( 255, 233, 162 ) } }
     
*      Info(oRsClien)                 
      DEFINE FONT oFontCli NAME "VERDANA" SIZE 0, -11
      DEFINE WINDOW oWChild MDICHILD NOSYSMENU;
             TITLE "Fichero de Clientes" OF oWMain

             SET FONT OF oWChild TO oFontCli

    

      DEFINE BUTTONBAR oBar SIZE 70,60 OF oWChild 2007
      DEFINE BUTTON NAME "Crear" OF oBar ;
             PROMPT "NUEVO";
               ACTION CtrCliente( ID_ALT,oWChild,oBrw) TOOLTIP "Nuevos Clientes"
      DEFINE BUTTON NAME "Editar" OF oBar ;
             PROMPT "EDITAR";      
               ACTION CtrCliente( ID_MOD,oWchild,oBrw ) TOOLTIP "Editar Clientes"
      DEFINE BUTTON NAME "Borrar" OF oBar ;
             PROMPT "BORRAR";      
               ACTION  BorraCliente(oBrw ) TOOLTIP "Borrar Clientes"
      DEFINE BUTTON NAME "Buscar"         ;
             PROMPT "BUSCAR";      
               OF oBar TOOLTIP "Busca un Registro";
               ACTION BuscaTbrw( oRsClien,oBrw,cBusca )
      DEFINE BUTTON NAME "Salir"         ;
             PROMPT "SALIR";      
               OF oBar TOOLTIP "Salir de esta pantalla";
               ACTION oWChild:End() 
    
      oBrw := TXBrowse():New( oWChild ) 
      oBrw:SetAdo( oRsClien, .T.,.T.)
      
      WITH OBJECT oBrw
           :lColDividerComplete := .t. 
           :nMarqueeStyle       := 3
           :nColDividerStyle    := 1
           :nHeaderLines        := 2
           :lFooter             := .t.
           :nStretchCol         := 1
           :bClrSelFocus  := { || { CLR_BLACK, aSelGrad } }
           :bClrRowFocus  := { || { CLR_BLACK, aRowGrad } }  
           :bClrStd       := {|| IIF(oRsClien:AbsolutePosition % 2 == 0,{ CLR_BLACK, RGB( 224, 236, 255 ) }, { CLR_BLACK, RGB( 189, 211, 253 ) } )} 
           :CreateFromCode()  
           :Adjust() 
           :l2007 := .t.
      END
      For nFor := 1 to len( oBrw:aCols ) 
          oCol := oBrw:aCols[ nFor ] 
          oCol:nEditType := 0 
          If oCol:Value = nil
             oCol:cEditPicture := Space(10)
          EndIf   
          oCol:blDClickData := {|| CtrCliente(ID_MOD,oWChild,oBrw),oBrw:Refresh() }
      next 

*      oBrw:aCols[13]:SetCheck ({"CHECKON","CHECKOFF"},.F.,{"Si","No",""} )
*      oBrw:aCols[14]:SetCheck ({"CHECKON","CHECKOFF"},.F.,{"Si","No",""} )
      oBrw:aCols[13]:SetCheck ( nil,.T.,{"Si","No",""} )
      oBrw:aCols[14]:SetCheck ( nil,.T.,{"Si","No",""} )  
             
      @ 11,460 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 200,12 PIXEL BORDER;
              OF oWChild COLOR CLR_BLACK,CLR_YELLOW PICTURE '@!'
      oWChild:oClient := oBrw 
      
      ACTIVATE WINDOW oWChild MAXIMIZED ;
             ON INIT oBrw:SetFocus();
             VALID( oBarMain:Enable(),oRsClien:Close(),oRsClien := "Nothing",.t. )
    SysRefresh()
    RELEASE FONT oFontCli
       
return( nil )


M贸dulo modificado que si funciona correctamente
Code (fw): Select all Collapse
#Include "Fivewin.ch"
#include 'ord.ch'
#Include "Xbrowse.CH"
#include 'hbcompat.ch'
#Include "ADODEF.CH"

#define ID_ALT      1   // Alta
#define ID_MOD      3   // Modificar

Static oFontCli, oRsClien
*------------------------------------------------------------------------------
function Clientes(oBarMain)
*------------------------------------------------------------------------------
Local oWChild, oBar, oBrw
Local oError
Local aRowGrad,aSelGrad ,aCampos

      oBarMain:Disable()
      oRsClien := FW_OpenRecordSet( oConex, "SELECT * FROM CLIENTES ORDER BY CODIGO", 3 )     
*      If oConex <> nil
*         oRsClien := TOLEAUTO():NEW("ADODB.RecordSet")
*         oRsClien:Activeconnection(oConex)
*         oRsClien:Locktype       := adLockOptimistic
*         oRsClien:CursorType     := adOpenDynamic
*         oRsClien:CursorLocation := adUseClient
*         oRsClien:Source         := "SELECT * FROM CLIENTES ORDER BY CODIGO"
*
*         TRY
*             oRsClien:Open()             
*         CATCH
*             FOR EACH oError IN oCone:Errors
*                 ShowError(oError)
*             NEXT
*         END
*      //--------------------------------------------------------------//
*      Else  
*         MsgStop("No hay conexi贸n con la base de datos","ATENCION")
*         oBarMain:Enable()
*         Return nil
*      EndIf  
      aRowGrad := { { .5, RGB( 232, 241, 252 ), RGB(  232, 241, 252 ) }, ;
                 { .5, RGB( 210, 225, 244 ), RGB(  235, 243, 253 ) } }

      aSelGrad := { { .5, RGB( 255, 255, 251 ), RGB( 255, 237, 178 ) }, ;
                 { .5, RGB( 255, 218, 103 ), RGB( 255, 233, 162 ) } }
     
*      Info(oRsClien)                 
      DEFINE FONT oFontCli NAME "VERDANA" SIZE 0, -11
      DEFINE WINDOW oWChild MDICHILD NOSYSMENU;
             TITLE "Fichero de Clientes" OF oWMain

             SET FONT OF oWChild TO oFontCli

    

      DEFINE BUTTONBAR oBar SIZE 70,60 OF oWChild 2007
      DEFINE BUTTON NAME "Crear" OF oBar ;
             PROMPT "NUEVO";
               ACTION CtrCliente( ID_ALT,oWChild,oBrw) TOOLTIP "Nuevos Clientes"
      DEFINE BUTTON NAME "Editar" OF oBar ;
             PROMPT "EDITAR";      
               ACTION CtrCliente( ID_MOD,oWchild,oBrw ) TOOLTIP "Editar Clientes"
      DEFINE BUTTON NAME "Borrar" OF oBar ;
             PROMPT "BORRAR";      
               ACTION  BorraCliente(oBrw ) TOOLTIP "Borrar Clientes"
      DEFINE BUTTON NAME "Buscar"         ;
             PROMPT "BUSCAR";      
               OF oBar TOOLTIP "Busca un Registro";
               ACTION BuscaTbrw( oRsClien,oBrw,cBusca )
      DEFINE BUTTON NAME "Salir"         ;
             PROMPT "SALIR";      
               OF oBar TOOLTIP "Salir de esta pantalla";
               ACTION oWChild:End() 
    
      oBrw := TXBrowse():New( oWChild ) 
      oBrw:SetAdo( oRsClien, .T.,.T.)
      
      WITH OBJECT oBrw
           :lColDividerComplete := .t. 
           :nMarqueeStyle       := 3
           :nColDividerStyle    := 1
           :nHeaderLines        := 2
           :lFooter             := .t.
           :nStretchCol         := 1
           :bClrSelFocus  := { || { CLR_BLACK, aSelGrad } }
           :bClrRowFocus  := { || { CLR_BLACK, aRowGrad } }  
           :bClrStd       := {|| IIF(oRsClien:AbsolutePosition % 2 == 0,{ CLR_BLACK, RGB( 224, 236, 255 ) }, { CLR_BLACK, RGB( 189, 211, 253 ) } )} 
           :CreateFromCode()  
           :Adjust() 
           :l2007 := .t.
      END
      For nFor := 1 to len( oBrw:aCols ) 
          oCol := oBrw:aCols[ nFor ] 
          oCol:nEditType := 0 
          If oCol:Value = nil
             oCol:cEditPicture := Space(10)
          EndIf   
          oCol:blDClickData := {|| CtrCliente(ID_MOD,oWChild,oBrw),oBrw:Refresh() }
      next 

*      oBrw:aCols[13]:SetCheck ({"CHECKON","CHECKOFF"},.F.,{"Si","No",""} )
*      oBrw:aCols[14]:SetCheck ({"CHECKON","CHECKOFF"},.F.,{"Si","No",""} )
      oBrw:aCols[13]:SetCheck ( nil,.T.,{"Si","No",""} )
      oBrw:aCols[14]:SetCheck ( nil,.T.,{"Si","No",""} )  
             
      @ 11,460 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 200,12 PIXEL BORDER;
              OF oWChild COLOR CLR_BLACK,CLR_YELLOW PICTURE '@!'
      oWChild:oClient := oBrw 
      
      ACTIVATE WINDOW oWChild MAXIMIZED ;
             ON INIT oBrw:SetFocus();
             VALID( oBarMain:Enable(),oRsClien:Close(),oRsClien := "Nothing",.t. )
    SysRefresh()
    RELEASE FONT oFontCli
       
return( nil )


No obstante probar茅 como me indica y le dir茅 si funciona o no.
Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posted: Sun Feb 24, 2013 05:35 PM
No the modified code is not correct.
I posted the same code corrected by me below:
Code (fw): Select all Collapse
#Include "Fivewin.ch"
#include 'ord.ch'
#Include "Xbrowse.CH"
#include 'hbcompat.ch'
#Include "ADODEF.CH"

#define ID_ALT      1   // Alta
#define ID_MOD      3   // Modificar

Static oFontCli, oRsClien
*------------------------------------------------------------------------------
function Clientes(oBarMain)
*------------------------------------------------------------------------------
Local oWChild, oBar, oBrw
Local oError
Local aRowGrad,aSelGrad ,aCampos

      oBarMain:Disable()
      oRsClien := FW_OpenRecordSet( oConex, "SELECT * FROM CLIENTES ORDER BY CODIGO", 3 )     
*      If oConex <> nil
*         oRsClien := TOLEAUTO():NEW("ADODB.RecordSet")
*         oRsClien:Activeconnection(oConex)
*         oRsClien:Locktype       := adLockOptimistic
*         oRsClien:CursorType     := adOpenDynamic
*         oRsClien:CursorLocation := adUseClient
*         oRsClien:Source         := "SELECT * FROM CLIENTES ORDER BY CODIGO"
*
*         TRY
*             oRsClien:Open()             
*         CATCH
*             FOR EACH oError IN oCone:Errors
*                 ShowError(oError)
*             NEXT
*         END
*      //--------------------------------------------------------------//
*      Else  
*         MsgStop("No hay conexi贸n con la base de datos","ATENCION")
*         oBarMain:Enable()
*         Return nil
*      EndIf  
      aRowGrad := { { .5, RGB( 232, 241, 252 ), RGB(  232, 241, 252 ) }, ;
                 { .5, RGB( 210, 225, 244 ), RGB(  235, 243, 253 ) } }

      aSelGrad := { { .5, RGB( 255, 255, 251 ), RGB( 255, 237, 178 ) }, ;
                 { .5, RGB( 255, 218, 103 ), RGB( 255, 233, 162 ) } }
     
*      Info(oRsClien)                 
      DEFINE FONT oFontCli NAME "VERDANA" SIZE 0, -11
      DEFINE WINDOW oWChild MDICHILD NOSYSMENU;
             TITLE "Fichero de Clientes" OF oWMain

             SET FONT OF oWChild TO oFontCli

    

      DEFINE BUTTONBAR oBar SIZE 70,60 OF oWChild 2007
      DEFINE BUTTON NAME "Crear" OF oBar ;
             PROMPT "NUEVO";
               ACTION CtrCliente( ID_ALT,oWChild,oBrw) TOOLTIP "Nuevos Clientes"
      DEFINE BUTTON NAME "Editar" OF oBar ;
             PROMPT "EDITAR";      
               ACTION CtrCliente( ID_MOD,oWchild,oBrw ) TOOLTIP "Editar Clientes"
      DEFINE BUTTON NAME "Borrar" OF oBar ;
             PROMPT "BORRAR";      
               ACTION  BorraCliente(oBrw ) TOOLTIP "Borrar Clientes"
      DEFINE BUTTON NAME "Buscar"         ;
             PROMPT "BUSCAR";      
               OF oBar TOOLTIP "Busca un Registro";
               ACTION BuscaTbrw( oRsClien,oBrw,cBusca )
      DEFINE BUTTON NAME "Salir"         ;
             PROMPT "SALIR";      
               OF oBar TOOLTIP "Salir de esta pantalla";
               ACTION oWChild:End() 
    
      oBrw := TXBrowse():New( oWChild ) 
      oBrw:SetAdo( oRsClien, .T.,.T.)
      
      WITH OBJECT oBrw
           :lColDividerComplete := .t. 
           :nMarqueeStyle       := 3
           :nColDividerStyle    := 1
           :nHeaderLines        := 2
           :lFooter             := .t.
           :nStretchCol         := 1
           :bClrSelFocus  := { || { CLR_BLACK, aSelGrad } }
           :bClrRowFocus  := { || { CLR_BLACK, aRowGrad } }  
           :bClrStd       := {|| IIF(oRsClien:AbsolutePosition % 2 == 0,{ CLR_BLACK, RGB( 224, 236, 255 ) }, { CLR_BLACK, RGB( 189, 211, 253 ) } )} 
//           :CreateFromCode()  // commented out by G.N.Rao
//           :Adjust()          // commented out by G.N.Rao
           :l2007 := .t.
      END
      For nFor := 1 to len( oBrw:aCols ) 
          oCol := oBrw:aCols[ nFor ] 
          oCol:nEditType := 0 
          If oCol:Value = nil
             oCol:cEditPicture := Space(10)
          EndIf   
          oCol:blDClickData := {|| CtrCliente(ID_MOD,oWChild,oBrw),oBrw:Refresh() }
      next 

*      oBrw:aCols[13]:SetCheck ({"CHECKON","CHECKOFF"},.F.,{"Si","No",""} )
*      oBrw:aCols[14]:SetCheck ({"CHECKON","CHECKOFF"},.F.,{"Si","No",""} )
      oBrw:aCols[13]:SetCheck ( nil,.T.,{"Si","No",""} )
      oBrw:aCols[14]:SetCheck ( nil,.T.,{"Si","No",""} )  
             
      @ 11,460 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 200,12 PIXEL BORDER;
              OF oWChild COLOR CLR_BLACK,CLR_YELLOW PICTURE '@!'

      oBrw:CreateFromCode()      // INSERTED BY G.N.RAO
      oWChild:oClient := oBrw 
      
      ACTIVATE WINDOW oWChild MAXIMIZED ;
             ON INIT oBrw:SetFocus();
             VALID( oBarMain:Enable(),oRsClien:Close(),oRsClien := "Nothing",.t. )
    SysRefresh()
    RELEASE FONT oFontCli
       
return( nil )

Please use the code corrected as above.
Regards



G. N. Rao.

Hyderabad, India
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posted: Sun Feb 24, 2013 05:48 PM

Pedro,

Me pide Rao que traduzca estos puntos:

> 1) He should not call oBrw:Adjust() from application code.

No debes llamar oBrw:Adjust() desde tu c贸digo

> 2) oBrw:CreateFromCode() should be the last call.

Esta llamada debe hacerse la 煤ltima de todas. Es importante.

> After this he should not deal with any columns' data/methods.

Una vez llamado a CreateFromCode() ya no tienes que definir las columnas pues han tenido que ser definidas previamente

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
Re: TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posted: Mon Feb 25, 2013 11:24 AM

Gracias Antonio lo hab铆a entendido as铆.

Tan s贸lo una pregunta, 驴por qu茅 la llamada a bSeek solo hace caso al bloque de c贸digo de la clase y no a la que el programador le indique?
驴Es por la clase en si?, 驴por el compilador (uso xHarbour) ?

Por lo dem谩s ya he corregido los m贸dulos y est谩n funcionando bien.

Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TXBROWSE para Antonio Linares o Daniel Gil (SOLUCIONADO)
Posted: Mon Feb 25, 2013 12:08 PM
Tan s贸lo una pregunta, 驴por qu茅 la llamada a bSeek solo hace caso al bloque de c贸digo de la clase y no a la que el programador le indique?
驴Es por la clase en si?, 驴por el compilador (uso xHarbour) ?


Correct bSeek codeblock is internally generated by XBrowse. It is better to leave this unchanged.
Example showing how to use bSeek and how to show the user entered cSeek in the dialog is posted here:
viewtopic.php?f=6&t=25675

You can compile and build this sample and test at your end.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion