Colorured borders for Tooltops and F3 Help

The place where ProMatrix users can post coding tips and utilities they create.

Colorured borders for Tooltops and F3 Help

Postby JessicaLawson » Sun Jun 13, 2010 4:22 pm

I've always thought tooltips were useless because usually I wasted
time hovering over controls that told me little more than the label.
Or hovering over a control and waiting to see if there was in fact a
tooltip.

Taking the cue from Promatrix and their decision to show mandatory
controls with a yellow background, I thought that I do some code to
change the border colour of a control if it had a tooltip and if it
had F3 help.

In devApp, create a custom method called 'zSetBorderColorIfTooltip'
and stick this code in it:
*
* zSetBorderColorIfTooltip
*
LPARAMETERS oControl
LOCAL dllTooltip, dllF3
STORE .f. TO dllTooltip, dllF3
WITH oControl
*
* make sure the control has a bordercolor
*
IF NOT PEMSTATUS(oControl, 'borderColor', 5)
return
endif
IF NOT EMPTY(.tooltipText)
*
* change border colour for tooltip
*
STORE .t. TO dllToolTip
ENDIF
IF
_screen.oApp.oVPMDataHandler.GetDDFH(.cName_DDD,.cName_DDTV,.cName_DDF)
IF NOT EMPTY(_screen.oApp.oVPMDataHandler.oDDFHRecord.mVPMHelpText)
*
* change color if exists F3 help
*
STORE .t. TO dllF3
endif
ENDIF

DO case
CASE dllToolTip AND dllF3
*
* change border colour for tooltip
*
STORE RGB(0, 255, 255) TO .borderColor
STORE 1 TO .SpecialEffect
CASE dllToolTip
*
* change border colour for tooltip
*
STORE RGB(0, 128, 0) TO .borderColor
STORE 1 TO .SpecialEffect
CASE dllF3
*
* change border colour for F3
*
STORE RGB(0, 0, 128) TO .borderColor
STORE 1 TO .SpecialEffect
ENDCASE
ENDWITH
return




Now in devCtrls::textbox_ add this code to the Init:
LOCAL returnValue
STORE DODEFAULT() TO returnValue
IF PEMSTATUS(_screen.oApp, 'zSetBorderColorIfTooltip', 5) ;
and returnValue
*
* running from app or exe
*
_screen.oApp.zSetBorderColorIfTooltip(this)
ELSE
*
* runing from developer's environment
* do nothing because I don't know where devApp is.
*
endif
RETURN returnValue

You can add that code to the init of all the controls in devCtrl that
have a border.

I've only used this for a week now and have only installed for one
client. But, so far nothing has gone kaboom.

Please, give it shot and let us know if there's anything wrong or if
it can be improved.


Richard Stecenko
Interactive Computer Services Inc.
Winnipeg, Canada
204.453.2052
JessicaLawson
 
Posts: 79
Joined: Sun Jun 13, 2010 1:23 pm

Return to ProMatrix User Library

Who is online

Users browsing this forum: No registered users and 1 guest

cron