Funcion para Agregar/Remover STYLES a un control in Run-Time
Posted: Thu Jan 14, 2010 3:58 pm
#define GWL_STYLE -16
Aca les mando esta funcion, espero les sirva Es MUY util ehh
Aca les mando esta funcion, espero les sirva Es MUY util ehh
Code: Select all
//--------------------------------------------------------------------------------------------------//
FUNCTION ChangeStyleWindow( hoWnd, naStyle, nStyleType, lAdd )
local aStyles:= {}, n, hWnd, nStyleReturn:= 0
if ValType(hoWnd)$"O"
hWnd:= hoWnd:hWnd
else
hWnd:= hoWnd
endif
if ValType(naStyle)$"N;A"
if ValType(naStyle)$"N"
aStyles:= { naStyle }
else
aStyles:= aClone( naStyle )
endif
aEval(aStyles, {|nStyle| nStyleReturn:= __ChangeStyleWindow( hWnd, nStyle, nStyleType, lAdd ) } )
endif
return nStyleReturn
//--------------------------------------------------------------------------------------------------//
STATIC FUNCTION __ChangeStyleWindow( hWnd, nStyle, nStyleType, lAdd )
local nOldStyle, lExistStyle
local nStyleReturn:= 0
DEFAULT nStyleType:= GWL_STYLE,;
lAdd:= .T.
if ValType(hWnd)$"N" .and. ValType(nStyle)$"N" .and. ValType(nStyleType)$"N" .and. ValType(lAdd)$"L"
nOldStyle := GetWindowLong( hWnd, nStyleType )
lExistStyle:= lAnd( nStyle, nOldStyle )
if lAdd .and. !lExistStyle
SetWindowLong( hWnd, nStyleType, nOr( nOldStyle, nStyle ) )
elseif !lAdd .and. lExistStyle
SetWindowLong( hWnd, nStyleType, nAnd( nOldStyle, nNot(nStyle) ) )
endif
nStyleReturn:= GetWindowLong( hWnd, nStyleType )
endif
RETURN nStyleReturn