to...@personamedical.com
unread,Mar 5, 2013, 3:52:04 PM3/5/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to harbou...@googlegroups.com
When a color string is provided for the 3rd parameter of Alert(), Harbour's handling of the colors is not consistent with Clipper. It appears that Harbour is attempting to reverse the colors provided but it doesn't work correctly with a color string with standard and enhanced colors are specified, and regardless is not what Clipper does.
In Clipper, when only the standard color string is supplied to Alert(), Clipper uses the current SetColor()'s enhanced color setting.
For example, if SetColor() returns "W/N,N/W,N/N,N/N,N/W", and you call Alert("Test",{"One","Two"},"GR+/B"), the items (One and Two) would be drawn using the "N/W" color string. However, if the color string, "GR+/B,W+/R" is used, the items are drawn using "W+/R".
So, to make the Alert function work as it does in Clipper, Harbour's \harbour\src\rtl\alert.prg needs to be changed similar to the highlighted portion below:
FUNCTION Alert( cMessage, aOptions, cColorNorm )
LOCAL cColorHigh
LOCAL aOptionsOK
LOCAL cOption
#ifdef HB_CLP_UNDOC
IF s_lNoAlert == NIL
s_lNoAlert := hb_argCheck( "NOALERT" )
ENDIF
IF s_lNoAlert
RETURN NIL
ENDIF
#endif
IF ! HB_ISSTRING( cMessage )
RETURN NIL
ENDIF
cMessage := StrTran( cMessage, ";", Chr( 10 ) )
hb_default( @aOptions, {} )
IF ! HB_ISSTRING( cColorNorm ) .OR. Empty( cColorNorm )
cColorNorm := "W+/R" // first pair color (Box line and Text)
cColorHigh := "W+/B" // second pair color (Options buttons)
ELSE
cColorHigh := HB_TOKENGET( cColorNorm, 2, ",")
IF Empty( cColorHigh )
cColorHigh := HB_TOKENGET( SetColor(), 2, ",")
ENDIF
ENDIF
aOptionsOK := {}
FOR EACH cOption IN aOptions
IF HB_ISSTRING( cOption ) .AND. ! Empty( cOption )
AAdd( aOptionsOK, cOption )
ENDIF
NEXT
IF Len( aOptionsOK ) == 0
aOptionsOK := { "Ok" }
#ifdef HB_CLP_STRICT
ELSEIF Len( aOptionsOK ) > 4 /* NOTE: Clipper allows only four options [vszakats] */
ASize( aOptionsOK, 4 )
#endif
ENDIF
RETURN hb_gtAlert( cMessage, aOptionsOK, cColorNorm, cColorHigh )
BTW, I'm working with Harbour 3.2.0dev (Rev. 18896) in Windows 7 Pro 32 bit..
Regards,
tq