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

Post Reply
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

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

Post 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.
João Santos - São Paulo - Brasil
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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                
   ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Post 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.
João Santos - São Paulo - Brasil
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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( ... )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Post 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...
João Santos - São Paulo - Brasil
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

João,

Cual falla ? El ES_RIGHT y ES_CENTER ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Post 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.
João Santos - São Paulo - Brasil
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Post by karinha »

Perdón.

Correcto seria esto:

67.834.510/0001-65

Mostra / Exhibi:

0/0001-65
João Santos - São Paulo - Brasil
User avatar
Alfredo Arteaga
Posts: 326
Joined: Sun Oct 09, 2005 5:22 pm
Location: Mexico
Contact:

Post 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]
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Post by karinha »

João Santos - São Paulo - Brasil
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Post 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.
João Santos - São Paulo - Brasil
User avatar
Alfredo Arteaga
Posts: 326
Joined: Sun Oct 09, 2005 5:22 pm
Location: Mexico
Contact:

Post by Alfredo Arteaga »

Bien Antonio!. Todo parece tan simple cuando ya esta hecho...

Nuevamente, gracias.
Post Reply