James Bott wrote:Thanks for clarifying that. That may be correct but it is unexpected.
GET oGetStart
GET oGetEnd VALID ( check() )
func check()
if dStart > dEnd
MsgInfo(" dStart > dEnd ")
retu (.F.)
endif
retu (.T.)
#include "wcolor.ch"
#define COLOR_CRITICAL Rgb(255,197,255) // backround color of critical data - Pink
oGetStart:bPostEdit := {|oGetStart,oGetEnd| checkDates(oGetStart,oGetEnd) }
oGetEnd:bPostEdit := {|oGetStart,oGetEnd| checkDates(oGetStart,oGetEnd) }
function checkDates(oGetStart,oGetEnd)
if oGetStart:varGet() > oGetEnd:varGet()
oGetStart:setColor( COLOR_TEXT, COLOR_CRITICAL )
oGetEnd:setColor( COLOR_TEXT, COLOR_CRITICAL )
else
oGetStart:setColor( COLOR_TEXT, COLOR_WINDOW )
oGetEnd:setColor( COLOR_TEXT, COLOR_WINDOW )
endif
oGetStart:refresh()
oGetEnd:refresh()
return nil
#include "wcolor.ch"
#define COLOR_CRITICAL Rgb(255,197,255) // backround color of critical data - Pink
oGetStart:bPostEdit := {|oGetStart,oGetEnd| checkDates(oGetStart,oGetEnd) }
oGetEnd:bPostEdit := {|oGetStart,oGetEnd| checkDates(oGetStart,oGetEnd) }
function checkDates(oGetStart,oGetEnd)
if oGetStart:varGet() > oGetEnd:varGet() .and. ! empty( oGetEnd:varGet() )
oGetStart:setColor( COLOR_TEXT, COLOR_CRITICAL )
oGetEnd:setColor( COLOR_TEXT, COLOR_CRITICAL )
oGetStart:cTooltip:= "Start date cannot be later than end date."
oGetEnd:cTooltip:="Start date cannot be later than end date."
else
oGetStart:setColor( COLOR_TEXT, COLOR_WINDOW )
oGetEnd:setColor( COLOR_TEXT, COLOR_WINDOW )
oGetStart:cTooltip:=nil
oGetEnd:cTooltip:=nil
endif
oGetStart:refresh()
oGetEnd:refresh()
return nil
#include "fivewin.ch"
#include "wcolors.ch"
#define COLOR_CRITICAL Rgb(255,197,255) // backround color of critical data - Pink
function main()
local oDlg, oGetStart, oGetEnd
local dStart:= ctod("09/09/09"), dEnd:=ctod(" / / ")
set epoch to 1980
define dialog oDlg title "Test Date field valids"
@ 2,2 Get oGetStart var dStart of oDlg valid checkDates( oGetStart, oGetEnd )
@ 3,2 Get oGetEnd var dEnd of oDlg valid checkDates( oGetStart, oGetEnd )
activate dialog oDlg centered
return nil
//---------------------------------------------------------------------------//
function checkDates(oGetStart,oGetEnd)
local nClrFore:=getSysColor( COLOR_WINDOWTEXT ), nClrPane:= getSysColor( COLOR_WINDOW )
if oGetStart:varGet() > oGetEnd:varGet() .and. ! empty( oGetEnd:varGet() )
oGetStart:setColor( nClrFore, COLOR_CRITICAL )
oGetEnd:setColor( nClrFore, COLOR_CRITICAL )
oGetStart:cTooltip:= "Start date cannot be later than end date."
oGetEnd:cTooltip:="Start date cannot be later than end date."
else
oGetStart:setColor( nClrFore, nClrPane )
oGetEnd:setColor( nClrFore, nClrPane )
oGetStart:cTooltip:=nil
oGetEnd:cTooltip:=nil
endif
oGetStart:refresh()
oGetEnd:refresh()
return .T.
//----------------------------------------------------------------------------//
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Cgallegoa, Google [Bot], wilsongamboa and 37 guests