![]() ![]() ![]() ![]() Gravitybox Schedule Primer
Page 141
1998-2004 Gravitybox Software LLC
Chapter 14
Scheduling Program
It should be self-explanatory how a day schedule works in normal mode. You just drop a
schedule on a form, set the MinDate and MaxDate and you are done. This is not much
of an example from which to learn. So I have chosen to make our first real application a
bit more complex. We will create an MDI interface and open a new child window for
each day. Instead of having just one column for the day, we will schedule rooms. This
example assumes that we are building an application for a doctors office. In this
fictional office we are required to schedule patients in different rooms of the office. This
is important because in an office you may have 10 patients scheduled at 10:00 AM;
however they will be in different rooms. This is a real-world example and one that many
developers have had to build.
We may construct a simple scheduling application that still presents much of the
functionality of the schedule component. We will be able to create a new schedule. Also
we will be able to open an existing schedule. Finally, we will be able to save and print
schedules. The first thing to do is to create the needed forms. We will need an MDI and
a child form. On the child form we will place a GbSchedule object. To ensure that the
schedule is the proper size we will need to add a little code to the resize event.
Private Sub Form_Resize()
On Error Resume Next
Schedule1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
End Sub
This code will not cause any error if the form is minimized because it skips all errors.
The only errors that could occur are resizing errors and there is nothing to be done
about those anyway, so we will ignore them.
Next we will add some rooms to the schedule. You may, of course, add a configuration
screen to setup rooms. This is the obvious thing to do especially it you are deploying
your application to many clients and do not know their room configuration at design-
time. However, for the simplicity of this example we will just hard-wire the rooms. I have
created a routine to add rooms to the schedule and it is called from the Form_Load
event. This routine will add four rooms to the schedule.
Private Sub LoadRooms()
'We will now load the rooms for this day.
|