Page Index Toggle Pages: 1 [2] 3  Send TopicPrint
Very Hot Topic (More than 25 Replies) Week Columns in Horizontal Day Range (Read 19017 times)
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Week Columns in Horizontal Day Range
Reply #15 - Nov 15th, 2007 at 6:15am
Print Post  
Here is a modified version of the ListView sample which now positions the dragged item under the mouse by adjusting the priorities of all related items:

https://mindfusion.org/_samples/_sample_ListView2.zip

The sample can be further extended but you can get the general idea.

Meppy
  
Back to top
 
IP Logged
 
salewis79
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Apr 10th, 2007
Re: Week Columns in Horizontal Day Range
Reply #16 - Nov 29th, 2007 at 2:43pm
Print Post  
Meppy,

When do you plan to have the vertical scrollbar fixed on the Horizontal list view of the calendar control?

Stanley
  
Back to top
 
IP Logged
 
salewis79
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Apr 10th, 2007
Re: Week Columns in Horizontal Day Range
Reply #17 - Nov 29th, 2007 at 2:59pm
Print Post  
Meppy,

I have made great progress with the control and I have the drap/drop working and staying whereever the item is dropped


I have drag/drop working and when the drop is over an existing appointment, I set the priority so the new item with be in the spot of the existing item and the existing item is now below the newly added item. 

I now need to take it a step further

During a drag/drop

--If drop is over an existing appointment : do some code

-- If drop is between two appointments  :    insert the new appointment on the schedule between the two existing appointments.

How I detect when the cursor is between two appointments on the schedule.  Also to visually show the difference to the user as well?

Stanley
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Week Columns in Horizontal Day Range
Reply #18 - Nov 30th, 2007 at 6:20am
Print Post  
Quote:
When do you plan to have the vertical scrollbar fixed on the Horizontal list view of the calendar control?

There is no vertical scrollbar in the List view. You can add an external scrollbar and play with the item priorities when it is adjusted in order to simulate scrolling.

Quote:
How I detect when the cursor is between two appointments on the schedule.

You can use code similar to the one supplied in the MouseMove method of the ListView2 sample above. If the mouse position is larger than the bottom of an item and smaller then the top of the next, then the mouse is between the two items.

Quote:
Also to visually show the difference to the user as well?

You can use some kind of a custom drawing to achieve this. Check the 'Drag & Drop' sample. A similar effect is demonstrated there for the Timetable view.

Meppy
  
Back to top
 
IP Logged
 
salewis79
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Apr 10th, 2007
Re: Week Columns in Horizontal Day Range
Reply #19 - Nov 30th, 2007 at 11:58am
Print Post  
Thanks so much for your help Meppy and I will try your posting and get back to you if I have any questions

Stanley
  
Back to top
 
IP Logged
 
salewis79
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Apr 10th, 2007
Re: Week Columns in Horizontal Day Range
Reply #20 - Dec 7th, 2007 at 4:58pm
Print Post  
Quote: You can use some kind of a custom drawing to achieve this. Check the 'Drag & Drop' sample. A similar effect is demonstrated there for the Timetable view.

Hi Meppy,

I tried showing a custom view when the user's mouse is between two appointment but I am having problems. I reviewed the drapDrop example but since I am using the ListView instead I am have a hard time adjusting the sample code

I am using the ListView with the following:

-- calendar.CustomDraw = CustomDrawElements.ListViewHeaderCell;

this.calendar.Draw += new MindFusion.Scheduling.WinForms.CustomDraw(this.calendar_Draw);

Basically I just want when a mouse is between two appointments then, a black line will appear between the two and disappear if moved away

Am I using the wrong CustomDrawElement option?

I only want this to happen during a DrapDrop Event


Stanley
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Week Columns in Horizontal Day Range
Reply #21 - Dec 10th, 2007 at 6:21am
Print Post  
You have to assign CellContents to the Calendar.Draw property. The following sample Draw event handler illustrates how to render a thin red line at the cursor position within the list view cell pointed to by the mouse:

Code
Select All
Point cursor = calendar.PointToClient(Cursor.Position);
DateTime date = calendar.GetDateAt(cursor);

if (date.Date != e.Date.Date)
	return;

RectangleF rect = calendar.GetElementBounds(CalendarElement.Cell, e.Index);

e.Graphics.DrawLine(Pens.Red,
	e.Bounds.Left, cursor.Y - rect.Y,
	e.Bounds.Right, cursor.Y - rect.Y); 


Meppy
  
Back to top
 
IP Logged
 
