Página 1 de 1

HBMYSQL erro Base/1004 HB_SETKey

Enviado: 17 Mai 2014 20:45
por fladimir
Senhores, observem o código abaixo...

Se crio um PRG de testes e compilo hbmk2 TesteMySQL.prg -lHBMYSQL -lLIBMYSQL

Executa perfeitamente, porém ao incorporar o código abaixo ao meu sistema, onde troquei o nome da função de MAIN para TESTEMYSQL, apresenta um erro abaixo:

Erro BASE/1004
Rotina TesteMySQL
Linha X ( no caso aki do fórum ficou na linha 62 esta comentada)
Variável/Função HB_SETKEY

Não sei o q pode ser.
Pensei q poderia ser o fato de eu Linkar várias LIBS e talvez alguma esteja conflitando com a da Contrib do MySQL... (Abaixo vou colocar as libs q estou utilizando)

Código: Selecionar todos

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

PROCEDURE MAIN( nSeq )
	LOCAL oQuery, oQuery2, oRow, aStru, aTabelas := {}, ;
			cBaseDados := 'baseteste'                    , ;
			cTabela    := 'myTable'

	PUBLIC oServer
	PUBLIC oTable

   *****************************************************************************
   * Configurar pagina de codigo apropriada para cada sistema operacional       *
   * Nota : As requisicoes de codepage possibilitam trabalhar com varios SOs   *
   *        e charsets pt_br ou seja, corrigem a acentuacao.                   *
   *        Para paginas de codigo usar PT850 ou PTISO conforme o config do SO *
   *****************************************************************************
   REQUEST HB_CODEPAGE_PTISO
   REQUEST HB_CODEPAGE_PT850
   Hb_LangSelect("PT")
   Hb_CdpSelect("PT850")

   SET CENTURY ON
   SET EPOCH TO 1960

   CLS
	
   *-- Estabelece a conexao com o servidor              
 	IF ConectaBD()
	   * Seleciona o banco de dados                   *
	   oServer:SelectDB( cBaseDados )
	   IF oServer:NetErr()
	      Alert( oServer:Error() )
	      oServer:Destroy()
	      RETURN
	   ENDIF
	 
	   //--> Testando se a tabela existe na base de dados          
	   aTabelas := oServer:ListTables()
	   IF ! Ascan( aTabelas, cTabela) > 0
	      Alert( 'A tabela '+cTabela+' nao existe nesta base de dados' )
	      oServer:Destroy()
	      RETURN
	   ENDIF
	ENDIF
	
	*******************************************************************
	* Selecionando dados da tabela                  *
	*******************************************************************
	oTable := oServer:Query('SELECT * from myTable')
	IF oTable:NetErr()
		IF Alert( oTable:Error(),{'Continua','Sai'} )!=1
			oServer:Destroy()
			QUIT
		ENDIF   
	ENDIF

	? ' Navegando pelos dados da tabela                                 '

	oB := TBrowseSQL():New( 03, 01, 20, 79, oServer, oTable )      //--> Define o Objeto Tbrowse baseado na tabela SQL
 
      //--> Linha onde ocorre o problema
       oB:SetKey( K_CTRL_V, { |oB, nKey | DefProc( oB, nKey, cTabela ) } ) //--> Define a tecla o q faz
 
	WHILE .T.
		oB:ForceStable()
		IF ( oB:ApplyKey( Inkey( 0 ) ) == - 1 )
			EXIT
		ENDIF
	END

	*******************************************************************
	* Fechando a conexao                       *
	*******************************************************************
	oTable:Destroy()
	oServer:Destroy()
RETURN

