The class Balloon (gb.form) implements a display object for messages. This class displays a message and an optional icon in a coloured balloon.
Figure 20.2.1: Balloon with 'Information' icon and text section highlighted in colour.
The Balloon class has four properties:
Property | Data type | Description |
---|---|---|
Control | Control | NULL is returned if no balloon is displayed or the control with which the Balloon object is associated. |
Delay | Integer | Determines or sets the number of milliseconds how long the balloon is displayed. The default time is 5 seconds. |
Font | Font | Returns or sets the font for the balloon. |
Visible | Boolean | Returns TRUE if the balloon is visible. |
Table 20.2.1.1 : Properties of the class `Balloon`
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).
Method | Description |
---|---|
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`
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.
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:
Example 2
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
Chapter