Robert Meek wrote:
> I'm attempting to use an event of a Calendar component that is written like
> so:
> 
> procedure TCalendarF10.MyCalendar1GetBoldDays(Sender: TObject; Year, Month:
>     Word; var Bitmask: Cardinal);
> begin
>     if ( Month = 12) and ( Year = 2006 ) then
>     begin
>         Bitmask := KeepCalendar.DaysToBitmask([3, 6, 22, 29]);
>     end;
> end;
> 
> That's the event with an example of how one supposedly uses it.

So are you saying that the example doesn't actually compile? Who wrote 
the example? Did the calendar control come with any demo program that 
you can compile and execute?

> So if the
> Calendar happens to be displaying the month and Year given the days provided
> will display as Bolded text.  Now I can, in my Form's OnCreate, set the
> Calendar to the current Month and Year, and I can pass them as Integer
> parameters to this event as required, and I can get all the days in this
> month that I want bolded.

Are you passing values to the event handler, or is the calendar control 
passing values, and your event handler receiving them?

> I can get them in the form, of an IntegerList,

What's that? Is it just a TList with various methods that take Integer 
instead of Pointer, or is it something else?

> or
> add them to a set, or as an array.  First I tried a dynamic array as there's
> no way of knowing until you get all the dates how many there are, and left
> over indexes of a static array can turn up as anything, but it won't accept
> a dynamic array.  BTW...DaysToBitMask is shown as:
> 
> DaysToBitMask(Byte[])

That's not Delphi. In C# and Java, that would designate an array of 
Byte. In C and C++, it's a pointer to a Byte. In Delphi, it's just a 
syntax error.

> It's parameter being listed as:
> 
> Days : Calendar.DaystoBitMask.$Unnamed Type

Listed where? Obviously not in any source code. What does the source 
code say the function should receive?

> And returns:
> 
> Cardinal
> 
> In any case, no matter how I attempt to pass the days as an array
> and of whatever type I try, I get an error!

Any particular error? Run-time or compile-time?

> Can anyone help me to pass the
> proper parameters to the Event so I can use it...Please!

*You* shouldn't be passing any parameters to the event. The component 
should be calling its event handler when it needs to, and then you 
should implement an event handler for it to call. The component will 
tell you the year and the month, and it looks like you're supposed to 
pass back a Cardinal, which each set bit in that value indicates one day 
that should appear bold.

You can set bits using the "and" and "or" operators. To set the third 
bit, for instance, you can run this code:

Bitmask := Bitmask or (1 shl (3 - 1));

-- 
Rob
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to