![]() |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
Hold one, let me look at what you have!
UnSYsApps If this helps, please accept as answer! UnSysApps |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
Sorry
change XStringsCalendar1.CellString[0,i,Dayof(CEvent)]:= to XStringsCalendar1.CellString[0,0,Dayof(CEvent)]:= If this helps, please accept as answer! UnSysApps |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
Thanks,
It works if I substitue this line: cevent := FieldByName('startdate').DateTime; with cevent := FieldByName('startdate').Value; Thanks a lot!!! --Keith |
|
#7
|
|||
|
|||
|
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; |
![]() |
| Thread Tools | |
| Display Modes | |
|
|