Trying to have some main template to change visibility of groupboxes based on the number in main editbox.
EditDay
is the edit box, where only numbers are in it
day:=DayOfTheYear(Now);
EditDay.Text:=day;
so it's basicaly the day of the year.
Anyway, I need a groupbox (with a few memos) for everyday of the year. Since this is a file with records, which another program will read off for everyday different infos, I need that file writer first, so I can even make one. That's what this one is
Since I'm doing a record file, there has to be all boxes firstly filled up before I'll write to a file, so I need to have Groupboxes to be visible one at a time, each one for a day I specify in a main TEdit
.
Right now I'm stuck with setting the visibility of the groupboxes; The code below gives me Access violation error.
x
is the number specified in TEdit
named EditDay
. I wanted to make an y
every other day but the day in EditDay box so all but x
;
x : Integer;
y : Integer;
procedure TWriteForm.DayCheckTimer(Sender: TObject);
begin
x:=StrToInt(EditDay.Text);
y:=Not x;
(FindComponent('GroupBox'+IntToStr(x)) as TGroupBox).Visible := True;
(FindComponent('GroupBox'+IntToStr(y)) as TGroupBox).Visible := False;
Tried to set y:=[1..365] and not x; [1..365] - x; and several others, but none of them worked.
Where am I wrong? .. Any help will be appreciated. :))
[I'm kinda beginner, yes..]