﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.howtodothings.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>HowToDoThings.com Delphi</title>
 <link>http://www.howtodothings.com/computers/c39-delphi.html</link>
 <description>A list of recent articles by category as Teasers.</description>
 <language>en</language>
<item>
 <title>Purchase order lines</title>
 <link>http://www.howtodothings.com/computers/a1516-purchase-order-lines.html</link>
 <description>&lt;p&gt;When creating an association in ECO you are not guaranteed the order in which the objects at the end of the association will be presented.&amp;nbsp; For this reason ECO provides a Boolean &amp;quot;ordered&amp;quot; property on association ends.&lt;/p&gt;
&lt;p&gt; When you set Ordered = True in your model and then generate your database, ECO will create an additional column in your database identifying the sequence of the objects.&lt;/p&gt;
&lt;p&gt; I have just been creating SalesInvoice / SalesInvoiceLine classes and chose to have an ordered association, basically because it is standard industry practise to identify each line of an Invoice/Order with a sequencial number, making it easily identifyable when discussing it.&lt;/p&gt;
&lt;p&gt; It would have been nice if I could have used an OCL derived attribute with an expression similar to this:&lt;/p&gt;
&lt;p&gt;this.SalesInvoice.lines-&amp;gt;indexOf(self)&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.howtodothings.com/computers/a1516-purchase-order-lines.html&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.howtodothings.com/computers/a1516-purchase-order-lines.html#comments</comments>
 <category domain="http://www.howtodothings.com/computers/c39-delphi.html">Delphi</category>
 <pubDate>Tue, 23 Aug 2005 05:23:00 -0500</pubDate>
 <dc:creator>Peter5</dc:creator>
 <guid isPermaLink="false">638 at http://www.howtodothings.com</guid>
</item>
<item>
 <title>Application.ProcessMessages replacement</title>
 <link>http://www.howtodothings.com/computers/a1514-applicationprocessmessages-replacement.html</link>
 <description>&lt;p&gt;Not only is Application.ProcessMessages quite long to type, often extra functionality needs to be called when its used.&amp;nbsp; To this end I have created two basic wrappers which can be used in its place:&lt;/p&gt;
&lt;p&gt; ...&lt;/p&gt;
&lt;p&gt; procedure ProcessMsg(); overload;&lt;br /&gt; procedure ProcessMsg(const SleepFor: Word); overload;&lt;/p&gt;
&lt;p&gt; implementation&lt;/p&gt;
&lt;p&gt; procedure ProcessMsg();&lt;br /&gt; begin&lt;br /&gt; &amp;nbsp; ProcessMsg(0);&lt;br /&gt; end;&lt;/p&gt;
&lt;p&gt; procedure ProcessMsg(const SleepFor: Word); overload;&lt;br /&gt; begin&lt;br /&gt; &amp;nbsp; Application.ProcessMessages();&lt;br /&gt; &amp;nbsp; Sleep(SleepFor);&lt;br /&gt; end;&lt;/p&gt;
&lt;p&gt; ...&lt;/p&gt;
&lt;p&gt; Now instead of writing Application.ProcessMessages(); in your code you can write ProcessMsg(); instead.&amp;nbsp; And in the future you can extend what happens around Application.ProcessMessages calls without visiting lots of different areas of your code.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.howtodothings.com/computers/a1514-applicationprocessmessages-replacement.html&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.howtodothings.com/computers/a1514-applicationprocessmessages-replacement.html#comments</comments>
 <category domain="http://www.howtodothings.com/computers/c39-delphi.html">Delphi</category>
 <pubDate>Mon, 15 Aug 2005 06:46:00 -0500</pubDate>
 <dc:creator />
 <guid isPermaLink="false">636 at http://www.howtodothings.com</guid>
</item>
<item>
 <title>How to retrieve AutoInc Values with BDP in Delphi 2005</title>
 <link>http://www.howtodothings.com/computers/a1513-how-to-retrieve-autoinc-values-with-bdp-in-delphi-2005.html</link>
 <description>&lt;p&gt;In this article I’ll use the term “Identity” interchangeably to note Auto generated  (from RDMS) values usually for a column representing the primary key of a table. These are called “sequences” in Oracle and “generators”  in Interbase.&lt;br /&gt; Actually, there are 3 options to get the identity value back using ADO .NET in general:
