Page 1 of 1

WHEN( .F. ) EN GET USANDO FIVEWIN FOR XHARBOUR

Posted: Tue Dec 20, 2005 7:39 pm
by karinha
WHEN( .F. ) EN FIVEWIN FOR XHARBOUR VERSION 2.7

PERSONAS, NECESITO HELP, COMO HACER PARA KE EL FOCO DEL GET EN UN WHEN( .F. ) FIKE CON COLOR COMO EN EL FIVEWIN 16 BITS??

REDEFINE GET aGet[1] VAR XCGC PICTURE "@K 999.999.999-99" ;
WHEN( .F. ) ;
ID 20 OF oFld:aDialogs[ 1 ] ;
FONT oFont UPDATE ;
COLOR CLR_HRED, CLR_HCYAN ;
CURSOR oHand


ASI, FICA CON ASPECTO(APARIENCIA) DI 'MUERTO/DESHABILITADO', SIN COLOR.

GRACIAS A TODOS. SALUDOS.

Posted: Tue Dec 20, 2005 8:14 pm
by Antonio Linares
João,

Prueba este cambio en la clase TGet:

Code: Select all

METHOD Paint() CLASS TGet
   ...
   local hOldFont

   ...
   
   if IsWindowEnabled( ::hWnd )
      CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )
   else
      SetTextColor( ::hDC, ::nClrText )
      SetBkColor( ::hDC, ::nClrPane )
      hOldFont = SelectObject( ::hDC, ::oFont:hFont )
      ExtTextOut( ::hDC, 0, 0,;
                  { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
      SelectObject( ::hDC, hOldFont )            
   endif                
   ...

Posted: Tue Dec 20, 2005 9:31 pm
by karinha
Gracias Antonio por tu ayuda.

Cuasi perfecto, solamente um problema, no esta respectando o comando: CENTER, RIGHT O LEFT del WorkSop.exe ke hacer??

Todo o contenido del GET, fica a la Iskierda de GET.

hice asi, esta correcto?

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

METHOD Paint() CLASS TGet

local aInfo := ::DispBegin()

// Mudanca(Cambio) enviada(o) por Antonio Linares en 20/12/2005
local hOldFont

if ::oBrush != nil
FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
else
CallWindowProc( ::nOldProc, ::hWnd, WM_ERASEBKGND, ::hDC, 0 )
endif

CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )

if ValType( ::bPainted ) == "B"
Eval( ::bPainted, ::hDC, ::cPS, Self )
endif

::DispEnd( aInfo )

//-> Antonio Linares en 20/12/2005
if IsWindowEnabled( ::hWnd )
CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )
else
SetTextColor( ::hDC, ::nClrText )
SetBkColor( ::hDC, ::nClrPane )
hOldFont = SelectObject( ::hDC, ::oFont:hFont )
ExtTextOut( ::hDC, 0, 0,;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
SelectObject( ::hDC, hOldFont )
endif

// Fim da Mudanca - Fin del Cambio

return 1


Muchas Gracias, e Saludos desde São Paulo - Brasil.

Posted: Tue Dec 20, 2005 10:40 pm
by Antonio Linares
João,

Cambia el orden del código:

...

if IsWindowEnabled( ::hWnd )
CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )
else
SetTextColor( ::hDC, ::nClrText )
SetBkColor( ::hDC, ::nClrPane )
hOldFont = SelectObject( ::hDC, ::oFont:hFont )
ExtTextOut( ::hDC, 0, 0,;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
SelectObject( ::hDC, hOldFont )
endif

if ValType( ::bPainted ) == "B"
Eval( ::bPainted, ::hDC, ::cPS, Self )
endif

::DispEnd( aInfo )

Para respetar el CENTER, RIGHT O LEFT, tienes que llamar a SetTextAlign() antes de llamar a ExtTextOut():

Code: Select all

do case
     case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_CENTER )
          SetTextAlign( ::hDC, TA_CENTER )

     case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_RIGHT )
          SetTextAlign( ::hDC, TA_RIGHT )

     otherwise
          SetTextAlign( ::hDC, TA_LEFT )
endcase
ExtTextOut( ... )

Posted: Wed Dec 21, 2005 12:43 am
by karinha
Antonio... Por Favor, Donde esta Errado??

No Fica Perfecto...

#define ES_CENTER 1
#define ES_RIGHT 2
#define ES_LEFT 0
#Define TA_LEFT 0
#Define TA_RIGHT 2
#Define TA_CENTER 6

METHOD Paint() CLASS TGet

local aInfo := ::DispBegin()

local hOldFont

if ::oBrush != nil
FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
else
CallWindowProc( ::nOldProc, ::hWnd, WM_ERASEBKGND, ::hDC, 0 )
endif

if IsWindowEnabled( ::hWnd )

CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )

else

SetTextColor( ::hDC, ::nClrText )
SetBkColor( ::hDC, ::nClrPane )
hOldFont = SelectObject( ::hDC, ::oFont:hFont )

