[Lazarus] Teaching Pascal at College

Martin Schreiber mse00000 at gmail.com
Thu Oct 13 16:27:44 CEST 2016


On Thursday 13 October 2016 15:37:53 Adrian De Armas via Lazarus wrote:
[...]
>
> In GUI a, b, and c will be spinedits with a "value" integer property so I
> can write:
>
> spineditc.value := spinedita.value+spineditb.value;
>
> instead of
>
> editc.Text := IntToStr(StrToInt(Edita.Text)+StrToInt(Editb.Text));
>
In the mentioned "Programmieren macht Spass" text I tried to combine to 
discover the programming by "click and place" and learning the programming 
basics. Free Pascal and MSEgui are exceptionally well suited for the purpose. 
MSEgui provides TDataEdit descendants for the base types (TIntegerEdit, 
TRealEdit, TStringedit...) which all have an OnDataEntered event property 
which can be used to react on user data entries.

An example from "Die Rechenkünstlerin" step2:
"
type
 tmainfo = class(tmainform)
   ergebnis: tintegerdisp;
   a: tintegeredit;
   b: tintegeredit;
   procedure dataentered(const sender: TObject);
 end;

var
 mainfo: tmainfo;

implementation
uses
 main_mfm;
 
procedure tmainfo.dataentered(const sender: TObject);
begin
 ergebnis.value:= a.value + b.value;
end;
"

The form looks like this:
http://mseide-msegui.sourceforge.net/pics/rechenkunst2.png
The end of the chapter:
http://mseide-msegui.sourceforge.net/pics/rechenkunst.png
;-)

Martin


More information about the Lazarus mailing list