Method XbpSLE():showBalloonTip() Foundation

Displays a balloon-like window with information on the entry field.

Syntax
:showBalloonTip( [<nType>], [<cTitle>], <cText> ) --> lSuccess
Parameters
<nType>
<nType> is a numeric value that defines the type of tip window to display. The following table lists the tip types recognized by the system.
Types of ballon tips
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
  1. Default Value
Parameter <nType> is optional. Its default value is XBP_TIPDEFAULT.
<cTitle>
<cTitle> is a character string with the title of the balloon tip. This parameter is optional and defaults to the empty string (""), meaning no title is shown.
<cText>
<cText> is a character string with the text to display in the balloon tip.
Return

This method returns the value .T. (true) if the balloon tip could be displayed, otherwise it returns .F. (false).

Description

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.

A manifest file or resource must be defined for the application for balloon tips to be displayed. If no manifest is defined, calling :showBalloonTip() has no effect.

 // 
 // 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 

Feedback

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.