Johan Hedlund
Top achievements
Rank 1
Johan Hedlund
asked on 25 Jan 2010, 02:05 PM
Hi,
I wonder if it is possible to show the editappointment dialog programatically, i.e. not via the built-in context menu?
The dialog should show based on the selection in the scheduler, i.e. the same way as the context menu command does.
The reason why I'm asking is that I want to show the dialog through a separate toolbar command.
Thanks in advance,
Johan
I wonder if it is possible to show the editappointment dialog programatically, i.e. not via the built-in context menu?
The dialog should show based on the selection in the scheduler, i.e. the same way as the context menu command does.
The reason why I'm asking is that I want to show the dialog through a separate toolbar command.
Thanks in advance,
Johan
6 Answers, 1 is accepted
0
Hi Johan Hedlund,
You should use the following code to show edit appointment dialog:
In order to take the selected cell in the scheduler you should subscribe to MouseDown event on the scheduler and in it use the following code:
For more details look at the attached example.
Sincerely yours,
Dobry
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
You should use the following code to show edit appointment dialog:
Appointment app =
new
Appointment(savedDate, savedDate.AddMinutes(
this
.minutes));
this
.editDialog =
new
EditAppointmentDialog(app,
this
.radScheduler1);
if
(
this
.editDialog.ShowDialog(
this
) == DialogResult.OK)
{
this
.radScheduler1.Appointments.Add(
this
.editDialog.Appointment);
}
In order to take the selected cell in the scheduler you should subscribe to MouseDown event on the scheduler and in it use the following code:
SchedulerCellElement cell =
this
.radScheduler1.SchedulerElement.ElementTree.GetElementAtPoint(e.Location)
as
SchedulerCellElement;
if
(cell
as
SchedulerHeaderCellElement !=
null
)
return
;
if
(cell !=
null
)
{
savedDate = cell.Date;
}
For more details look at the attached example.
Sincerely yours,
Dobry
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Johan Hedlund
Top achievements
Rank 1
answered on 28 Jan 2010, 08:20 PM
Thank you Dobry.
If I want to disable the default response to the double-click event, i.e. NOT show the appointment form, is it just to set the appointmentdialog to null in the OnAppointmenDialogShowing event or is it any "cleaner" solution to this?
Regards,
Johan
If I want to disable the default response to the double-click event, i.e. NOT show the appointment form, is it just to set the appointmentdialog to null in the OnAppointmenDialogShowing event or is it any "cleaner" solution to this?
Regards,
Johan
0
Hi Johan Hedlund,
Yes this is the right solution to block the showing of EditAppointmentDialog. But this will block all showings of this dialog. If you want to block it only upon DoubleClick you should subscribe to DoubleClick event and rise the some flag. Look the code below:
Feel free to ask additional questions.
Kind regards,
Dobry
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Yes this is the right solution to block the showing of EditAppointmentDialog. But this will block all showings of this dialog. If you want to block it only upon DoubleClick you should subscribe to DoubleClick event and rise the some flag. Look the code below:
private
bool
isDoubleClick;
private
void
radScheduler1_AppointmentEditDialogShowing(
object
sender, AppointmentEditDialogShowingEventArgs e)
{
if
(isDoubleClick)
{
e.AppointmentEditDialog =
null
;
isDoubleClick =
false
;
}
}
private
void
radScheduler1_DoubleClick(
object
sender, EventArgs e)
{
isDoubleClick =
true
;
}
Feel free to ask additional questions.
Kind regards,
Dobry
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Richard
Top achievements
Rank 1
answered on 12 Sep 2011, 01:49 AM
Hi,
I am posting my question here as I believe it is logically related to this thread.
What I want to do is show the Edit Appointment Dialog when an appointment in the scheduler is double clicked. However I do not want to show the Edit Appointment Dialog when a free time slot is double clicked.
Is there any way this could be done?
The main obstacle seems to be that I am unable to detect whether the DoubleClick was on an empty time slot or on an appointment.
Thanks,
0
Richard
Top achievements
Rank 1
answered on 12 Sep 2011, 05:09 AM
OK, I think I figured this out..
Hope this is a good way of differentiating whether the double click was on an appointment cell or not.
Regards,
Hope this is a good way of differentiating whether the double click was on an appointment cell or not.
Private
DisableDoubleClick
As
Boolean
=
False
Private
Sub
radScheduler1_DoubleClick(sender
As
Object
, e
As
System.EventArgs)
Handles
radScheduler1.DoubleClick
Dim
point
As
Point =
Me
.radScheduler1.PointToClient(Cursor.Position)
Dim
schedulerCell
As
SchedulerCellElement = TryCast(
Me
.radScheduler1.ElementTree.GetElementAtPoint(point), SchedulerCellElement)
If
schedulerCell IsNot
Nothing
Then
DisableDoubleClick =
True
End
If
End
Sub
Private
Sub
radScheduler1_AppointmentEditDialogShowing(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.WinControls.UI.AppointmentEditDialogShowingEventArgs)
Handles
radScheduler1.AppointmentEditDialogShowing
If
DisableDoubleClick
Then
e.Cancel =
True
e.AppointmentEditDialog =
Nothing
DisableDoubleClick =
False
Else
e.AppointmentEditDialog =
New
CustomEditAppointmentDialog()
End
If
End
Sub
Regards,
0
Hi Richard,
I am writing to confirm that this is the correct approach. I am glad that you have managed to figure it out.
Should you have any further questions, do not hesitate to contact us.
Regards,
Ivan Todorov
the Telerik team
I am writing to confirm that this is the correct approach. I am glad that you have managed to figure it out.
Should you have any further questions, do not hesitate to contact us.
Regards,
Ivan Todorov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>