&lt;ol&gt;
&lt;li&gt;Use a batch query (the database obviously has to support this)&lt;/li&gt;
&lt;li&gt;Use a stored procedure (as the Insert command) having as an output parameter the “Identity” value (this is the fastest and thus recommended method)&lt;/li&gt;
&lt;li&gt;Handle Adapter&#039;s RowUpdated /RowUpdating event and issue a &amp;quot;SELECT @@IDENTITY &amp;quot; (in case of SQL Server) query in code in this event handler (slowest) &lt;/li&gt;
&lt;/ol&gt;
&lt;p class=&quot;MsoNormal&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.howtodothings.com/computers/a1513-how-to-retrieve-autoinc-values-with-bdp-in-delphi-2005.html&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.howtodothings.com/computers/a1513-how-to-retrieve-autoinc-values-with-bdp-in-delphi-2005.html#comments</comments>
 <category domain="http://www.howtodothings.com/computers/c39-delphi.html">Delphi</category>
 <pubDate>Sun, 14 Aug 2005 14:42:00 -0500</pubDate>
 <dc:creator />
 <guid isPermaLink="false">635 at http://www.howtodothings.com</guid>
</item>
<item>
 <title>Parameter exists</title>
 <link>http://www.howtodothings.com/computers/a1512-parameter-exists.html</link>
 <description>&lt;p&gt;You will need the function in this article (&lt;a href=&quot;http://www.howtodothings.com/ViewArticle.aspx?Article=760&quot; title=&quot;http://www.howtodothings.com/ViewArticle.aspx?Article=760&quot;&gt;http://www.howtodothings.com/ViewArticle.aspx?Article=760&lt;/a&gt;) to get this working properly&lt;/p&gt;
&lt;p&gt; function ParamExists(const ParamName: string): Boolean;&lt;br /&gt; var&lt;br /&gt; &amp;nbsp; S: string;&lt;br /&gt; begin&lt;br /&gt; &amp;nbsp; Result := GetParameterValue(ParamName, [&#039;/&#039;, &#039;-&#039;], &#039;:&#039;, S);&lt;br /&gt; end;&lt;/p&gt;
</description>
 <comments>http://www.howtodothings.com/computers/a1512-parameter-exists.html#comments</comments>
 <category domain="http://www.howtodothings.com/computers/c39-delphi.html">Delphi</category>
 <pubDate>Wed, 10 Aug 2005 00:55:00 -0500</pubDate>
 <dc:creator />
 <guid isPermaLink="false">634 at http://www.howtodothings.com</guid>
</item>
<item>
 <title>Get command line parameters</title>
 <link>http://www.howtodothings.com/computers/a1511-get-command-line-parameters.html</link>
 <description>&lt;p&gt;(* GetParameterValue&lt;/p&gt;
&lt;p&gt; GetParameterValue will return the value associated with a parameter name in the form of&lt;/p&gt;
&lt;p&gt; /paramname:paramvalue&lt;br /&gt; -paramname:paramvalue&lt;/p&gt;
&lt;p&gt; and&lt;/p&gt;
&lt;p&gt; /paramname&lt;br /&gt; -paramname&lt;/p&gt;
&lt;p&gt; ParamName - Name of the parameter (paramname)&lt;br /&gt; SwitchChars - Parameter switch identifiers (/ or -)&lt;br /&gt; Seperator - The char that sits between paramname and paramvalue (:)&lt;br /&gt; Value - The value of the parameter (paramvalue) if it exists&lt;/p&gt;
&lt;p&gt; Returns - Boolean, true if the parameter was found, false if parameter does not exist&lt;/p&gt;
&lt;p&gt; typical usage&lt;/p&gt;
&lt;p&gt; Parameter&lt;br /&gt; -P=c:\temp\&lt;br /&gt; -S&lt;/p&gt;
&lt;p&gt; GetParameterValue(&#039;p&#039;, [&#039;/&#039;, &#039;-&#039;], &#039;=&#039;, sValue);&lt;/p&gt;
&lt;p&gt; sValue will contain c:\temp\&lt;/p&gt;
&lt;p&gt; *)&lt;br /&gt; function GetParameterValue(const ParamName: string; SwitchChars: TSysCharSet;&lt;br /&gt; &amp;nbsp; Seperator: Char; var Value: string): Boolean;&lt;br /&gt; var&lt;br /&gt; &amp;nbsp; I, Sep: Longint;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.howtodothings.com/computers/a1511-get-command-line-parameters.html&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.howtodothings.com/computers/a1511-get-command-line-parameters.html#comments</comments>
 <category domain="http://www.howtodothings.com/computers/c39-delphi.html">Delphi</category>
 <pubDate>Wed, 10 Aug 2005 00:53:00 -0500</pubDate>
 <dc:creator />
 <guid isPermaLink="false">633 at http://www.howtodothings.com</guid>
</item>
<item>
 <title>Get the size of a file</title>
 <link>http://www.howtodothings.com/computers/a1510-get-the-size-of-a-file.html</link>
 <description>&lt;p&gt;function GetFileSize(const FileName: string): Integer;&lt;br /&gt; var&lt;br /&gt; &amp;nbsp; sr: TSearchRec;&lt;br /&gt; begin&lt;br /&gt; &amp;nbsp; Result := 0;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; if FindFirst(FileName, faAnyFile, sr) = 0 then&lt;br /&gt; &amp;nbsp; begin&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; Result := sr.Size;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; FindClose(sr);&lt;br /&gt; &amp;nbsp; end;&lt;br /&gt; end;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
</description>
 <comments>http://www.howtodothings.com/computers/a1510-get-the-size-of-a-file.html#comments</comments>
 <category domain="http://www.howtodothings.com/computers/c39-delphi.html">Delphi</category>
 <pubDate>Wed, 10 Aug 2005 00:52:00 -0500</pubDate>
 <dc:creator />
 <guid isPermaLink="false">632 at http://www.howtodothings.com</guid>
</item>
<item>
 <title>BaseForm class</title>
 <link>http://www.howtodothings.com/computers/a1509-baseform-class.html</link>
 <description>&lt;p&gt;Have you ever found yourself adding the same code to different forms?&amp;nbsp; Well now you can use the following as a base class for all forms.&lt;/p&gt;
&lt;p&gt; ===============&amp;nbsp;&amp;nbsp; BEGIN CODE&amp;nbsp; ======================&lt;br /&gt; unit BaseForm;&lt;/p&gt;
&lt;p&gt; interface&lt;/p&gt;
&lt;p&gt; uses SysUtils, Classes, Forms, Windows;&lt;/p&gt;
&lt;p&gt; type&lt;br /&gt; &amp;nbsp; TBaseForm = class(TForm)&lt;br /&gt; &amp;nbsp; protected&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; function IsModal(): Boolean;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; procedure KeyDown(var Key: Word; Shift: TShiftState); override;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; procedure ShowError(E: Exception);&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; function MsgBox(Msg: string;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uType: Integer = MB_OK or MB_ICONSTOP): Integer; overload;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; function MsgBox(Msg, MsgCaption: string;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uType: Integer = MB_OK or MB_ICONSTOP): Integer; overload;&lt;br /&gt; &amp;nbsp; end;&lt;/p&gt;
&lt;p&gt; implementation&lt;/p&gt;
&lt;p&gt; uses Controls;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.howtodothings.com/computers/a1509-baseform-class.html&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.howtodothings.com/computers/a1509-baseform-class.html#comments</comments>
 <category domain="http://www.howtodothings.com/computers/c39-delphi.html">Delphi</category>
 <pubDate>Wed, 10 Aug 2005 00:51:00 -0500</pubDate>
 <dc:creator />
 <guid isPermaLink="false">631 at http://www.howtodothings.com</guid>
</item>
<item>
 <title>MsgBox function</title>
 <link>http://www.howtodothings.com/computers/a1508-msgbox-function.html</link>
 <description>&lt;p&gt;Personally I find both the WinAPI MessageBox and Application.MessageBox and MessageDlg functions cludgy and always add the following function to every app.&lt;/p&gt;
&lt;p&gt; function MsgBox(const Msg: string;&lt;br /&gt; &amp;nbsp; MsgType: Integer = MB_OK or MB_ICONSTOP): Integer;&lt;br /&gt; begin&lt;br /&gt; &amp;nbsp; Result := MessageBox(Application.Handle, PChar(Msg),&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; PChar(Application.Title), MsgType);&lt;br /&gt; end;&lt;/p&gt;
&lt;p&gt; requires that Forms.pas is in the uses clause.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
</description>
 <comments>http://www.howtodothings.com/computers/a1508-msgbox-function.html#comments</comments>
 <category domain="http://www.howtodothings.com/computers/c39-delphi.html">Delphi</category>
 <pubDate>Wed, 10 Aug 2005 00:46:00 -0500</pubDate>
 <dc:creator />
 <guid isPermaLink="false">630 at http://www.howtodothings.com</guid>
</item>
<item>
 <title>Remove ReadOnly flag from file</title>
 <link>http://www.howtodothings.com/computers/a1507-remove-readonly-flag-from-file.html</link>
 <description>&lt;p&gt;The following function will attempt to remove the read only flag on a file, you will need the function in this article (&lt;a href=&quot;http://www.howtodothings.com/ViewArticle.aspx?Article=755&quot; title=&quot;http://www.howtodothings.com/ViewArticle.aspx?Article=755&quot;&gt;http://www.howtodothings.com/ViewArticle.aspx?Article=755&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt; function RemoveReadOnly(const FileName: string): Boolean;&lt;br /&gt; begin&lt;br /&gt; &amp;nbsp; (* Assume Success *)&lt;br /&gt; &amp;nbsp; Result := True;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; (* Make sure the file is read only before&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; we try and change the attributes *)&lt;br /&gt; &amp;nbsp; if (IsReadOnly(FileName)) then&lt;br /&gt; &amp;nbsp; begin&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; SetFileAttributes(PChar(FileName), FILE_ATTRIBUTE_NORMAL);&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; Result := not IsReadOnly(FileName);&lt;br /&gt; &amp;nbsp; end;&lt;br /&gt; end;&lt;/p&gt;
</description>
 <comments>http://www.howtodothings.com/computers/a1507-remove-readonly-flag-from-file.html#comments</comments>
 <category domain="http://www.howtodothings.com/computers/c39-delphi.html">Delphi</category>
 <pubDate>Wed, 10 Aug 2005 00:43:00 -0500</pubDate>
 <dc:creator />
 <guid isPermaLink="false">629 at http://www.howtodothings.com</guid>
</item>
<item>
 <title>Detect if file is ReadOnly</title>
 <link>http://www.howtodothings.com/computers/a1506-detect-if-file-is-readonly.html</link>
 <description>&lt;p&gt;The following function will return True if a file is read only.&lt;/p&gt;
&lt;p&gt; function IsReadOnly(const FileName: string): Boolean;&lt;br /&gt; var&lt;br /&gt; &amp;nbsp; sr: TSearchRec;&lt;br /&gt; begin&lt;br /&gt; &amp;nbsp; (* Assume not read only *)&lt;br /&gt; &amp;nbsp; Result := False;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; if FindFirst(FileName, faAnyFile, sr) = 0 then&lt;br /&gt; &amp;nbsp; begin&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; Result := (sr.Attr and faReadOnly) &amp;lt;&amp;gt; 0;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; FindClose(sr);&lt;br /&gt; &amp;nbsp; end;&lt;br /&gt; end;&lt;/p&gt;
</description>
 <comments>http://www.howtodothings.com/computers/a1506-detect-if-file-is-readonly.html#comments</comments>
 <category domain="http://www.howtodothings.com/computers/c39-delphi.html">Delphi</category>
 <pubDate>Wed, 10 Aug 2005 00:41:00 -0500</pubDate>
 <dc:creator />
 <guid isPermaLink="false">628 at http://www.howtodothings.com</guid>
</item>
</channel>
</rss>
