Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > Apps

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2005, 02:39 PM
kbboykin kbboykin is offline
Senior Member
 
Join Date: May 2005
Posts: 361
Default unsysapps - Using xcalndr, how to make this work?

Unsysapps,

I am using your xcalndr for a project I am working on.
I want to go through the data table (ADO) and pull out all
names and events and post them to the corresponding date
on the stringgrid calendar. This is what I have tried but
only get an empty grid (but if I use xstringscalendar1.Cellstrings(0,0,i) it gives me the first
record displayed 6 times and ignores the others. It also displays this for EVERY calendar day.

procedure TForm1.PopulateCalendar;
var
i,r: integer;
cevent: TDateTime;
AYear, AMonth, ADay: Word;
begin

for r := 0 to xstringscalendar1.DaysThisMonth do

try
datamodule1.Sched.First;
datamodule1.Sched.DisableControls;
while not datamodule1.Sched.Eof do
begin
cevent := datamodule1.Schedstartdate.Value;
Decodedate(cevent, AYear, Amonth, ADay);
for i := 0 to xstringscalendar1.DaysThisMonth do
begin
if xstringscalendar1.Day = cevent then
begin
XStringsCalendar1.CellString[0,i,ADay]:= datamodule1.Schedphysician.Value+'-'+datamodule1.Schedtype.Value;
XStringsCalendar1.ActiveColor := clSkyBlue;
end;
end;
datamodule1.Sched.Next;
end;
finally
datamodule1.Sched.EnableControls;
end;
end;


Thanks in advance,

--Keith
Reply With Quote
  #2  
Old 06-06-2005, 02:46 PM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: unsysapps - Using xcalndr, how to make this work?

Hold one, let me look at what you have!

UnSYsApps

If this helps, please accept as answer!

UnSysApps
Reply With Quote
  #3  
Old 06-06-2005, 02:58 PM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: unsysapps - Using xcalndr, how to make this work?

Off the top of my head, something like this....

procedure TForm1.PopulateCalendar;
var
cevent: TDateTime;
begin
with dataModule1.Sched do
begin
DisableControls;
First;
while not Eof do
begin
cevent := FieldByName('startdate').DateTime;
if (YearOf(CEvent) = xstringscalendar1.Year) AND
(MonthOf(CEvent) = xstringscalendar1.Month) then
begin
XStringsCalendar1.CellString[0,i,Dayof(CEvent)]:=
FieldByName('Physician').AsString +
FieldByName('type').asString;
end;
Next;
end;
First;
EnableControls;
end;
end;


XStringsCalendar1.ActiveColor := clSkyBlue;

//this should be set at design time OR
//on form's create event



If this helps, please accept as answer!

UnSysApps
Reply With Quote
  #4  
Old 06-06-2005, 02:58 PM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: unsysapps - Using xcalndr, how to make this work?

Sorry

change

XStringsCalendar1.CellString[0,i,Dayof(CEvent)]:=

to

XStringsCalendar1.CellString[0,0,Dayof(CEvent)]:=



If this helps, please accept as answer!

UnSysApps
Reply With Quote
  #5  
Old 06-06-2005, 03:00 PM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: unsysapps - Using xcalndr, how to make this work?

using

CellString[]

you can use Col, Row

CellString[2,4, 0]

or the day

CellString[0,0, 4]

If you use the day

then add Zeros for Col, Row

If you use the col, row

then add Zero for day




If this helps, please accept as answer!

UnSysApps
Reply With Quote
  #6  
Old 06-06-2005, 03:03 PM
kbboykin kbboykin is offline
Senior Member
 
Join Date: May 2005
Posts: 361
Default RE: unsysapps - Using xcalndr, how to make this work?

Thanks,

It works if I substitue this line:
cevent := FieldByName('startdate').DateTime;
with
cevent := FieldByName('startdate').Value;

Thanks a lot!!!
--Keith
Reply With Quote
  #7  
Old 06-06-2005, 03:22 PM
kbboykin kbboykin is offline
Senior Member
 
Join Date: May 2005
Posts: 361
Default RE: unsysapps - Using xcalndr, how to make this work?

Actually the reply for this one is the answer:

with dataModule1.Sched do
begin
DisableControls;
First;
while not Eof do
begin
cevent := FieldByName('startdate').Value;
if (YearOf(CEvent) = xstringscalendar1.Year) AND
(MonthOf(CEvent) = xstringscalendar1.Month) then
begin
XStringsCalendar1.CellString[0,i,Dayof(CEvent)]:=
FieldByName('Physician').AsString +' - '+
FieldByName('type').asString;
end;
Next;
end;
First;
EnableControls;
end;
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:41 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.