User Tools

Site Tools


k20:k20.2:start

20.2 Balloon

The class Balloon (gb.form) implements a display object for messages. This class displays a message and an optional icon in a coloured balloon.

Bild1

Figure 20.2.1: Balloon with 'Information' icon and text section highlighted in colour.

20.2.1 Properties

The Balloon class has four properties:

PropertyData typeDescription
ControlControlNULL is returned if no balloon is displayed or the control with which the Balloon object is associated.
DelayIntegerDetermines or sets the number of milliseconds how long the balloon is displayed. The default time is 5 seconds.
FontFontReturns or sets the font for the balloon.
VisibleBooleanReturns TRUE if the balloon is visible.

Table 20.2.1.1 : Properties of the class `Balloon`

20.2.2 Methods

The Balloon class has 2 basic methods - one to display the balloon and one to hide the balloon. When displaying, 5 different icons can optionally be displayed with it to indicate the type of message (error, question, information, deletion and warning).

MethodDescription
Balloon ( Message As String, Control As Control [ , X As Integer, Y As Integer ] )Displays the message in a balloon with a coloured background.
Balloon.TYPE ( Message As String, Control As Control [ , X As Integer, Y As Integer ] )Displays the message in a balloon with a coloured background prefixed with an icon.
Hide ( [ Control As Control ] )The balloon is hidden. You can optionally specify the component to which the balloon points.

Table 20.2.2.1 : Methods of the class `Balloon`

  • Message is the message to display. You can also mark up the text of mime type 'text/html' → example 1.
  • Control is the component the balloon points to.
  • X and Y are the (relative) coordinates of the point on the component to which the balloon points. The specification of the coordinates is optional.
  • TYPE optionally specifies the type of message: Delete, Info, Error, Question and Warning. Without the type specification, only the message text is displayed in the balloon.

20.2.3 Notes on the use of the Balloon class

For longer messages, the class Message provides six different variants → Chapter 20.1 Message.For detailed messages - for example, within the framework of a programme help - other display objects are available, the overview of which can be found in → Chapter 11.8 Programme help. There you will also find application notes and many examples.

20.2.4 Examples

The following two examples show typical use cases for balloons.

Example 1

Example 1 refers to Figure 20.2.1 for displaying a balloon with icon. The following source code snippet is typical for the use of a balloon:

[1] bbPublic Sub btnHilfe_Click()
[2]   Dim sMitteilung As String
[3]
[4]   Balloon.Font = Font["Ubuntu,12"]
[5]   Balloon.Delay = 10000
[6]
[7]   sMitteilung = "Nach der Installation ist der MySQL-Server so konfiguriert, dass er nur vom "
[8]   sMitteilung &= "localhost - also vom lokalen Rechner aus - erreichbar ist. Soll der Server "
[9]   sMitteilung &= "über das Netzwerk ansprechbar sein, so kann man hier zum Beispiel mit "
[10]   sMitteilung &= "<font color='red'>'bind-address = 192.168.0.100' </font>die interne "
[11]   sMitteilung &= " IP-Adresse des Servers eintragen. So ist der MySQL-Server auch von anderen"
[12]   sMitteilung &= " Arbeitsstationen aus dem LAN ansprechbar."
[13]
[14]   If Not Balloon.Visible Then
[15]      Balloon.Info(sMitteilung, btnHilfe, btnHilfe.W - 5, btnHilfe.H - 3)
[16]   Else
[17]     Balloon.Hide()
[18]   Endif
[19] End

Notes:

  • The display of the (help) text is done with a single click on the button 'btnHelp' and is assigned to this button → line 15 middle.
  • In addition, the use of a tool tip is also possible for this button, as the event btnHelp_Enter() is not used.
  • An icon is also displayed by Balloon.Info(…) in line 15.
  • You can optionally assign your own font [4] to the balloon, which will always be a compromise between readability and (display) size. Otherwise, the default font of the project is used.
  • The display duration of 10 seconds [5] seems very large. However, bear in mind that the text is already unusually long. However, you can stop the display immediately with another click on the button 'btnHelp', as you can see from the control structure in lines 14 to 18.

Example 2

Symbol

Place a balloon on the form - here tied to a small button next to a text box with a small i as an icon - to decently display a hint. The balloon with the hint text is displayed when you stand with the mouse over the button with the icon. The balloon disappears automatically after 3 seconds or exactly when you leave the button again with the mouse within the display time:

Public Sub btnInformation_Enter() '-- Display balloon
 
  Dim sMitteilung As String
 
  Balloon.Font = Font["Ubuntu,11"]
  Balloon.Delay = 3000
  sMitteilung = "Input in CAPITAL LETTERS required!" & gb.Tab
  Balloon.Info(sMitteilung, Last)
 
End
Public Sub btnInformation_Leave() '-- Hide balloon
  Balloon.Hide()
End

Download

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k20/k20.2/start.txt · Last modified: 21.10.2023 by emma

Page Tools