do case
case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_CENTER ) // 1
SetTextAlign( ::hDC, TA_CENTER ) // 6

case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_RIGHT ) // 2
SetTextAlign( ::hDC, TA_RIGHT ) // 2

otherwise
SetTextAlign( ::hDC, TA_LEFT ) // 0
endcase

ExtTextOut( ::hDC, 0, 0,;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
SelectObject( ::hDC, hOldFont )

endif

if ValType( ::bPainted ) == "B"
Eval( ::bPainted, ::hDC, ::cPS, Self )
endif

::DispEnd( aInfo )

return 1

Gracias...

Posted: Wed Dec 21, 2005 9:13 am
by Antonio Linares
João,

Cual falla ? El ES_RIGHT y ES_CENTER ?

Posted: Wed Dec 21, 2005 10:16 am
by karinha
Kreo ke si, Antonio.

Ejemplo:

Tengo um GET, con 13 digitos:

Correcto, seria esto: 7891101901001

En lo GET: 7891... El resto... no esta visible.

Saludos.

Posted: Wed Dec 21, 2005 10:38 am
by karinha
Perdón.

Correcto seria esto:

67.834.510/0001-65

Mostra / Exhibi:

0/0001-65

Posted: Wed Dec 21, 2005 7:02 pm
by Alfredo Arteaga
Me pregunto si se logró, no respeta la alineación.
---

if IsWindowEnabled( ::hWnd )
CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )
else
SetTextColor( ::hDC, ::nClrText )
SetBkColor( ::hDC, ::nClrPane )
hOldFont = SelectObject( ::hDC, ::oFont:hFont )
do case
case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_CENTER )
SetTextAlign( ::hDC, TA_CENTER )
case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_RIGHT )
SetTextAlign( ::hDC, TA_RIGHT )
otherwise
SetTextAlign( ::hDC, TA_LEFT )
endcase
ExtTextOut( ::hDC, 0, 0,;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
SelectObject( ::hDC, hOldFont )
endif[/code]

Posted: Wed Dec 21, 2005 7:49 pm
by karinha

Posted: Thu Dec 22, 2005 7:45 am
by Antonio Linares
Arreglado:

Code: Select all

   if IsWindowEnabled( ::hWnd )
      CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )
   else
      SetTextColor( ::hDC, ::nClrText )
      SetBkColor( ::hDC, ::nClrPane )
      hOldFont = SelectObject( ::hDC, ::oFont:hFont )
      
      do case 
         case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_CENTER ) 
              SetTextAlign( ::hDC, TA_CENTER ) 
              ExtTextOut( ::hDC, 0, ::nWidth() / 2,;
                { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
              
         case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_RIGHT ) 
              SetTextAlign( ::hDC, TA_RIGHT ) 
              ExtTextOut( ::hDC, 0, ::nWidth() - 4,;
                { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
             
         otherwise 
              SetTextAlign( ::hDC, TA_LEFT ) 
              ExtTextOut( ::hDC, 0, 0,;
                { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
      endcase 

      SelectObject( ::hDC, hOldFont )            
   endif                
[/size]

Image

Posted: Thu Dec 22, 2005 11:33 am
by karinha
Perfecto, Impecable, Antonio... Muchas Gracias... Usted és Fantástico, Increíble.
Mui Bueno. Excelente, Noble.

Solución Final:

#define ES_CENTER 1
#define ES_RIGHT 2
#define ES_LEFT 0
#Define TA_LEFT 0
#Define TA_RIGHT 2
#Define TA_CENTER 6

METHOD Paint() CLASS TGet

local aInfo := ::DispBegin()
Local hOldFont

if ::oBrush != nil
FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
else
CallWindowProc( ::nOldProc, ::hWnd, WM_ERASEBKGND, ::hDC, 0 )
endif

if IsWindowEnabled( ::hWnd )

CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )

else

SetTextColor( ::hDC, ::nClrText )
SetBkColor( ::hDC, ::nClrPane )
hOldFont = SelectObject( ::hDC, ::oFont:hFont )

do case
case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_CENTER )
SetTextAlign( ::hDC, TA_CENTER )
ExtTextOut( ::hDC, 0, ::nWidth() / 2, ;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )

case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_RIGHT )
SetTextAlign( ::hDC, TA_RIGHT )
ExtTextOut( ::hDC, 0, ::nWidth() - 4, ;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )

otherwise
SetTextAlign( ::hDC, TA_LEFT )
ExtTextOut( ::hDC, 0, 0, ;
{ 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
endcase

SelectObject( ::hDC, hOldFont )

endif

if ValType( ::bPainted ) == "B"
Eval( ::bPainted, ::hDC, ::cPS, Self )
endif

::DispEnd( aInfo )

return 1

Gracias También a Vagner Wirts. vwirts@ig.com.br

Saludos, Desde São Paulo - Brazil.

Posted: Thu Dec 22, 2005 4:10 pm
by Alfredo Arteaga
Bien Antonio!. Todo parece tan simple cuando ya esta hecho...

Nuevamente, gracias.