<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[My Visual Database — TableGrid Alternating Row Colour Procedure]]></title>
		<link>https://myvisualdatabase.com/forum/viewtopic.php?id=2886</link>
		<atom:link href="https://myvisualdatabase.com/forum/extern.php?action=feed&amp;tid=2886&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in TableGrid Alternating Row Colour Procedure.]]></description>
		<lastBuildDate>Sat, 19 Nov 2016 16:35:22 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: TableGrid Alternating Row Colour Procedure]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=17260#p17260</link>
			<description><![CDATA[<p><strong>@Dmitry</strong> &amp; <strong>@Jean</strong> - I&#039;m running Windows 10 too. Did a search and came up with the following that works for me.<br />Uncheck the box &quot;Always ask...when opening this file...&quot; when you first open the file. Afterwards, the popup no longer appears and you can read the CHM file&#039;s contents. After doing this the file opens as expected - no need to rely on 3rd party software, but thanks, <strong>@Jean</strong> for posting what worked for you <img src="https://myvisualdatabase.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" />.</p>]]></description>
			<author><![CDATA[null@example.com (clyde)]]></author>
			<pubDate>Sat, 19 Nov 2016 16:35:22 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=17260#p17260</guid>
		</item>
		<item>
			<title><![CDATA[Re: TableGrid Alternating Row Colour Procedure]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=17255#p17255</link>
			<description><![CDATA[<p>Hello Clyde, hello Dmitry</p><p>I can read this chm fie.<br />My PC is running under Windows 10 which don&#039;t want read this kind of file.<br />Therefore, you (and I) can read with SUMATRA PDF from 1.9.<br />Dedicated to PDF file it is able to read CHM file.</p><p>This help file about Bergsoft is very interesting.<br />So, if the need arises, we can ask Dmitry to implement some functions</p><p>JB</p>]]></description>
			<author><![CDATA[null@example.com (jean.brezhonek)]]></author>
			<pubDate>Fri, 18 Nov 2016 19:10:25 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=17255#p17255</guid>
		</item>
		<item>
			<title><![CDATA[Re: TableGrid Alternating Row Colour Procedure]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=17254#p17254</link>
			<description><![CDATA[<p><strong>@Dmitry</strong> - Thanks for the Bergsoft info, but the help file is empty - just a TreeView on the left with no content displayed when clicking on one of the TreeView nodes <img src="https://myvisualdatabase.com/forum/img/smilies/sad.png" width="15" height="15" alt="sad" /></p>]]></description>
			<author><![CDATA[null@example.com (clyde)]]></author>
			<pubDate>Fri, 18 Nov 2016 13:18:16 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=17254#p17254</guid>
		</item>
		<item>
			<title><![CDATA[Re: TableGrid Alternating Row Colour Procedure]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=17245#p17245</link>
			<description><![CDATA[<div class="quotebox"><cite>clyde wrote:</cite><blockquote><p>@Dmitry - That was exactly what I was looking for - thank you! I have one question though, is TdbStringGridEx referenced anywhere in the documentation or the functions reference in the code editor? I couldn&#039;t find it. Anyway, I&#039;ve added an example project file to show how I&#039;m using it. Hope it can help some other forum members.</p></blockquote></div><p>For grid Iam using component TNextGrid 5 from bergsoft.net.<br />Please download attached help file for the component, look section &quot;GridView&quot;</p>]]></description>
			<author><![CDATA[null@example.com (DriveSoft)]]></author>
			<pubDate>Fri, 18 Nov 2016 11:13:03 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=17245#p17245</guid>
		</item>
		<item>
			<title><![CDATA[Re: TableGrid Alternating Row Colour Procedure]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=17229#p17229</link>
			<description><![CDATA[<p>@Dmitry - That was exactly what I was looking for - thank you! I have one question though, is TdbStringGridEx referenced anywhere in the documentation or the functions reference in the code editor? I couldn&#039;t find it. Anyway, I&#039;ve added an example project file to show how I&#039;m using it. Hope it can help some other forum members.</p>]]></description>
			<author><![CDATA[null@example.com (clyde)]]></author>
			<pubDate>Thu, 17 Nov 2016 21:57:54 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=17229#p17229</guid>
		</item>
		<item>
			<title><![CDATA[Re: TableGrid Alternating Row Colour Procedure]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=17222#p17222</link>
			<description><![CDATA[<p>Hello Dmitry, hello Clyde</p><p>Good idea to create a procedure apart to reuse it without write it again and again</p><p>I note this code in my snippets collector</p><p>Thanks</p><p>JB</p>]]></description>
			<author><![CDATA[null@example.com (jean.brezhonek)]]></author>
			<pubDate>Thu, 17 Nov 2016 17:21:35 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=17222#p17222</guid>
		</item>
		<item>
			<title><![CDATA[Re: TableGrid Alternating Row Colour Procedure]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=17212#p17212</link>
			<description><![CDATA[<p><strong>clyde</strong></p><p>Example:<br /></p><div class="codebox"><pre><code>procedure Form1_TableGrid1_OnChange (Sender: string);
begin
    TableGrid_OnChange(Form1.TableGrid1);
end;

procedure Form1_GridEmployees_OnChange (Sender: string);
begin
    TableGrid_OnChange(Form1.GridEmployees);
end;


procedure TableGrid_OnChange (Sender: TdbStringGridEx);
var
   i,k: integer;
begin
    for i := 0 to Sender.RowCount - 1 do
    begin
        for k := 0 to Sender.Columns.Count - 1 do
        begin
            Sender.Cell[k,i].Color := $00F0F0F0;
        end;
    end;
end;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (DriveSoft)]]></author>
			<pubDate>Thu, 17 Nov 2016 11:35:19 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=17212#p17212</guid>
		</item>
		<item>
			<title><![CDATA[Re: TableGrid Alternating Row Colour Procedure]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=17203#p17203</link>
			<description><![CDATA[<p>Hello Clyde</p><p>It is true, with 20 tablegrids on 20 differents forms, </p><p>It is unnecessary to code 20 times the same snippet.<br />The idea would be to create a single procedure in which the name of the tablegrid concerned would be passed as a parameter.<br />The following code would allow this but with the current version of MVD (2.8), you can not work on the canvas of the grid.</p><p>This code </p><p>procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);<br />const&nbsp; RowHeight = 18;&nbsp; &nbsp; // Value to change if necessary<br />begin<br />&nbsp; DBGrid1.Canvas.Font.Color := clBlack;<br />&nbsp; if Odd(rect.top div RowHeight) then<br />&nbsp; &nbsp; DBGrid1.canvas.Brush.Color := clAqua<br />&nbsp; else<br />&nbsp; &nbsp; DBGrid1.Canvas.Brush.Color := clWhite;<br />&nbsp; DBGrid1.canvas.TextRect(rect,rect.Left,rect.top,table.fields[DataCol].AsString);<br />end;</p><p>Perhaps Dmitry would have another solution?</p><p>JB</p>]]></description>
			<author><![CDATA[null@example.com (jean.brezhonek)]]></author>
			<pubDate>Thu, 17 Nov 2016 09:25:13 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=17203#p17203</guid>
		</item>
		<item>
			<title><![CDATA[Re: TableGrid Alternating Row Colour Procedure]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=17198#p17198</link>
			<description><![CDATA[<p><strong>@jean</strong> - Many thanks for your response. I mistakenly included the wrong procedure in my previous post. My apologies. I have created the code below and it works fine for colouring alternate TableGrid rows. My question is how do I pass a TableGrid object (and the Form object) into the procedure so I can use the one procedure to colour alternate TableGrid rows no matter what form they live on in my project? If I had 20 forms in my project, each with a TableGrid on them, would I have to duplicate this procedure 20 times? Ideally, so I didn&#039;t have to duplicate code for each Form/Tablegrid object, I would want to call just one procedure and pass into it the form (on which the TableGrid object lives) and the TableGrid object who&#039;s rows I want to colour. The procedure&#039;s signature would perhaps look like this:<br /></p><div class="codebox"><pre><code>AlternateRowColours(&lt;The Form object that holds the TableGrid object&gt;,&lt;The TableGrid object whose rows I want to colour&gt;)</code></pre></div><p> I hope this makes sense. Any help greatly appreciated. I&#039;m having a blast with MVD. </p><div class="codebox"><pre><code> procedure AlternateRowColours;
var
   i,k,r,c: integer;
begin
     r := frmExpenseDS.TableGrid1.RowCount - 1;
     c := frmExpenseDS.TableGrid1.Columns.Count - 1;
     for i := 0 to r do
          begin
           if i mod 2 = 0 then
              begin
                for k := 0 to c do
                  begin
                    frmExpenseDS.TableGrid1.Cell[k,i].Color := $00F0F0F0;
                  end;
              end;
          end;
end;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (clyde)]]></author>
			<pubDate>Thu, 17 Nov 2016 00:51:32 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=17198#p17198</guid>
		</item>
		<item>
			<title><![CDATA[Re: TableGrid Alternating Row Colour Procedure]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=17193#p17193</link>
			<description><![CDATA[<p>Hello Clyde</p><p>If I have well understood what you want (Color the grid one line out of two), you could use this code</p><p>procedure Form1_TableGrid1_OnChange (Sender: string);<br />var&nbsp; c,q&nbsp; &nbsp; &nbsp;: integer;<br />&nbsp; &nbsp; &nbsp;iRow,iCol : integer;<br />begin<br />&nbsp; &nbsp; &nbsp; &nbsp; c := Form1_TableGrid1.RowCount - 1;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// On colorie la grille une ligne sur deux<br />&nbsp; &nbsp; &nbsp; q := Form1_TableGrid1.Columns.Count-1;<br />&nbsp; &nbsp; &nbsp; for iRow := 0 to c do<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for iCol := 0 to q do<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if iRow mod 2 = 0 then Form1_TableGrid1.Cell[iCol,iRow].Color := clSkyBlue;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br />end;</p><p>Does this help you ?</p><p>JB</p>]]></description>
			<author><![CDATA[null@example.com (jean.brezhonek)]]></author>
			<pubDate>Wed, 16 Nov 2016 19:33:48 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=17193#p17193</guid>
		</item>
		<item>
			<title><![CDATA[TableGrid Alternating Row Colour Procedure]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=17189#p17189</link>
			<description><![CDATA[<p>Hello.<br />I&#039;ve created two procedures. ShowAlternateRowColours and ClearAlternateRowColours. They turn on/turn off alternating row colours in a TableGrid. As I want to use these procedures for all TableGrids I create, how can I call these procedures and pass them a tablegrid object? Ideally, it would look something like the code stub below. I&#039;m fairly certain I&#039;ll need to instantiate a TableGrid object and pass that into the procedure, but I don&#039;t know how to do that. Many thanks.</p><div class="codebox"><pre><code>procedure ShowAlternateRowColours(&lt;TableGrid&gt;);
var
   i,k: integer;
begin
     for i := 0 to frmExpenseDS.&lt;TableGrid&gt;.RowCount - 1 do
         begin
            for k := 0 to frmExpenseDS.&lt;TableGrid&gt;.Columns.Count - 1 do
              begin
                frmExpenseDS.&lt;TableGrid&gt;.Cell[k,i].Color := $00F0F0F0;
              end;
         end;
end;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (clyde)]]></author>
			<pubDate>Wed, 16 Nov 2016 16:04:01 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=17189#p17189</guid>
		</item>
	</channel>
</rss>
