The HistoryBox is a TextBox that has been extended by the property to temporarily store a certain number of entries. In the HistoryBox, you can use the arrow keys ↑ and ↓ to search for input that has already been entered, for example, like in a console, and then call it up.
The classes HistoryBox, History and _HistoryOptions have been developed by Tobias Boege.
Figure 16.10.1: Icon for the component HistoryBox
As with all components, the HistoryBox was also given an icon by the authors, which you can see in the IDE's properties window under 'Form'. The icon must be inserted in the project directory in an invisible folder .hidden/control as an image of type 'png', so that it can be seen in the IDE in the virtual folder 'Project'.
The chapter '21.3.5 Project GUI MySQL' describes in detail the use of a HistoryBox for the database client presented there. You will also find the three classes HistoryBox, History and _HistoryOptions as well as the icon mentioned above in the project archive.
Figure 16.10.2: GUI for the console program 'mysql'.
For this reason, the relevant source code can be shortened considerably in relation to the component HistoryBox:
' Gambas class file ... Public Sub Form_Open() FMain.Center FMain.Resizable = True ... txbHistoryEingabe.Foreground = Color.Gray txbHistoryEingabe.Alignment = Align.Center txbHistoryEingabe.Text = "*** Enter the SQL statement and activate it with the ENTER key! ***" txbHistoryEingabe.ReadOnly = True txbHistoryEingabe.History = New History(50) ' 50 entries are stored internally ... End ' Form_Open() Public Sub btnProcessStart_Click() ... txbHistoryEingabe.Alignment = Align.Normal End ' btnProcessStart Public Sub btnTextAreaClear_Click() ... txbHistoryEingabe.SetFocus End ' btnTextAreaClear ... Public Sub ProcessStart() Dim sCommand As String txbHistoryEingabe.Foreground = Color.Black txbHistoryEingabe.Clear ... txbHistoryEingabe.ReadOnly = False txbHistoryEingabe.SetFocus End ' ProcessStart() ... Public Sub txbHistoryEingabe_Activate() If txbHistoryEingabe.Text = "" Then Return txbHistoryEingabe.Text = Trim(txbHistoryEingabe.Text) WriteToMyProcess(txbHistoryEingabe.Text) ' txbHistoryEingabe.Clear ---> This is done by the History-Box itself! End ' txbHistoryEingabe_Activate() ... Public Sub Form_Close() ... End ' Form_Close()
Articles