Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TCalendarView


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Nov 29, 2017 8:31 AM Last Post By: Paul Jackson
Paul Jackson

Posts: 61
Registered: 3/2/17
TCalendarView  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 26, 2017 10:25 AM
Hello All,

Using 10.2 Tokyo C++.

Does anyone have any information or ideas about how to draw into a cell in the new VCL TCalendarView component. I understand setting the foreground/background, text colors, etc. But what I would like to do is to add some type of markers in the cell to show that there is an appointment on a given day.

The Windows CalendarView has something called density bars that are easy enough to create which help to show some activity for a given day. As I understand it TCalendarView is not a wrapper but rather written specifically for the VCL and therefore I don't believe support the density bar interface.

So what I'm asking is does anyone have a sample of overriding the OnDayDrawItem to draw into the cell something similar to the density bars. How would I capture the canvas for the cell and draw onto it.

Any suggestions would be greatly helpful. Thank you.

--
-Paul
Paul Jackson

Posts: 61
Registered: 3/2/17
Re: TCalendarView  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 29, 2017 8:29 AM   in response to: Paul Jackson in response to: Paul Jackson
Slowly figuring it out. There are a bunch of goodies embedded in this and it's parent class, the documentation lacks much needed information about this class. And as for examples, well good luck, The only two I've seen that at least got me started was from Paweł Głowacki's blog about custom painting the component. He has another good one about making it data aware. But the customer painting one reveals some of the basic examples on using this component. Anyway, if anyone would like to discuss the TCalendarView please post or email me.

Here's a snippet of some experimentation, it shows how one might make a popup menu when a DayItem is doubled clicked, and one of several ways to get the date selected. The xxViewInfo and DrawParams have a good bit of data in them, which I'll be exploring. DrawParams are given in the CalendarView->Draw_X_Item methods.

void __fastcall TForm3::CalendarView1DblClick(TObject *Sender)
{
//	TDate theDate = CalendarView1->SelectedDates[0];
 
	TCalendarViewViewInfoBase  *info = CalendarView1->NeedCurrentViewInfo();
 
	TDate aDate = info->FocusedDate;
 
 //	ShowMessage(DateToStr(aDate));
	TPoint pp = CalendarView1->ScreenToClient(Mouse->CursorPos);
 
//	PopupMenu1->Popup(pp.X, pp.Y);
 
	ListBox1->Left=pp.x;
	ListBox1->Top=pp.y;
//
	ListBox1->Visible=true;
}


paul at jwareservices dot com

Paul Jackson wrote:
Hello All,

Using 10.2 Tokyo C++.

Does anyone have any information or ideas about how to draw into a cell in the new VCL TCalendarView component. I understand setting the foreground/background, text colors, etc. But what I would like to do is to add some type of markers in the cell to show that there is an appointment on a given day.

The Windows CalendarView has something called density bars that are easy enough to create which help to show some activity for a given day. As I understand it TCalendarView is not a wrapper but rather written specifically for the VCL and therefore I don't believe support the density bar interface.

So what I'm asking is does anyone have a sample of overriding the OnDayDrawItem to draw into the cell something similar to the density bars. How would I capture the canvas for the cell and draw onto it.

Any suggestions would be greatly helpful. Thank you.

--
-Paul

--
-Paul

Edited by: Paul Jackson on Nov 29, 2017 11:31 AM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02