FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Error en SAY en FWH 807
Posts: 408
Joined: Sun Aug 13, 2006 05:38 AM
Error en SAY en FWH 807
Posted: Wed Jul 30, 2008 12:13 AM
Antonio, en la versi贸n anterior de fivewin, el texto aparec铆a pegado a la derecha

local oDlg, oSay
define dialog oDlg size 200,30
@ 0,0 say oSay prompt "" right size 100,10 pixel color "r/w"
activate dialog oDlg on init oSay:setText( "Hola mundo" )
return nil


Soluci贸n: Quita la l铆nea 261
Saludos

Quique
Posts: 408
Joined: Sun Aug 13, 2006 05:38 AM
Error en SAY en FWH 807
Posted: Wed Jul 30, 2008 09:30 PM

Antonio 驴este error tambi茅n viene corregido en el nuevo build?

Saludos

Quique
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Error en SAY en FWH 807
Posted: Wed Jul 30, 2008 11:18 PM
Quique,

La l铆nea 261 no es un error, sino una inteligente aportaci贸n realizada por Stefan Haupt: http://forums.fivetechsoft.com/viewtopic.php?t=11942

Lo 煤nico que hay que hacer es mejorar ese c贸digo para que detecte el estilo SS_RIGHT:
   if ! lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), SS_RIGHT )
      ::nWidth := GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) )
   endif

Y, s铆, vamos a incluir esta mejora en el nuevo build de 8.07.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 408
Joined: Sun Aug 13, 2006 05:38 AM
Error en SAY en FWH 807
Posted: Thu Jul 31, 2008 12:59 AM

Gracias Antonio, pido una disculpa, tal vez lo que dije fue dicho de manera incorrecta, mi intenci贸n era decir el error y como lo solucion茅, no que esa era lo soluci贸n, eso se lo dejamos a los expertos de fivetech.

Saludos

Quique
Posts: 408
Joined: Sun Aug 13, 2006 05:38 AM
Error en SAY en FWH 807
Posted: Thu Jul 31, 2008 01:54 AM
Falt贸 considerar los centrados o implement茅 mal la correcci贸n

#include "FiveWin.ch"

function main
local oDlg, oSay
define dialog oDlg size 200,30
@ 0,0 say oSay prompt "" center size 100,10 pixel color "r/w"
activate dialog oDlg on init oSay:setText( "Hola mundo" )
return nil


con este metodo setText

METHOD SetText( cText ) CLASS TSay
#define GWL_STYLE             -16
#define SS_RIGHT           2

   local hDC

   DEFAULT ::lTransparent := .f.

   ::cCaption := If( ::cPicture != nil, Transform( cText, ::cPicture ),;
                     cValToChar( cText ) )

   #ifndef __CLIPPER__
      if ::oWnd:oBrush != nil .and. Empty( ::oWnd:oBrush:hBitmap ) .and. ( IsAppThemed() .or. ::lTransparent )
         DrawPBack( ::hWnd, hDC := GetDC( ::hWnd ) )
         ReleaseDC( ::hWnd, hDC )
      endif
   #endif

//   ::nWidth := GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) )
   if ! lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), SS_RIGHT )
      ::nWidth := GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) )
   endif
   SetWindowText( ::hWnd, ::cCaption )

return nil
Saludos

Quique
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Error en SAY en FWH 807
Posted: Thu Jul 31, 2008 08:26 AM

Para los centrados esta puede ser la soluci贸n:

define SS_CENTER 1

if ! lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), nOr( SS_RIGHT, SS_CENTER ) )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 408
Joined: Sun Aug 13, 2006 05:38 AM
Error en SAY en FWH 807
Posted: Thu Jul 31, 2008 01:52 PM

Gracias, con eso queda corregido

Saludos

Quique

Continue the discussion