Alaska Software Inc. - [ES] Changing the highlight color of an XbpQuickBrowse object
Username: Password:
AuthorTopic: [ES] Changing the highlight color of an XbpQuickBrowse object
Jose Luis Otermin [Alaska Software][ES] Changing the highlight color of an XbpQuickBrowse object
on Thu, 26 Jan 2006 19:58:46 -0300
Cmo cambiar el color de la celda que es visitada por el cursor
(resaltada)?

Para hacerlo, deben utilizarse los correspondientes #define mediante el
mtodo :setPresParam() cada vez que el color vaya a ser modificado.
El siguiente ejemplo demuestra esta tarea siempre que el browser pierda el
foco y cada vez que el foco sea dado al objeto.

Note que se requiere la tabla de datos "CUSTOMER.DBF" para ejecutar el
ejemplo.

____________________ CDIGO DE EJEMPLO ___________________________

#include "Appevent.ch"
#include "xbp.ch"
#include "gra.ch"

#pragma Library( "XppUi2.lib" )
#pragma Library( "Adac20b.lib" )

CLASS MyBrowse FROM XbpQuickBrowse
   PROTECTED
     VAR    aHighFocus
     VAR    aHighNoFocus
     METHOD setHighFocus
     METHOD setHighNoFocus
   EXPORTED
     METHOD init
     METHOD create
     METHOD setInputFocus
     METHOD killInputFocus
ENDCLASS

METHOD MyBrowse:init( oP, oO, aPos, aSize, aPP, lV )
   ::aHighFocus := {}
   ::aHighNoFocus := {}
   AAdd( ::aHighFocus, {XBP_PP_HILITE_FGCLR, GRA_CLR_RED      } )
   AAdd( ::aHighFocus, {XBP_PP_HILITE_BGCLR, GRA_CLR_YELLOW   } )
   AAdd( ::aHighNoFocus, {XBP_PP_HILITE_FGCLR, GRA_CLR_YELLOW } )
   AAdd( ::aHighNoFocus, {XBP_PP_HILITE_BGCLR, GRA_CLR_RED    } )
   ::XbpQuickBrowse:init( oP, oO, aPos, aSize, aPP, lV )
RETURN self

METHOD MyBrowse:create()
   ::XbpQuickBrowse:create()
   ::setHighFocus()
RETURN self

METHOD MyBrowse:setHighFocus()
   ::dataArea:setPresParam( ::aHighFocus )
RETURN self

METHOD MyBrowse:setHighNoFocus()
   ::dataArea:setPresParam( ::aHighNoFocus )
RETURN self

METHOD MyBrowse:setInputFocus()
   ::setHighFocus()
   ::XbpQuickBrowse:setInputFocus()
RETURN self

METHOD MyBrowse:killInputFocus()
   ::setHighNoFocus()
   ::XbpQuickBrowse:killInputFocus()
RETURN self

PROCEDURE Main
   LOCAL nEvent, mp1, mp2, oXbp, app := {}

   mp1    := NIL
   mp2    := NIL
   oXbp   := NIL
   nEvent := NIL

   USE Customer NEW

    {640,400} ES el tamao PREDETERMINADO de la pantalla
    area dentro de una ventana XbpCrt
   oXbp := MyBrowse():new(,,, {640,400}, app )

    Asignar el objeto almacn de datos
   oXbp:dataLink := DacPagedDataStore():new()

   Requerir recursos del sistema para el browser
   luego de asignar el objeto almacn de datos.
   oXbp:create()

    Dar foco al objeto browser
   SetAppFocus( oXbp )

    Ejecutar el ciclo de eventos.
   DO WHILE nEvent <> xbeP_Close
      nEvent := AppEvent( @mp1, @mp2, @oXbp )
      oXbp:handleEvent( nEvent, mp1, mp2 )
   ENDDO

RETURN



Best regards,
   Andreas Herdt
   Alaska Software

--------------------------------------------------------------------
Technical Support:        support@alaska-software.com
News Server:              news.alaska-software.com
Homepage:                 http://www.alaska-software.com
WebKnowledgeBase:         http://www.alaska-software.com/kbase.shtm
European Office:          Fax: +49 (0) 61 96 - 77 99 99 23
US Office:                Fax: +1 (646) 218 1281
--------------------------------------------------------------------