Method XbpSLE():showBalloonTip() Foundation
Displays a balloon-like window with information on the entry field.
:showBalloonTip( [<nType>], [<cTitle>], <cText> ) --> lSuccess
Constant | Description |
---|---|
XBP_TIPDEFAULT *) | Default tip window for displaying uncategorized text |
XBP_TIPINFO | Tip window for displaying informational text, contains information icon |
XBP_TIPWARNING | Tip window for displaying warning messages, contains warning icon |
XBP_TIPERROR | Tip window for displaying error messages, contains error icon |
XBP_TIPINFOLARGE | Same as XBP_TIPINFO, but contains larger icon |
XBP_TIPWARNINGLARGE | Same as XBP_TIPWARNING, but contains larger icon |
XBP_TIPERRORLARGE | Same as XBP_TIPERROR, but contains larger icon |
|
This method returns the value .T. (true) if the balloon tip could be displayed, otherwise it returns .F. (false).
The method :showBalloonTip() displays a balloon-like information window, similar to a tool tip. Balloon tip windows are typically used to display incorrect input during form validation, and to provide a visual cue as to which entry field contains erroneous data. Use method :hideBalloonTip() to hide the tip window.
Balloon tip interaction and behaviour: The input focus is automatically assigned to the entry field during execution of :showBalloonTip(), allowing the user to correct or change the value entered. If the input focus is set on another user interface element or if no input occurs within a preset interval, the operating automatically hides the balloon tip window.
//
// Example for using :showBalloonTip() and :cueBanner
//
// IMPORTANT: A manifest file or resource must be defined
// for the application!
//
#include "xbp.ch"
PROCEDURE Main()
LOCAL oSLE
SetColor( "N/W+" )
CLS
SetAppWindow():UseShortCuts := .T.
? "Please enter your name into the entry field."
? "A warning appears if non-alphabetical characters"
? "are input."
? ""
? "Close the window to exit."
//
// Create the entry field. Input is processed
// in procedure ProcessKey()
oSLE := XbpSLE():New( ,, {50,50},{150,50}, {{XBP_PP_COMPOUNDNAME,"9.Tahoma"}} )
oSLE:CueBanner := "Enter your name..."
oSLE:Create()
oSLE:keyboard := {|nKey| ProcessKey(oSLE, nKey)}
IF IsThemeActive(.T.) == .F.
MsgBox( "No manifest defined for the application!", "Application Error" )
QUIT
ENDIF
// Process input until the window is closed
SetAppWindow():ShowModal()
RETURN
// Process a key-press. Inputting invalid
// characters causes a warning to be displayed.
PROCEDURE ProcessKey( oSLE, nKey )
LOCAL cData
LOCAL nChar
IF IsAlpha(Chr(nKey)) == .F.
cData := oSLE:EditBuffer()
nChar := At( Chr(nKey), cData )
IF nChar == 0
RETURN
ENDIF
cData := Stuff( cData, nChar, 1, "" )
oSLE:SetData( cData )
oSLE:SetMarked( {nChar, nChar} )
oSLE:ShowBalloonTip( XBP_TIPWARNING, "Invalid Input",;
"Please input only alpha-numerical characters!" )
ELSE
oSLE:HideBalloonTip()
ENDIF
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.