//---------------------------------------------------
FUNCTION DefProc( ob, k, ctable )
  LOCAL op := ' '
  LOCAL orecord
  LOCAL aFDatas := Array( 6 )
  LOCAL cScreen := SaveScreen()
  LOCAL n
  
  cls
  SetColor( 'W/B,W/B+,W/R,B/W' )
  Dispbox( 00, 00, MaxRow(), MaxCol() )
  oRecord := oB:oQuery:GetBlankRow()
  for n := 1 to 6
   ? oRecord:FieldType(n)
   if oRecord:FieldType(n) = 'N'
     Afill( afDatas,0,n,1 )
   elseif oRecord:FieldType(n) = 'C'                 
     Afill( afDatas,Space(oRecord:FieldLen(n)),n,1 )
   elseif oRecord:FieldType(n) = 'U'
     Afill( afDatas,CtoD('//'),n,1 )
   endif
  next
                     
  @ 02,02 SAY 'CODIGO'   GET afdatas[ 1 ]
  @ 03,02 SAY 'NOME'     GET afdatas[ 2 ]
  @ 04,02 SAY 'DDD'      GET afdatas[ 3 ]
  @ 05,02 SAY 'TELEFONE' GET afdatas[ 4 ]
  @ 06,02 SAY 'E_MAIL'   GET afdatas[ 5 ]
  @ 07,02 SAY 'DATA'     GET afdatas[ 6 ]
  READ

  @ 23,02 SAY 'Salva (S/N)?' GET op PICT "!"
  READ

  if op == "S"                             
   // oRecord := oB:oQuery:GetBlankRow()
   for n := 1 to 5
     oRecord:FieldPut( n, afdatas[ n ] )
   next
   oRecord:FieldPut( 6, Date() )
   oTable:Append( oRecord )
   if oTable:NetErr()
     Alert( oTable:Error() )
   endif
  endif
  RestScreen( ,,,, cScreen )
  oTable:Refresh()
  ob:RefresHall()
return( nil )

LIBS q estou linkando junto com minha APP onde ocorre o erro ao tentar inserir o código acima:

Código: Selecionar todos

-lhbxpp
-lhbct
-lhbtip
-lhbwin
-lxhb
-lhbhpdf
-lhbcomm
-llibmysql
-lhbmysql
-ld:\dev\harbour\examples\gtwvw\lib\win\msvc\gtwvw
-lhwgui
-lprocmisc
-lhwg_qhtm

HBMYSQL erro Base/1004 HB_SETKey

Enviado: 20 Mai 2014 12:07
por Kapiaba
Ola, modifique isto e reporte o que acontece:

Código: Selecionar todos

  //for n := 1 to 6  // erro
  for n = 1 to 6

     ? oRecord:FieldType(n)

     if oRecord:FieldType(n) = 'N'
        Afill( afDatas,0,n,1 )
     elseif oRecord:FieldType(n) = 'C'
        Afill( afDatas,Space(oRecord:FieldLen(n)),n,1 )
     elseif oRecord:FieldType(n) = 'U'
        Afill( afDatas,CtoD('//'),n,1 )
     endif

  next

  if op == "S"                             
   // oRecord := oB:oQuery:GetBlankRow()

     //for n := 1 to 5  // erro
     for n = 1 to 5

       oRecord:FieldPut( n, afdatas[ n ] )

     next

     oRecord:FieldPut( 6, Date() )
     oTable:Append( oRecord )

     if oTable:NetErr()
        Alert( oTable:Error() )
     endif

  endif
Voce definiu o Inkey.ch no inicio do módulo?

http://ftp.pimenta.com/utils/missing/cl ... u/inkey.ch

abs,

HBMYSQL erro Base/1004 HB_SETKey

Enviado: 20 Mai 2014 12:52
por alxsts
Olá!

Error Base/1004 significa "No exported method".
fladimir escreveu:oB:SetKey( K_CTRL_V, { |oB, nKey | DefProc( oB, nKey, cTabela ) } ) //--> Define a tecla o q faz
Não conheço esta classe TBrowseSQL(). Será que ela tem este método setKey()?

HBMYSQL erro Base/1004 HB_SETKey

Enviado: 21 Mai 2014 09:43
por Kapiaba

HBMYSQL erro Base/1004 HB_SETKey

Enviado: 21 Mai 2014 13:59
por alxsts
Olá!

Este link mostra o fonte da função SetKey() mas não é este o problema.

Note que no código postado, :setKey() está sendo usado como um método da classe TBrowseSQL(). Como não conheço esta classe, não sei se ela exporta este método. Pela mensagem de erro apresentada, o método não existe na classe.

HBMYSQL erro Base/1004 HB_SETKey

Enviado: 21 Mai 2014 15:24
por Kapiaba
Ok, obg.

