User Tools

Site Tools


k17:k17.16:start

17.16 LCDLabel

The class LCDLabel (gb.form) implements a label that displays its text like an LCD screen. In a 16-segment display element (SISD - sixteen-segment display), each segment can be switched on or off.

Each character is displayed in a separate 16-segment display element. The number of characters to be displayed determines the number of 16-segment display elements. Due to the special geometry in the 16-segment display element, not all characters can be displayed. All Latin letters (ISO) and all digits [0-9] are safely displayed. Lower case letters are automatically converted to upper case. In addition, there are the following 19 special characters:

_ [ ] - + | / = * < > @ ' ' ° ~ $

Sonderzeichen

Figure 17.16.1: Display of special characters

You must mask the characters backslash \ and inverted commas “ with a backslash \:

LCDLabel.Text = "\\" und LCDLabel.Text = "\""

A full stop and a colon are (alternatively) displayed in their own segment immediately after the 16-segment display element: LCDLabel.Text = "http://www.gambas-buch.de".

Bild2

Figure 17.16.2: Display of special characters, full stop and colon

The German umlauts and other characters - such as a ? or an ß - are not displayed and are replaced by a space! Good to know: A space as a permissible character is indicated by a space!

17.16.1 Properties LCDLabel

Selected properties of an LCDLabel are listed and described in the following table:

PropertyTypeDescription
AlignmentIntegerSpecifies the alignment of the text to be displayed. Constants: Align.Normal, Align.Left, Align.Right, Align.Centre.
BorderBooleanIndicates whether the LCD label is surrounded by a border or not.
HighlightColorIntegerSets the colour for HighlightColor or reads the colour value. Default value is Color.Default and corresponds without HighlightColor.
PaddingIntegerDetermines the border width around the LCDLabel or sets the border width.
ShearedBooleanIndicates whether the text is displayed tilted to the right or not.
TextStringReturns the displayed LCDLabel text or sets the text to be displayed in the LCDLabel.

Table 17.16.1.1: Overview of properties of the component LCDLabel

17.16.2 Project LCDLabel

This project is about the (formatted) display of date and time, among other things. The source code is given in full. The system time is read out every second via a timer and displayed with a flashing colon (→ lines 26 and 34) as a separator:

Zeit

Figure 17.16.2.1: Display time

Source code:

[1] ' Gambas class file
[2]
[3] Private bTrenn As Boolean
[4]
[5] Public Sub Form_Open()
[6]   FMain.Center
[7]   FMain.Text = "Tempus fugit ..."
[8]   FMain.Arrangement = Arrange.Vertical
[9]   FMain.Margin = True
[10]   FMain.Spacing = True
[11]
[12]   LCDLabel.Border = True
[13]   LCDLabel.Alignment = Align.Center
[14]   LCDLabel.Background = &HC3DDFF&
[15]   LCDLabel.Foreground = &H0000FF& ' Color.Red
[16]   LCDLabel.Expand = True
[17]   LCDLabel.Font = Font["Arial, 14"] ' Zulässig - aber ohne Wirkung!
[18]
[19]   LCDTimer.Delay = 1000
[20]   LCDTimer.Start
[21]   LCDTimer_Timer()
[22] End
[23]
[24] Public Sub LCDTimer_Timer()
[25]
[26]   bTrenn = Not bTrenn
[27]
[28] ' LCDLabel.Padding = 8
[29] ' FMain.Text = "19 Sonderzeichen …"
[30] ' LCDLabel.Text = "_[]+-|\\/=*<>@'\"`°~$"
[31] ' FMain.Text = "Das Online-Buch im Internet"
[32] ' LCDLabel.Text = "http://www.gambas-buch.de"
[33]
[34]   LCDLabel.Text = Format(Now,"hh" & If(bTrenn, ":", "") & "nn" & If(bTrenn,":","") & "ss")
[35]
[36] End

You can alternatively replace line 34 with the following lines:

  • LCDLabel.Text = Format(Now, “dddd-dd.mm.yyyy”) → day of the week, date, hyphen and dot separator.
  • LCDLabel.Text = Format(Now, “dd.mm.yyyy”) → date, separator dot
  • LCDLabel.Text = Format(Now, “hh” & If(bSeparator, ”:“, ”“) & “nn”) & ” clock“ → time (hours, minutes), separator colon

Download

Projects

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.
k17/k17.16/start.txt · Last modified: 01.10.2023 by emma

Page Tools