salewis79
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Apr 10th, 2007
Re: Week Columns in Horizontal Day Range
Reply #22 - Dec 12th, 2007 at 12:58pm
Print Post  
Meppy,

First I just wanted to say thank you for your help, because I got the visual working for the user now.

Quote: There is no vertical scrollbar in the List view. You can add an external scrollbar and play with the item priorities when it is adjusted in order to simulate scrolling.

I was wondering if you could provide more information on getting a vertical scrollbar for the listView working or simulated.  I got the vertical bar to show on the grid but it does not do anything.

Are there events that fire when the top or bottom arrow button is clicked on the vertical scrollbar?

Or If need to use an external scrollbar which control do you recommend?

Can you include some code to get me started on getting the vertical scrollbar working on the listview?

Thanks,
Stanley
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Week Columns in Horizontal Day Range
Reply #23 - Dec 13th, 2007 at 8:03am
Print Post  
You can use a very simple technique to achieve vertical scrolling in your horizontal list view. Add a vertical scrollbar to your form, position it to the right of the Calendar control along its height, then handle the Scroll event of this scrollbar and enter the following code as its contents:

Code
Select All
if (e.Type == ScrollEventType.EndScroll)
	return;

DateTime date = calendar.GetFirstDate();

calendar.BeginInit();
while (date <= calendar.GetLastDate())
{
	DateTime next = date + TimeSpan.FromDays(7);

	ItemCollection items = calendar.Schedule.GetAllItems(date, next);

	for (int i = 0; i < Math.Min(e.NewValue, items.Count); i++)
		items[i].Visible = false;

	for (int i = Math.Min(e.NewValue, items.Count); i < items.Count; i++)
		items[i].Visible = true;

	date = next;
}
calendar.EndInit(); 


What happens here is that items with higher priority are being made invisible, thus simulating the effect of scrolling down to the items with lower priority. You can additionally calculate the Maximum of your scrollbar depending on the maximum number of items present in an individual cell in the view.

Meppy
  
Back to top
 
IP Logged
 
salewis79
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Apr 10th, 2007
Re: Week Columns in Horizontal Day Range
Reply #24 - Dec 13th, 2007 at 11:17am
Print Post  
thanks so much for your help Meppy and I will try this and get back to you. 

Also thanks for responsing to me so fast.

Stanley
  
Back to top
 
IP Logged
 
salewis79
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Apr 10th, 2007
Re: Week Columns in Horizontal Day Range
Reply #25 - Dec 14th, 2007 at 1:18pm
Print Post  
Meppy,

How do I get vertical solid color on my appointments like in the Drag&Drop install sample app in the listView?

I tried BorderLeftColor / BorderLeftWidth but it did not provide a solid vertical strip on my appointments.

Example: Solid Red fillColor plus Solild Blue vertical strip on left of each appointment

Stanley
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Week Columns in Horizontal Day Range
Reply #26 - Dec 17th, 2007 at 6:04am
Print Post  
I'm afraid there is no automatic way to do this in a List view. You have to perform custom drawing on the item in order to achieve this.

Meppy
  
Back to top
 
IP Logged
 
salewis79
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Apr 10th, 2007
Re: Week Columns in Horizontal Day Range
Reply #27 - Dec 18th, 2007 at 7:25pm
Print Post  
Meppy,

I need a way to have the header in the list view to be any day of the week.  Currently my listview always starts on Sunday.  So what is the property or code so the header of each week can be a different day?

Stanley
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Week Columns in Horizontal Day Range
Reply #28 - Dec 19th, 2007 at 6:13am
Print Post  
You have to set the FirstDayOfWeek property of the Calendar.DateTimeFormat object to another DayOfWeek value in order to achieve this.

Code
Select All
calendar.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Monday; 


Meppy
  
Back to top
 
IP Logged
 
salewis79
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Apr 10th, 2007
Re: Week Columns in Horizontal Day Range
Reply #29 - Dec 19th, 2007 at 4:59pm
Print Post  
Thanks Meppy that works great now. 

Two more questions:

1) Can you tell me a way to do a Drag/Drop within the calendar listview without using the ItemDragKey.  I am currently using the ctrl key but I want to just click on hold the left mouse and the internal DragDrop will start.

2) During a dragDrop, I want the new item go to a certain position but because the area being dropped have an existing multi-week item there, the new item is being in the next available slot that is fits in.  Is there a way to make sure a item stays in the desired position even when an existing multi-week item is present on the desire spot?

Stanley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 3 
Send TopicPrint