Pensei que OB:SetKey... você um objeto.

Abs

HBMYSQL erro Base/1004 HB_SETKey

Enviado: 22 Mai 2014 09:21
por fladimir
Kapiaba, obrigado pela dica do FOR, mas não deu certo.

Alx, esta classe TBrowseSQL faz parte da contrib HBMYSQL do Harbour e olhando não encontrei o método, MAS o interessante é que se eu abro um PRG isolado e coloco o código e compilo sem estar integrado a minha App, FUNCIONA 100%, acabei por não entender o q esta ocorrendo.

Segue abaixo o código:

Código: Selecionar todos

/*
 * $Id: tsqlbrw.prg 14688 2010-06-04 13:32:23Z vszakats $
 */

/*
 * Harbour Project source code:
 * MySQL TBrowse
 * A TBrowse on a MySQL Table / query
 *
 * Copyright 2000 Maurilio Longo <maurilio.longo@libero.it>
 * www - http://harbour-project.org
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
 *
 * As a special exception, the Harbour Project gives permission for
 * additional uses of the text contained in its release of Harbour.
 *
 * The exception is that, if you link the Harbour libraries with other
 * files to produce an executable, this does not by itself cause the
 * resulting executable to be covered by the GNU General Public License.
 * Your use of that executable is in no way restricted on account of
 * linking the Harbour library code into it.
 *
 * This exception does not however invalidate any other reasons why
 * the executable file might be covered by the GNU General Public License.
 *
 * This exception applies only to the code released by the Harbour
 * Project under the name Harbour.  If you copy code from other
 * Harbour Project or Free Software Foundation releases into a copy of
 * Harbour, as the General Public License permits, the exception does
 * not apply to the code that you add in this way.  To avoid misleading
 * anyone as to the status of such modified files, you must delete
 * this exception notice from them.
 *
 * If you write modifications of your own for Harbour, it is your choice
 * whether to permit this exception to apply to your modifications.
 * If you do not wish that, delete this exception notice.
 *
 */

#include "hbclass.ch"

#include "common.ch"
#include "inkey.ch"
#include "dbstruct.ch"

#include "mysql.ch"

/* NOTE:

   In fact no, the 'regular syntax is the same as the VO one,

   ACCESS Block METHOD Block()
   or
   ACCESS Block INLINE ::MyVal

   and

   ASSIGN Block( x ) METHOD Block( x )
   or
   ASSIGN Block( x ) INLINE ::MyVal := x

*/


CREATE CLASS TBColumnSQL FROM TBColumn

   VAR   oBrw                 // pointer to Browser containing this column, needed to be able to
                              // retreive field values from Browse instance variable oCurRow
// VAR   Picture              // From clipper 5.3
   VAR   nFieldNum            // This column maps field num from query

   MESSAGE  Block METHOD Block()          // When evaluating code block to get data from source this method
                                          // gets called. I need this since inside TBColumn Block I cannot
                                          // reference Column or Browser instance variables

   METHOD   New( cHeading, bBlock, oBrw )   // Saves inside column a copy of container browser

ENDCLASS


METHOD New( cHeading, bBlock, oBrw ) CLASS TBColumnSQL

   super:New( cHeading, bBlock )
   ::oBrw := oBrw

   RETURN Self


METHOD Block() CLASS TBColumnSQL

   LOCAL xValue := ::oBrw:oCurRow:FieldGet( ::nFieldNum )
   LOCAL xType := ::oBrw:oCurRow:FieldType( ::nFieldNum )

   DO CASE
   CASE xType == "N"
      xValue := "'" + Str( xValue, ::oBrw:oCurRow:FieldLen( ::nFieldNum ), ::oBrw:oCurRow:FieldDec( ::nFieldNum ) ) + "'"

   CASE xType == "D"
      xValue :=  "'" + DToC( xValue ) + "'"

   CASE xType == "L"
      xValue := iif( xValue, ".T.", ".F." )

   CASE xType == "C"
      // Chr(34) is a double quote
      // That is: if there is a double quote inside text substitute it with a string
      // which gets converted back to a double quote by macro operator. If not it would
      // give an error because of unbalanced double quotes.
      xValue := Chr( 34 ) + StrTran( xValue, Chr( 34 ), Chr( 34 ) + "+Chr(34)+" + Chr( 34 ) ) + Chr( 34 )

   CASE xType == "M"
      xValue := "' <MEMO> '"

   OTHERWISE
      xValue := "'" + xValue + "'"
   ENDCASE

   RETURN hb_macroBlock( xValue )


