{"id":1131,"date":"2022-05-24T12:17:44","date_gmt":"2022-05-24T11:17:44","guid":{"rendered":"https:\/\/wiskunst.nl\/?page_id=1131"},"modified":"2022-05-24T12:48:00","modified_gmt":"2022-05-24T11:48:00","slug":"lazarus-klokje-instellingen-bewaren","status":"publish","type":"page","link":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-instellingen-bewaren\/","title":{"rendered":"Lazarus-Klokje-Instellingen bewaren"},"content":{"rendered":"<p><strong><span class=\"collapseomatic \" id=\"id69e1b977bd123\"  tabindex=\"0\" title=\"Afleveringen\"    >Afleveringen<\/span><div id=\"target-id69e1b977bd123\" class=\"collapseomatic_content \"><\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-start\/\">Start<\/a><\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-zonder-form\/\">Zonder form<\/a><\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-zichtbaarheid-en-pop\/\">Zichtbaarheid en pop<\/a><\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-opmaak\/\">Opmaak<\/a><\/li>\n<li>Instellingen bewaren<\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-analoog\/\">Analoog<\/a><\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-analoog-opmaak\/\">Analoog opmaak<\/a><\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-nieuwe-vensters\/\">Nieuwe vensters<\/a><\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-alarm\/\">Alarm<\/a><\/li>\n<li><a href=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-finale\/\">Finale<\/a> <\/div><\/li>\n<\/ul>\n<h2>De ouderwetse ini-file in een nieuw jasje.<\/h2>\n<p>In deze aflevering gaan we alle instellingen en de positie van het klokje bewaren, zodat deze weer actief worden bij een volgende start.<\/p>\n<p>We gaan twee procedures maken: <em>LeesIni<\/em> en <em>SchrijfIni<\/em>.<br \/>\nMet <em>LeesIni<\/em> lezen we de opgeslagen instellingen en passen deze toe voordat de klok gaat werken.<br \/>\nMet <em>SchrijfIni<\/em> slaan we alle instellingen op, op het moment dat de klok wordt afgesloten.<\/p>\n<p>De procedure <em>SchrijfIni<\/em> is niet zo heel ingewikkeld om te maken.<br \/>\nDe procedure <em>LeesIni<\/em> daarentegen is veel lastiger, omdat er dan allerlei controles moeten worden uitgevoerd.<\/p>\n<h4>Plaats van de cfg-file<\/h4>\n<p>Daar waar Windows programma&#8217;s vroeger een .ini-file aanmaakte is dat tegenwoordig een .cfg-file; cfg is de extensie die duidt op een configuratie bestand.<br \/>\nVerder is de plaats waar de cfg-file moet komen ook belangrijk, daar Windows tegenwoordig heel veel mappen beveiligt tegen schrijven.<\/p>\n<p>Kortweg zijn er twee plaatsen waar een cfg-file kan staan.<br \/>\nDe map <em>C:\\ProgramData\\[naam applicatie]<\/em> of een persoonlijke map\u00a0<em>C:\\Users\\[naam gebruiker]\\AppData\\Local\\[naam applicatie]<\/em>.<\/p>\n<p>Wanneer een applicatie een algemeen karakter heeft, dus door alle gebruikers kan worden gebruikt is de eerste map van toepassing, is de applicatie persoonsgebonden dan ligt de tweede map voor de hand.<\/p>\n<p>Gelukkig heeft Lazarus hier een mooie functie voor: <em>GetAppConfigFile(Global: Boolean)<\/em>. Als de parameter <em>Global True<\/em> is dan wordt de algemene map gekozen, is <em>Global False<\/em> dan wordt de persoonlijke map gekozen.<\/p>\n<p>Om gebruik te maken van speciale ini-methodes moet u de unit <em>IniFiles<\/em> aanroepen.<\/p>\n<p>Daar <em>LeesIni<\/em> en <em>SchrijfIni<\/em> onderdeel moeten gaan uitmaken van de class <em>TfrmKlokje<\/em> moeten ze daar ook in worden opgenomen. Dit doen we in de <em>private<\/em>-sectie van de class-definitie.<\/p>\n<p>Tijd om aan de slag te gaan.<\/p>\n<p><span style=\"font-family: terminal, monaco, monospace;\">&#8211; Zet in de <em>implementation<\/em>-sectie onder de regel <span style=\"color: #ff0000;\">{$R *.lfm}<\/span> de volgende regels:<\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 Uses<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 IniFiles;<\/span><\/em><\/strong><\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Ga naar de <em>class<\/em>-definitie van <em>TfrmKlokje<\/em> in de <em>interface<\/em>-sectie en voeg de volgende regels toe na de regel met <span style=\"color: #3366ff;\">{private declarations}<\/span>:<\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 procedure LeesIni;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 procedure SchrijfIni;<\/span><\/em><\/strong><\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Ga naar de <em>implementation<\/em>-sectie en voeg na de variabele-declaraties, dus onder <span style=\"color: #3366ff;\">{ TfrmKlokje }<\/span> de volgende code toe:<\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 procedure TfrmKlokje.LeesIni;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 begin<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \/\/ hier komt de code<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 end;<\/span><\/em><\/strong><\/span><\/p>\n<p><span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">&#8211; \u00a0 procedure TfrmKlokje.SchrijfIni;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 begin<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \/\/ hier komt de code<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 end;<\/span><\/em><\/strong><\/span><\/p>\n<h4>SchrijfIni<\/h4>\n<p>Het raam-werk staat. We gaan beginnen met de implementatie van <em>SchrijfIni<\/em>.<br \/>\nWe geven onze klok een globaal karakter, dus de cgf-file moet in de map <em>ProgramData<\/em> komen te staan.<br \/>\nVerder willen we de volgende zaken opslaan:<\/p>\n<ul>\n<li>De positie van de klok (<em>Left<\/em> en <em>Top<\/em> van de form)<\/li>\n<li><em>OnTop<\/em> van de klok<\/li>\n<li>Het <em>Font<\/em> van de klok<\/li>\n<li>De voorgrondkleur van de klok<\/li>\n<li>De achtergrondkleur van de klok<\/li>\n<li>De doorzichtbaarheid<\/li>\n<\/ul>\n<p>De cfg-file moet er (ongeveer) als volgt uit gaan zien:<\/p>\n<p><em>[CLOCK]<\/em><br \/>\n<em> OnTop=-1<\/em><br \/>\n<em> Position-X=966<\/em><br \/>\n<em> Position-Y=76<\/em><\/p>\n<p><em>[FONT]<\/em><br \/>\n<em> Name=Microsoft Sans Serif<\/em><br \/>\n<em> Size=16<\/em><br \/>\n<em> ForeColor=0<\/em><br \/>\n<em> BackColor=536870912<\/em><br \/>\n<em> Style=Standard<\/em><\/p>\n<p><em>[OPACITY]<\/em><br \/>\n<em> Percentage=75<\/em><\/p>\n<p>U ziet dat dit nog erg lijkt op een ouderwetse ini-file.<\/p>\n<p>We gaan de eerste code &#8220;kloppen&#8221;:<\/p>\n<p><span style=\"font-family: terminal, monaco, monospace;\">&#8211; Ga naar de <em>implementation<\/em>-sectie, <em>procedure SchrijIni<\/em>.<\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Haal het commentaar weg.<\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Zet tussen de regels <em>procedure<\/em> &#8230; en <em>begin<\/em> de volgende regels code:<\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 var<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 ini: TINIFile;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 opacperc, fstyle: String;<\/span><\/em><\/strong><\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Ga nu tussen <em>begin<\/em> en <em>end<\/em>; staan.<\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Tik de volgende regels code in:<\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 ini := TINIFile.Create(GetAppConfigFile(True));<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 try<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 ini.WriteString(&#8216;CLOCK&#8217;,&#8217;OnTop&#8217;,BoolToStr(frmKlokje.FormStyle = fsSystemStayOnTop));<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 ini.WriteString(&#8216;CLOCK&#8217;,&#8217;Position-X&#8217;,IntToStr(frmKlokje.Left));<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 ini.WriteString(&#8216;CLOCK&#8217;,&#8217;Position-Y&#8217;,IntToStr(frmKlokje.Top));<\/span><\/em><\/strong><\/span><\/p>\n<p><span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">&#8211; \u00a0 \u00a0 ini.WriteString(&#8216;FONT&#8217;,&#8217;Name&#8217;,lblTijd.Font.Name);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 ini.WriteString(&#8216;FONT&#8217;,&#8217;Size&#8217;,IntToStr(lblTijd.Font.Size));<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \/\/Hier komt code voor de Font-Style<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 ini.WriteString(&#8216;FONT&#8217;,&#8217;ForeColor&#8217;,IntToStr(lblTijd.Font.Color));<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 ini.WriteString(&#8216;FONT&#8217;,&#8217;BackColor&#8217;,IntToStr(frmKlokje.Color));<\/span><\/em><\/strong><\/span><\/p>\n<p><span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">&#8211; \u00a0 \u00a0 if popOpacity100.Checked then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 opacperc := &#8216;100&#8217;;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 if popOpacity75.Checked then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 opacperc := &#8217;75&#8217;;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 if popOpacity50.Checked then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 opacperc := &#8217;50&#8217;;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 if popOpacity25.Checked then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 opacperc := &#8217;25&#8217;;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 ini.WriteString(&#8216;OPACITY&#8217;,&#8217;Percentage&#8217;,opacperc);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 finally<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 ini.Free;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 end;<\/span><\/em><\/strong><\/span><\/p>\n<p>Een hoop om even te bespreken. De class <em>TINIFile<\/em> zorgt ervoor dat er een ini-file (cfg-file dus) kan worden aangemaakt, er naar toe kan worden geschreven en eruit gelezen kan worden.<br \/>\nDeze <em>class<\/em> is echter, bij declaratie, nog geen instantie. Hij bestaat dus nog niet. Met de methode <em>Create<\/em> maken we de instantie aan. In dit geval verwacht <em>Create<\/em> de map en de naam van het ini-bestand. En daarvoor gebruiken we dus de eerder genoemde functie <em>GetAppConfigFile<\/em>.<\/p>\n<p>Vervolgens maken we gebruik van de methode <em>WriteString<\/em>. Deze methode verwacht drie parameters die allen van het type <em>String<\/em> zijn. De eerste parameter geeft de <em>sectie<\/em> aan, de tweede de zogenaamde <em>indent<\/em> en de derde de <em>waarde<\/em> van deze indent. Omdat ook de waarde van het type <em>String<\/em> is moeten dus de andere grootheden die geen <em>String<\/em> zijn worden omgezet in een string.<br \/>\nVoor een <em>Boolean<\/em> gebruiken we de functie <em>BoolToStr<\/em> en voor een geheel getal (<em>integer<\/em>) de functie <em>IntToStr<\/em>.<\/p>\n<p>Omdat er een instantie van de class <em>TINIFile<\/em> wordt gemaakt moet deze ook weer netjes worden afgesloten (in dit geval moet ook de text-file worden gesloten). Dit gebeurt met de methode <em>Free<\/em>. Omdat deze ALTIJD moet worden uitgevoerd zetten we de schrijfopdrachten e.d. tussen een <em>try-finally<\/em>-blok. Mocht er tussen <em>try<\/em> en <em>finally<\/em> iets mis gaan, dan wordt toch de code tussen <em>finally<\/em> en <em>end;<\/em> uitgevoerd (deze <em>end;<\/em> hoort dus bij <em>try-finally<\/em>!).<\/p>\n<h4>Set<\/h4>\n<p>Om de <em>Font-style<\/em> netjes te kunnen opslaan moeten we weten hoe de <em>Style<\/em> is opgebouwd. In Lazarus (Free-Pascal) is de <em>Style<\/em>-property van een <em>Font<\/em> een zogenaamde <em>Set<\/em> (een verzameling). We moeten deze <em>Set<\/em> dus gaan omzetten naar een <em>String<\/em>. Verder moet u weten dat de <em>Style<\/em> altijd minimaal <em>Standard<\/em> is.<\/p>\n<p><span style=\"font-family: terminal, monaco, monospace;\">Voeg op de plek van het commentaar (\/\/Hier komt code voor de Font-Style) de volgende code toe:<\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><em><strong><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 fstyle := &#8216;Standard, &#8216;;<\/span><\/strong><\/em><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><em><strong><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 if fsBold in lblTijd.Font.Style then<\/span><\/strong><\/em><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><em><strong><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 fstyle := fstyle + &#8216;Bold, &#8216;;<\/span><\/strong><\/em><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><em><strong><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 if fsItalic in lblTijd.Font.Style then<\/span><\/strong><\/em><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><em><strong><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 fstyle := fstyle + &#8216;Italic, &#8216;;<\/span><\/strong><\/em><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><em><strong><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 if fsStrikeOut in lblTijd.Font.Style then<\/span><\/strong><\/em><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><em><strong><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 fstyle := fstyle + &#8216;StrikeOut, &#8216;;<\/span><\/strong><\/em><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><em><strong><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 if fsUnderline in lblTijd.Font.Style then<\/span><\/strong><\/em><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><em><strong><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 fstyle := fstyle + &#8216;Underline, &#8216;;<\/span><\/strong><\/em><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><em><strong><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 fstyle := Copy(fstyle,1,Length(fstyle)-2);<\/span><\/strong><\/em><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><em><strong><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 ini.WriteString(&#8216;FONT&#8217;,&#8217;Style&#8217;,fstyle);<\/span><\/strong><\/em><\/span><\/p>\n<p>In bovenstaande code wordt de <em>String<\/em> <em>fstyle<\/em> netjes opgebouwd. De verschillende stijlen zijn netjes met een komma+spatie van elkaar gescheiden. Omdat deze komma+spatie ook aan het eind van fstyle staat worden deze d.m.v. een <em>Copy<\/em> weer weggehaald.<\/p>\n<p>Waar we nu nog even voor moeten zorgen is dat bij het sluiten van de klok de procedure <em>SchrijfIni<\/em> wordt aangeroepen.<br \/>\nOmdat het klokje op meerdere manieren gesloten kan worden (via het snelmenu, evt. dubbelklikken, maar ook via de taakbalk) is het handig om het <em>OnClose<\/em>-event van de <em>Form<\/em> te gaan gebruiken.<\/p>\n<p><span style=\"font-family: terminal, monaco, monospace;\">&#8211; Maak het <em>OnClose<\/em>-event van <em>frmKlokje<\/em> aan.<\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Voeg de volgende regel code toe:<\/span><br \/>\n&#8211; <span style=\"font-family: 'courier new', courier, monospace; font-size: 10pt;\"><em><strong>\u00a0 SchrijfIni<\/strong><\/em>;<\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Run de klok en sluit deze daarna weer af.<\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Bekijk de cfg-file in <em>C:\\ProgramData\\klokje<\/em>.<\/span><\/p>\n<p>Dit was al heel wat werk, zei het dat er enige repetitie in zit (ofwel copy-paste).<br \/>\nEn dit was nog wel het gemakkelijke gedeelte.<\/p>\n<h4>LeesIni<\/h4>\n<p>Nu moeten we <em>LeesIni<\/em> nog gaan implementeren.<\/p>\n<p>Laten we maar beginnen.<\/p>\n<p><em>LeesIni<\/em> gaat gebruik maken van de method <em>ReadString<\/em> dat een functie is en een <em>String<\/em> als waarde teruggeeft. <em>ReadString<\/em> heeft ook drie parameters: <em>sectie<\/em>, <em>indent<\/em> en een <em>default<\/em> waarde. De default waarde wordt toegekend als de indent in de cfg-file leeg is. Ook zullen we de <em>String<\/em> in voorkomende gevallen moet omzetten naar een <em>Boolean<\/em> of een getal. Dit doen we met de functies <em>StrToBool<\/em> en <em>TryStrToInt<\/em> die een <em>String<\/em> probeert om te zetten naar een <em>Integer<\/em> en als dan niet lukt de waarde <em>False<\/em> terug geeft. Ook moeten we na iedere <em>ReadString<\/em> een controle uitvoeren, zodat ons klokje niet gaat &#8220;hangen&#8221; vanwege een verkeerde waarde.<br \/>\nOverigens wordt door de functie <em>BoolToStr<\/em> de waarde <em>&#8216;-1&#8217;<\/em>\u00a0omgezet naar\u00a0<em>True<\/em> en de waarde <em>&#8216;0&#8217;<\/em>\u00a0omgezet naar <em>False<\/em>.<\/p>\n<p>Met deze kennis kunnen we aan de slag:<\/p>\n<p><span style=\"font-family: terminal, monaco, monospace;\">&#8211; Voeg aan de procedure <em>LeesIni<\/em> de volgende variabelen toe:<\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 var<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 ini: TINIFile;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 s, h: String;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 i: integer;<\/span><\/em><\/strong><\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Haal het commentaar weg en voeg na begin de volgende regels code toe:<\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 ini := TINIFile.Create(GetAppConfigFile(True));<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 try<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 s := ini.ReadString(&#8216;CLOCK&#8217;,&#8217;OnTop&#8217;,&#8221;);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 if s = &#8216;-1&#8217; then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 begin<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 frmKlokje.FormStyle := fsSystemStayOnTop;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 popOnTop.Checked := True;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 end<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 else<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 begin<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 frmKlokje.FormStyle := fsNormal;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 popOnTop.Checked := False;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 end;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 s := ini.ReadString(&#8216;CLOCK&#8217;,&#8217;Position-X&#8217;,&#8221;);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 if TryStrToInt(s,i) then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 frmKlokje.Left := i<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 else<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 frmKlokje.Left := 256;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 s := ini.ReadString(&#8216;CLOCK&#8217;,&#8217;Position-Y&#8217;,&#8221;);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 if TryStrToInt(s,i) then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 frmKlokje.Top := i<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 else<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 frmKlokje.Top := 130;<\/span><\/em><\/strong><\/span><\/p>\n<p><span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">&#8211; \u00a0 \u00a0 s := ini.ReadString(&#8216;FONT&#8217;,&#8217;Name&#8217;,&#8217;Arial&#8217;);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 lblTijd.Font.Name := s;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 s := ini.ReadString(&#8216;FONT&#8217;,&#8217;Size&#8217;,&#8221;);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 if TryStrToInt(s,i) then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 lblTijd.Font.Size := i<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 else<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 lblTijd.Font.Size := 14;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 lblTijd.Font.Style := [];<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 s := ini.ReadString(&#8216;FONT&#8217;,&#8217;Style&#8217;,&#8221;);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 s := s + &#8216;,&#8217;;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 i := Pos(&#8216;,&#8217;, s);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 while i &gt; 0 do<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 begin<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 h := Trim(Copy(s,1,i-1));<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 if UpperCase(h) = &#8216;BOLD&#8217; then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 lblTijd.Font.Style := lblTijd.Font.Style + [fsBold];<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 if UpperCase(h) = &#8216;ITALIC&#8217; then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 lblTijd.Font.Style := lblTijd.Font.Style + [fsItalic];<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 if UpperCase(h) = &#8216;STRIKEOUT&#8217; then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 lblTijd.Font.Style := lblTijd.Font.Style + [fsStrikeOut];<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 if UpperCase(h) = &#8216;UNDERLINE&#8217; then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 lblTijd.Font.Style := lblTijd.Font.Style + [fsUnderline];<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 s := Copy(s,i+1,Length(s));<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 i := Pos(&#8216;,&#8217;, s);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 end;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 s := ini.ReadString(&#8216;FONT&#8217;,&#8217;ForeColor&#8217;,&#8221;);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 if TryStrToInt(s,i) then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 lblTijd.Font.Color := i<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 else<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 lblTijd.Font.Color := RGBToColor(0, 0, 0); \/\/zwart<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 s := ini.ReadString(&#8216;FONT&#8217;,&#8217;BackColor&#8217;,&#8221;);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 if TryStrToInt(s,i) then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 frmKlokje.Color := i<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 else<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 frmKlokje.Color := RGBToColor(127, 127, 127); \/\/grijs<\/span><\/em><\/strong><\/span><\/p>\n<p><span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">&#8211; \u00a0 \u00a0 popOpacity100.Checked := True;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 popOpacity75.Checked := False;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 popOpacity50.Checked := False;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 popOpacity25.Checked := False;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 frmKlokje.AlphaBlendValue := 255;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 s := ini.ReadString(&#8216;OPACITY&#8217;,&#8217;Percentage&#8217;,&#8221;);<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 if s = &#8217;25&#8217; then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 begin<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 popOpacity100.Checked := False;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 popOpacity25.Checked := True;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 frmKlokje.AlphaBlendValue := 64;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 end;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 if s = &#8217;50&#8217; then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 begin<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 popOpacity100.Checked := False;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 popOpacity50.Checked := True;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 frmKlokje.AlphaBlendValue := 128;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 end;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 if s = &#8217;75&#8217; then<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 begin<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 popOpacity100.Checked := False;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 popOpacity75.Checked := True;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 \u00a0 frmKlokje.AlphaBlendValue := 191;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 \u00a0 end;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 finally<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 \u00a0 ini.Free;<\/span><\/em><\/strong><\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 end;<\/span><\/em><\/strong><\/span><\/p>\n<p>Rest ons niets anders dan <em>LeesIni<\/em> op de juiste plaats op te nemen in de code.<br \/>\nDeze plaats is het <em>OnActivate<\/em> event van de <em>Form<\/em>.<\/p>\n<p><span style=\"font-family: terminal, monaco, monospace;\">&#8211; Activeer het <em>OnActivate<\/em> event van het form.<\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Neem de volgende regel code op:<\/span><br \/>\n&#8211; <span style=\"font-size: 10pt;\"><strong><em><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0 LeesIni;<\/span><\/em><\/strong><\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Run de klok, pas wat instellingen aan en verplaats de klok.<\/span><br \/>\n<span style=\"font-family: terminal, monaco, monospace;\"> &#8211; Sluit de klok af en start weer opnieuw op.<\/span><\/p>\n<p>Als het goed is zijn alle instellingen van de eerste keer de tweede keer actief.<\/p>\n<p>In de volgende aflevering gaan we iets geheel nieuw doen. We gaan tekenen. Jawel, de analoge klok staat op het programma.<\/p>\n<p><a href=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-analoog\/\">Naar de volgende aflevering&#8230;<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>De ouderwetse ini-file in een nieuw jasje. In deze aflevering gaan we alle instellingen en de positie van het klokje bewaren, zodat deze weer actief worden bij een volgende start. We gaan twee procedures maken: LeesIni en SchrijfIni. Met LeesIni lezen we de opgeslagen instellingen en passen deze toe voordat de klok gaat werken. Met [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1121,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"templates\/template-full-width.php","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"class_list":["post-1131","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Lazarus-Klokje-Instellingen bewaren - Wiskunst<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-instellingen-bewaren\/\" \/>\n<meta property=\"og:locale\" content=\"nl_NL\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Lazarus-Klokje-Instellingen bewaren - Wiskunst\" \/>\n<meta property=\"og:description\" content=\"De ouderwetse ini-file in een nieuw jasje. In deze aflevering gaan we alle instellingen en de positie van het klokje bewaren, zodat deze weer actief worden bij een volgende start. We gaan twee procedures maken: LeesIni en SchrijfIni. Met LeesIni lezen we de opgeslagen instellingen en passen deze toe voordat de klok gaat werken. Met [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-instellingen-bewaren\/\" \/>\n<meta property=\"og:site_name\" content=\"Wiskunst\" \/>\n<meta property=\"article:modified_time\" content=\"2022-05-24T11:48:00+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Geschatte leestijd\" \/>\n\t<meta name=\"twitter:data1\" content=\"9 minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/lazarus-klokje-intro\\\/lazarus-klokje-instellingen-bewaren\\\/\",\"url\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/lazarus-klokje-intro\\\/lazarus-klokje-instellingen-bewaren\\\/\",\"name\":\"Lazarus-Klokje-Instellingen bewaren - Wiskunst\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wiskunst.nl\\\/#website\"},\"datePublished\":\"2022-05-24T11:17:44+00:00\",\"dateModified\":\"2022-05-24T11:48:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/lazarus-klokje-intro\\\/lazarus-klokje-instellingen-bewaren\\\/#breadcrumb\"},\"inLanguage\":\"nl-NL\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/lazarus-klokje-intro\\\/lazarus-klokje-instellingen-bewaren\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/lazarus-klokje-intro\\\/lazarus-klokje-instellingen-bewaren\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wiskunst.nl\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Programmeren\",\"item\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Delphi\\\/Lazarus\",\"item\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Lazarus-Klokje-Intro\",\"item\":\"https:\\\/\\\/wiskunst.nl\\\/index.php\\\/programmeren1\\\/delphi-lazarus\\\/lazarus-klokje-intro\\\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Lazarus-Klokje-Instellingen bewaren\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wiskunst.nl\\\/#website\",\"url\":\"https:\\\/\\\/wiskunst.nl\\\/\",\"name\":\"Wiskunst\",\"description\":\"2\u221e\u2227&gt;\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wiskunst.nl\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"nl-NL\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Lazarus-Klokje-Instellingen bewaren - Wiskunst","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-instellingen-bewaren\/","og_locale":"nl_NL","og_type":"article","og_title":"Lazarus-Klokje-Instellingen bewaren - Wiskunst","og_description":"De ouderwetse ini-file in een nieuw jasje. In deze aflevering gaan we alle instellingen en de positie van het klokje bewaren, zodat deze weer actief worden bij een volgende start. We gaan twee procedures maken: LeesIni en SchrijfIni. Met LeesIni lezen we de opgeslagen instellingen en passen deze toe voordat de klok gaat werken. Met [&hellip;]","og_url":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-instellingen-bewaren\/","og_site_name":"Wiskunst","article_modified_time":"2022-05-24T11:48:00+00:00","twitter_card":"summary_large_image","twitter_misc":{"Geschatte leestijd":"9 minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-instellingen-bewaren\/","url":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-instellingen-bewaren\/","name":"Lazarus-Klokje-Instellingen bewaren - Wiskunst","isPartOf":{"@id":"https:\/\/wiskunst.nl\/#website"},"datePublished":"2022-05-24T11:17:44+00:00","dateModified":"2022-05-24T11:48:00+00:00","breadcrumb":{"@id":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-instellingen-bewaren\/#breadcrumb"},"inLanguage":"nl-NL","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-instellingen-bewaren\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/lazarus-klokje-instellingen-bewaren\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wiskunst.nl\/"},{"@type":"ListItem","position":2,"name":"Programmeren","item":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/"},{"@type":"ListItem","position":3,"name":"Delphi\/Lazarus","item":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/"},{"@type":"ListItem","position":4,"name":"Lazarus-Klokje-Intro","item":"https:\/\/wiskunst.nl\/index.php\/programmeren1\/delphi-lazarus\/lazarus-klokje-intro\/"},{"@type":"ListItem","position":5,"name":"Lazarus-Klokje-Instellingen bewaren"}]},{"@type":"WebSite","@id":"https:\/\/wiskunst.nl\/#website","url":"https:\/\/wiskunst.nl\/","name":"Wiskunst","description":"2\u221e\u2227&gt;","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wiskunst.nl\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"nl-NL"}]}},"_links":{"self":[{"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/pages\/1131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/comments?post=1131"}],"version-history":[{"count":4,"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/pages\/1131\/revisions"}],"predecessor-version":[{"id":1173,"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/pages\/1131\/revisions\/1173"}],"up":[{"embeddable":true,"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/pages\/1121"}],"wp:attachment":[{"href":"https:\/\/wiskunst.nl\/index.php\/wp-json\/wp\/v2\/media?parent=1131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}