Estoy haciendo una validación de datos ( Crsitobal
He revisado la clase TGET y sus herencias pero no doy con la clave.
El resultado sería como este, el segundo get sería el inválido.

¿ Y porque no ?
¿ And why not ?

Prueba asi oGet:bPainted:= {| hDC | DrawBox( 0, 0, oGet:nHeight, oGet:nWidth, hDC, 0, 0, 1, CLR_RED ) }
oGet:bPainted:= {| hDC | DrawBox( 0, 0, oGet:nHeight, oGet:nWidth, hDC, 0, 0, 1, CLR_RED ) }FUNCTION DrawBox( hDC, aRect, nAdj )
local aPoints
DEFAULT nAdj := 0
aPoints := { { aRect[ 2 ], aRect[ 1 ] },; //start
{ aRect[ 4 ], aRect[ 1 ] },; //top
{ aRect[ 4 ], aRect[ 3 ] },; //right
{ aRect[ 2 ], aRect[ 3 ] },; //Bottom
{ aRect[ 2 ], aRect[ 1 ] - nAdj } } //left
PolyLine( hDC, aPoints )
return niloGet2:bPainted:= {| hDC | DrawBox( hDC, { 0, 0, oGet2:nHeight, oGet2:nWidth } ) }
Es muy interesante la funcionalidad que queres hacer.
En la clase TGraph hay metodos que te pueden ser de utilidad
METHOD DrawBox( nTop, nLeft, nBottom, nRight, nColor )
METHOD DrawLine( nY, nX, nHigh, nWidth, nColor, lDotted )
...
MESSAGE CreatePen METHOD _CreatePen()
METHOD DeletePen()
Why are you looking in tcalex.prg and tgraph.prg for drawing boxes?
TWindow class has a method Box and is available for every dialog and control too.
oWnd/oDlg/oCtrl:Box( nTop, nLeft, nBottom, nRight, uBorder, uBrush, aText )
uBorder can be Color constant, or oPen or hPen.
cmsoft wrote:Es muy interesante la funcionalidad que queres hacer.Gracias, estoy intentando emular el sistema de validaciones automáticos que lleva Laravel o Angular.
En la clase TGraph hay metodos que te pueden ser de utilidad
nageswaragunupudi wrote:Why are you looking in tcalex.prg and tgraph.prg for drawing boxes?Sorry, I got confused looking for the right function/method!
TWindow class has a method Box and is available for every dialog and control too.
nageswaragunupudi wrote:oWnd/oDlg/oCtrl:Box( nTop, nLeft, nBottom, nRight, uBorder, uBrush, aText )Test with Box() Method of TGet Class but don't function....
uBorder can be Color constant, or oPen or hPen.

#include 'fivewin.ch'
Function Main()
Local oDlg
Local oGet1
Local cVar1 := Space( 100 )
Local oGet2
Local cVar2 := Space( 100 )
DEFINE DIALOG oDlg Resource "Dialogo2"
Redefine Get oGet1 Var cVar1 Id 4004 Of oDlg
Redefine Get oGet2 Var cVar2 Id 4001 Of oDlg
oGet2:Box( 0, 0, oGet2:nHeight, oGet2:nWidth, CLR_RED )
ACTIVATE DIALOG oDlg CENTER
Return ( Nil )// RESOURCE SCRIPT generated by "Pelles C for Windows, version 10.00".
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
LANGUAGE LANG_NEUTRAL,SUBLANG_NEUTRAL
DIALOGO2 DIALOG DISCARDABLE 14, 40, 330, 36
STYLE WS_POPUP|DS_MODALFRAME|DS_CONTEXTHELP|WS_THICKFRAME|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_VISIBLE
EXSTYLE WS_EX_TRANSPARENT|WS_EX_CONTEXTHELP
CAPTION "Dialogo"
FONT 10, "Segoe UI Light"
{
CONTROL "Edit", 4004, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 8, 4, 316, 12
CONTROL "Edit", 4001, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 8, 20, 316, 12
}#Include 'FiveWin.Ch'
#Define CLR_PINK RGB( 255, 128, 128)
FUNCTION Main()
Local oDlg, cTitle
Local oGet1
Local cVar1 := Space( 100 )
Local oGet2
Local cVar2 := Space( 100 )
cTitle := OemToAnsi( "FIVEWIN: GET CON BORDES RED COLOR Y PAINT" )
DEFINE DIALOG oDlg Resource "DIALOGO2" TITLE cTitle ;
COLORS CLR_BLACK, CLR_WHITE TRANSPARENT
oDlg: lHelpIcon := .F.
REDEFINE GET oGet1 VAR cVar1 ID 4004 OF oDlg
REDEFINE GET oGet2 VAR cVar2 ID 4001 OF oDlg
ACTIVATE DIALOG oDlg CENTER ;
ON PAINT( oGet2:Box( -1, -1, oGet2:nHeight, oGet2:nWidth, CLR_HRED ) )
RETURN NIL

Cual és la FONT?
-1 -1, funciona perfecto con WorkShop.exe y el GET sin Border.
Saludos.
karinha wrote:Cual és la FONT?
-1 -1, funciona perfecto con WorkShop.exe y el GET sin Border.
Saludos.
::oFont := TFont():New ( 'Segoe UI', 0, -12,,,,,,,,,,,,,,,.f. )En vez de oGet:Box he utilizado oGet:oWnd:Box y ya funciona bien sin tener que quitar el borde del get en el recurso, por lo que también se ha solucionado el problema que se eliminaba el marco al pasar el el cursor del ratón
Hola
Puedes publicar el código, de cómo lo estás haciendo ?
Un saludo y gracias
jgabri wrote:Hola
Puedes publicar el código, de cómo lo estás haciendo ?
Un saludo y gracias
oGet:oWnd:Box ( oGet:nTop - 1,;
oGet:nLeft - 1,;
oGet:nTop + oGet:nHeight ,;
oGet:nLeft + oGet:nWidth ,;
{ HexToRgb ( '#d4edda' ), 1 } )Mil gracias Víctor, funciona perfectamente !!