/*--------------------------------------------------------------------------------------------------*/


/*
   This class is more or less like a TBrowseDB() object in that it receives an oQuery/oTable
   object and gives back a browseable view of it
*/
CREATE CLASS TBrowseSQL FROM TBrowse

   VAR      oCurRow                       // Active row inside table / sql query
   VAR      oQuery                        // Query / table object which we are browsing

   METHOD   New( nTop, nLeft, nBottom, nRight, oServer, oQuery, cTable )

   METHOD   EditField()                   // Editing of hilighted field, after editing does an update of
                                          // corresponding row inside table

   METHOD   BrowseTable( lCanEdit, aExitKeys ) // Handles standard moving inside table and if lCanEdit == .T.
                                               // allows editing of field. It is the stock ApplyKey() moved inside a table
                                               // if lCanEdit K_DEL deletes current row
                                               // When a key is pressed which is present inside aExitKeys it leaves editing loop

   METHOD   KeyboardHook( nKey )               // Where do all unknown keys go?

ENDCLASS


METHOD New( nTop, nLeft, nBottom, nRight, oServer, oQuery, cTable ) CLASS TBrowseSQL

   LOCAL i, oCol

   HB_SYMBOL_UNUSED( oServer )
   HB_SYMBOL_UNUSED( cTable )

   super:New( nTop, nLeft, nBottom, nRight )

   ::oQuery := oQuery

   // Let's get a row to build needed columns
   ::oCurRow := ::oQuery:GetRow( 1 )

   // positioning blocks
   ::SkipBlock := {| n | ::oCurRow := Skipper( @n, ::oQuery ), n }
   ::GoBottomBlock := {|| ::oCurRow := ::oQuery:GetRow( ::oQuery:LastRec() ), 1 }
   ::GoTopBlock := {|| ::oCurRow := ::oQuery:GetRow( 1 ), 1 }

   // Add a column for each field
   FOR i := 1 TO ::oQuery:FCount()

      // No bBlock now since New() would use it to find column length, but column is not ready yet at this point
      oCol := TBColumnSQL():New( ::oCurRow:FieldName( i ),, Self )

      IF !( ::oCurRow:FieldType( i ) == "M" )
         oCol:Width := Max( ::oCurRow:FieldLen( i ), Len( oCol:Heading ) )
      ELSE
         oCol:Width := 10
      ENDIF

      // which field does this column display
      oCol:nFieldNum := i

      // Add a picture
      DO CASE
      CASE ::oCurRow:FieldType( i ) == "N"
         oCol:picture := Replicate( "9", oCol:Width )

      CASE ::oCurRow:FieldType( i ) $ "CM"
         oCol:picture := Replicate( "!", oCol:Width )
      ENDCASE

      ::AddColumn( oCol )
   NEXT

   RETURN Self

STATIC FUNCTION Skipper( nSkip, oQuery )

   LOCAL i := 0

   DO CASE
   CASE nSkip == 0 .OR. oQuery:LastRec() == 0
      oQuery:Skip( 0 )

   CASE nSkip > 0
      DO WHILE i < nSkip           // Skip Foward

         //DAVID: change in TMySQLquery:eof() definition  if oQuery:eof()
         IF oQuery:recno() == oQuery:lastrec()
            EXIT
         ENDIF
         oQuery:Skip( 1 )
         i++

      ENDDO

   CASE nSkip < 0
      DO WHILE i > nSkip           // Skip backward

         //DAVID: change in TMySQLquery:bof() definition  if oQuery:bof()
         IF oQuery:recno() == 1
            EXIT
         ENDIF

         oQuery:Skip( -1 )
         i--

      ENDDO
   ENDCASE

   nSkip := i

   RETURN oQuery:GetRow( oQuery:RecNo() )


