Mattias Gaertner wrote 14 lines
On Thu, 16 Jan 2003 07:29:05 -0400
"Luis R. Hilario B." wrote:
>lazarus/examples/comdialogs
>In this example the window appears with color (clteal), but later is not
>possible to change the color using the dialogue.
>
>
Dito.
Two days later appeared the messages.
What is "Dito"?
More upon colors.
------------------------
Playing with TStringGrid.
Editing column 1, row 1 is not possible until doing click first in another cell.
After a while (mysterious) Form2 has color. Upon eliminating TStringGrid the color is lost also.
TstringGrid has something that active the color, but after several compilations and something of time.
To see example.
program funciona;
{$mode objfpc}{$H+}
uses
Interfaces,
Forms, unit1, unit2;
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
object Form1: TForm1
BORDERSTYLE = bsdialog
CAPTION = 'Form1'
COLOR = 255
CLIENTHEIGHT = 300
CLIENTWIDTH = 400
POSITION = poscreencenter
SHOWHINT = True
WINDOWSTATE = wsmaximized
HORZSCROLLBAR.PAGE = 401
VERTSCROLLBAR.PAGE = 301
LEFT = 297
HEIGHT = 300
HINT = 'vgdf'
TOP = 175
WIDTH = 400
object Button1: TBUTTON
ANCHORS = [aktop, akleft]
CAPTION = 'ShowForm2'
TABSTOP = True
ONCLICK = Button1CLICK
LEFT = 144
HEIGHT = 25
TOP = 8
WIDTH = 75
end
end
unit unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, Buttons,
StdCtrls, ExtCtrls, Grids, unit2;
type
TForm1 = class(TForm)
Button1: TBUTTON;
procedure Button1CLICK(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.Button1CLICK(Sender: TObject);
begin
form2.Show;
end;
initialization
{$I unit1.lrs}
end.
object Form2: TForm2
CAPTION = 'Form2'
COLOR = 65535
CLIENTHEIGHT = 300
CLIENTWIDTH = 400
SHOWHINT = True
ONCREATE = Form2CREATE
HORZSCROLLBAR.PAGE = 401
VERTSCROLLBAR.PAGE = 301
LEFT = 312
HEIGHT = 300
HINT = 'ghgh'
TOP = 236
WIDTH = 400
object Stringgrid1: TSTRINGGRID
ANCHORS = [aktop, akleft]
AUTOADVANCE = aadown
COLOR = 65280
COLCOUNT = 5
DEFAULTCOLWIDTH = 64
DEFAULTROWHEIGHT = 24
DEFAULTDRAWING = False
FIXEDCOLS = 1
ROWCOUNT = 5
FIXEDROWS = 1
FONT.COLOR = 255
FONT.HEIGHT = -14
FONT.NAME = 'beast wars'
FONT.STYLE = [fsbold]
GRIDLINEWIDTH = 0
OPTIONS = [gofixedvertline, gofixedhorzline, govertline, gohorzline, gorangeselect, gorowsizing, gocolsizing, goediting, goalwaysshoweditor, gosmoothscroll] VISIBLECOLCOUNT = 5
VISIBLEROWCOUNT = 5
ONBEFORESELECTION = Stringgrid1BEFORESELECTION
HORZSCROLLBAR.PAGE = 323
HORZSCROLLBAR.RANGE = 322
VERTSCROLLBAR.PAGE = 123
VERTSCROLLBAR.RANGE = 122
HEIGHT = 140
WIDTH = 340
end
end
unit unit2;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, ComCtrls,
Grids, StdCtrls;
type
TForm2 = class(TForm)
Stringgrid1: TSTRINGGRID;
procedure Form2CREATE(Sender: TObject);
procedure Stringgrid1BEFORESELECTION(Sender: TObject; Col, Row: Integer;
var CanChange: Boolean);
private
{ private declarations }
public
{ public declarations }
end;
var
Form2: TForm2;
implementation
{ TForm2 }
procedure TForm2.Form2CREATE(Sender: TObject);
begin
Stringgrid1.RowColor[2] := clYellow;
Stringgrid1.RowColor[4] := clYellow;
Stringgrid1.Cells[1,0] := '1';
Stringgrid1.Cells[2,0] := '2';
end;
procedure TForm2.Stringgrid1BEFORESELECTION(Sender: TObject; Col, Row: Integer;
var CanChange: Boolean);
var
Iteme:TListItem;
begin
if col = 3 then canchange :=false;
end;
initialization
{$I unit2.lrs}
end.