Delphi Example #4
Sending more advanced commands such as Custom Startup Screen.
Example 4: clear screen, set backlight off and write text on startup
As a fourth example I've created a little application called "Small Foot", which can be used to set the backlight off, clear the screen and/or send some text to the display on startup, without showing any forms. When started with "settings" as a parameter in the commandline, the settings-form is shown in which some settings can be altered. The settings are saved in a inifile called "SmallFootSettings.ini" in the default ini-directory.
ZIP-file with source code and binary, a total size of 205KB
Here's a screenshot:

Here is the display-related code:
...
//Open the comport
ComPort.Open;
//If opening the comport didn't work, exit
if not ComPort.Connected then
begin
ShowMessage('Unable to connect to comport ' + ComPort.Port + '.');
Close;
end;
//Now go through all the settings
if CB_BacklightOff.Checked then
ComPort.WriteStr(#255'F');
if CB_ClearScreen.Checked then
ComPort.WriteStr(#255'X');
if CB_WriteText.Checked then
ComPort.WriteStr(Edit_Text.Text);
//Now close the port again
ComPort.Close;
...
A special thanks to David (Relix) Ovichen for this example.
For technical discussions and questions, please visit our forums