METHOD EditField() CLASS TBrowseSQL

   LOCAL oCol
   LOCAL aGetList
   LOCAL nKey
   LOCAL cMemoBuff, cMemo

   // Get the current column object from the browse
   oCol := ::getColumn( ::colPos )

   // Editing of a memo field requires a MemoEdit() window
   IF ::oCurRow:FieldType( oCol:nFieldNum ) == "M"

      /* save, clear, and frame window for memoedit */
      cMemoBuff := SaveScreen( 10, 10, 22, 69 )

      hb_Scroll( 10, 10, 22, 69, 0 )
      hb_DispBox( 10, 10, 22, 69 )

      /* use fieldspec for title */
      //@ 10, ( ( 76 - Len( ::oCurRow:FieldName( oCol:nFieldNum ) ) / 2 ) SAY "  " + ( ::oCurRow:FieldName( oCol:nFieldNum ) ) + "  "

      /* edit the memo field */
      cMemo := MemoEdit( ::oCurRow:FieldGet( oCol:nFieldNum ), 11, 11, 21, 68, .T. )

      IF Lastkey() == K_CTRL_END
         ::oCurRow:FieldPut( oCol:nFieldNum, cMemo )

         /* NOTE: To do in a better way */
         IF !::oQuery:Update( ::oCurRow )
            Alert( Left( ::oQuery:Error(), 60 ) )
         ENDIF
      ENDIF

      RestScreen( 10, 10, 22, 69, cMemoBuff )

   ELSE
      // Create a corresponding GET
      // NOTE: I need to use ::oCurRow:FieldPut(...) when changing values since message redirection doesn't work at present
      //       time for write access to instance variables but only for reading them
      aGetList := { GetNew( Row(), Col(),;
                            {| xValue | iif( xValue == NIL, Eval( oCol:Block ), ::oCurRow:FieldPut( oCol:nFieldNum, xValue ) ) },;
                            oCol:heading,;
                            oCol:picture,;
                            ::colorSpec ) }

      // Set initial cursor shape
      // SetCursor( iif( ReadInsert(), SC_INSERT, SC_NORMAL ) )
      ReadModal( aGetList )
      // SetCursor( SC_NONE )

      /* NOTE: To do in a better way */
      IF ! ::oQuery:Update( ::oCurRow )
         Alert( Left( ::oQuery:Error(), 60 ) )
      ENDIF

   endif

   IF !::oQuery:Refresh()
      Alert( ::oQuery:Error() )
   ENDIF

   ::RefreshAll()

   // Check exit key from get
   nKey := LastKey()
   IF nKey == K_UP   .OR. nKey == K_DOWN .OR. ;
      nKey == K_PGUP .OR. nKey == K_PGDN

      // Ugh
      KEYBOARD( Chr( nKey ) )

   ENDIF

   RETURN Self


METHOD BrowseTable( lCanEdit, aExitKeys ) CLASS TBrowseSQL

   LOCAL nKey
   LOCAL lKeepGoing := .T.

   IF ! ISNUMBER( nKey )
      nKey := NIL
   ENDIF
   IF ! ISLOGICAL( lCanEdit )
      lCanEdit := .F.
   ENDIF
   IF ! ISARRAY( aExitKeys )
      aExitKeys := { K_ESC }
   ENDIF

   DO WHILE lKeepGoing

      DO WHILE !::Stabilize() .AND. NextKey() == 0
      ENDDO

      nKey := Inkey( 0 )

      IF AScan( aExitKeys, nKey ) > 0
         lKeepGoing := .F.
         LOOP
      ENDIF

      DO CASE
      CASE nKey == K_DOWN
         ::down()

      CASE nKey == K_PGDN
         ::pageDown()

      CASE nKey == K_CTRL_PGDN
         ::goBottom()

      CASE nKey == K_UP
         ::up()

      CASE nKey == K_PGUP
         ::pageUp()

      CASE nKey == K_CTRL_PGUP
         ::goTop()

      CASE nKey == K_RIGHT
         ::right()

      CASE nKey == K_LEFT
         ::left()

      CASE nKey == K_HOME
         ::home()

      CASE nKey == K_END
         ::end()

      CASE nKey == K_CTRL_LEFT
         ::panLeft()

      CASE nKey == K_CTRL_RIGHT
         ::panRight()

      CASE nKey == K_CTRL_HOME
         ::panHome()

      CASE nKey == K_CTRL_END
         ::panEnd()

      CASE nKey == K_RETURN .AND. lCanEdit
         ::EditField()

#if 0
      CASE nKey == K_DEL
         IF lCanEdit
            IF ! ::oQuery:Delete( ::oCurRow )
               Alert( "not deleted " + ::oQuery:Error() )
            ENDIF
            IF !::oQuery:Refresh()
               Alert( ::oQuery:Error() )
            ENDIF

            ::inValidate()
            ::refreshAll():forceStable()
         ENDIF
#endif

      OTHERWISE
         ::KeyboardHook( nKey )
      ENDCASE
   ENDDO

   RETURN Self

// Empty method to be subclassed
METHOD KeyboardHook( nKey ) CLASS TBrowseSQL

   HB_SYMBOL_UNUSED( nKey )

   RETURN Self

HBMYSQL erro Base/1004 HB_SETKey

Enviado: 22 Mai 2014 10:06
por Kapiaba
Olá, veja este exemplo se te ajuda:

Código: Selecionar todos

/*
 * $Id: testbrw.prg,v 1.2 2003/11/12 12:58:45 andijahja Exp $
 */

// Harbour Class TBrowse and TBColumn sample

#include "inkey.ch"

function Main()

   local linit   := .F., i
   local oBrowse := TBrowseNew( 5, 5, 16, 30 )
   local aTest0  := { "This", "is", "a", "browse", "on", "an", "array", "test", "with", "a", "long", "data" }
   local aTest1  := { 1, 2, 3, 4, 5, 6, 7, 8, 10000, -1000, 54, 456342 }
   local aTest2  := { date(), date()+4, date()+56, date()+14, date()+5, date()+6, date()+7, date()+8, date()+10000, date()-1000, date()-54, date()+456342 }
   local aTest3  := { .t., .f., .t., .t., .f., .f., .t., .f., .t., .t., .f., .f. }
   local n       := 1
   local nKey
   local lEnd    := .f.
   local nCursor
   local cColor
   local nRow, nCol
   local nTmpRow, nTmpCol

   oBrowse:colorSpec     = "W+/B, N/BG"
   oBrowse:ColSep        = "³"
   oBrowse:HeadSep        = "ÑÍ"
   oBrowse:FootSep        = "ÏÍ"
   oBrowse:GoTopBlock    = { || n := 1 }
   oBrowse:GoBottomBlock = { || n := Len( aTest0 ) }
   oBrowse:SkipBlock     = { | nSkip, nPos | nPos := n,;
                             n := If( nSkip > 0, Min( Len( aTest0 ), n + nSkip ),;
                             Max( 1, n + nSkip )), n - nPos }

   oBrowse:AddColumn( TBColumnNew( "First",  { || n } ) )
   oBrowse:AddColumn( TBColumnNew( "Second", { || aTest0[ n ] } ) )
   oBrowse:AddColumn( TBColumnNew( "Third",  { || aTest1[ n ] } ) )
   oBrowse:AddColumn( TBColumnNew( "Forth",  { || aTest2[ n ] } ) )
   oBrowse:AddColumn( TBColumnNew( "Fifth",  { || aTest3[ n ] } ) )
   oBrowse:GetColumn(1):Footing = 'Number'
   oBrowse:GetColumn(2):Footing = 'Strins'

   oBrowse:GetColumn(2):Picture := '@!'

   oBrowse:GetColumn(3):Footing = 'Number'
   oBrowse:GetColumn(3):Picture := '999,999.99'
   oBrowse:GetColumn(4):Footing = 'Dates'
   oBrowse:GetColumn(5):Footing = 'Logical'
   // needed since I've changed some columns _after_ I've added them to TBrowse object
   oBrowse:Configure()

   Alert( oBrowse:ClassName() )
   Alert( oBrowse:GetColumn( 1 ):ClassName() )

   oBrowse:RowPos = 5
   oBrowse:Freeze = 1
   nCursor := SetCursor( 0 )
   cColor := SetColor( "W+/B" )
   nRow := Row()
   nCol := Col()
   @ 4,4,17,31 BOX "ÚÄ¿³ÙÄÀ³ "
#ifdef HB_COMPAT_C53

 oBrowse:Setkey(0,{|ob,nkey| Defproc(ob,nKey)})  // aqui

 // Veja neste exemplo, OB, nao inicia antes do SetKey
 //oB:SetKey( K_CTRL_V, { |oB, nKey | DefProc( oB, nKey, cTabela ) } ) // como você fez.

while .t.
    oBrowse:ForceStable()
 if (oBrowse:applykey(inkey(0))== -1)
   exit
endif
enddo
#else
While !lEnd
      dispbegin()
      oBrowse:ForceStable()
      dispend()
      nKey = InKey( 0 )

      do case
         case nKey == K_ESC
              SetPos( 17, 0 )
              lEnd = .t.

         case nKey == K_DOWN
              oBrowse:Down()

         case nKey == K_UP
              oBrowse:Up()

         case nKey == K_LEFT
              oBrowse:Left()

         case nKey == K_RIGHT
              oBrowse:Right()

         case nKey = K_PGDN
              oBrowse:pageDown()

         case nKey = K_PGUP
              oBrowse:pageUp()

         case nKey = K_CTRL_PGUP
              oBrowse:goTop()

         case nKey = K_CTRL_PGDN
              oBrowse:goBottom()

         case nKey = K_HOME
              oBrowse:home()

         case nKey = K_END
              oBrowse:end()

         case nKey = K_CTRL_LEFT
              oBrowse:panLeft()

         case nKey = K_CTRL_RIGHT
              oBrowse:panRight()

         case nKey = K_CTRL_HOME
              oBrowse:panHome()

         case nKey = K_CTRL_END
              oBrowse:panEnd()

         case nKey = K_TAB
              nTmpRow := ROW()
              nTmpCol := COL()
              @ 0, 0 SAY TIME()
              DevPos( nTmpRow, nTmpCol )

      endcase

   end
#endif
   DevPos( nRow, nCol )
   SetColor( cColor )
   SetCursor( nCursor )

return nil
#ifdef HB_COMPAT_C53
function  defproc(ob,nkey)
Local nTmpRow,nTmpCol
        if nKey = K_TAB
              nTmpRow := ROW()
              nTmpCol := COL()
              @ 0, 0 SAY TIME()
              DevPos( nTmpRow, nTmpCol )
            ob:Refreshall()
        endif
        return 1
#endif

HBMYSQL erro Base/1004 HB_SETKey

Enviado: 22 Mai 2014 11:30
por fladimir
Kapiaba eu tenho esse exemplo e foi a partir dele q fiz o meu, mas pra ter certeza abri um novo PRG e coloquei o exemplo q vc postou, compilei, e rodando ISOLADO FUNCIONA 100%, porém se copio o código e coloco na minha aplicação e troco de Main por TESTE por exemplo pra não conflitar com minha aplicação principal, ao chamar a função TESTE q é a q estamos falando da o mesmo problema...

Eu acredito q seja conflito de LIB.

Pra ter certeza, vou fazer o seguinte, veja se vc entende minha idéia e se acha q pode dar certo, pretendo pegar este exemplo q funciona 100% isoladamente, e ir adicionando as libs q eu uso na minha aplicação mas 1 a 1 e ir testando se funciona ou se dará problema, ai se der problema, teremos a certeza do q se trata e qual lib estaria, supostamente, afetando, ai a partir disto continuamos a conversa mais com uma direção do q esta afetando e quais soluções poderiam ser adotadas.

HBMYSQL erro Base/1004 HB_SETKey

Enviado: 22 Mai 2014 12:09
por Kapiaba
Estranho fladimir, seu MENU PRINCIPAL, Inicia com FUNCTION MAIN()??

Faça um teste por fora do seu programa:

Crie um .exe do exemplo, e chame através do seu MENU PRINCIPAL, com o comando RUN..

Veja se ele quebra...

Excelente idéia isolar as LIBs, veja se não tem alguma de TERCEIROS, que possa estar provocando a quebra.

abs,