Topic: About annual calendar

Hello all MVD users and Dmitry

With MVD, is it possible to display  on a form an annual calendar with 12 months displayed together (Juanary to December) ?

Any example to illustrate it ?

Thanks by advance

JB

Re: About annual calendar

Bonsoir Jean,
I'm not sure if this will give you any ideas.
Regards,
Derek.

Post's attachments

Attachment icon reminders.zip 876.38 kb, 649 downloads since 2017-03-09 

3 (edited by mathmathou 2017-03-09 20:59:27)

Re: About annual calendar

Hello guys,


My contribution : not as clean and smart as derek's smile


With Saturdays, Sunday and French Holly Days.


Cheers


Mathias

Post's attachments

Attachment icon year_calendar.zip 335.62 kb, 643 downloads since 2017-03-09 

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: About annual calendar

Hi Guys,


Derek,
Thanks for sharing... Nice little application.
1. I guess it's not possible to customize calender as shown on your screen cap. in MVD?
2. How did you populate drop-down combo boxes? There is no form to add items for them, no calc. fields and I couldn't see hard coded items.


Mathias,
Thank you for sharing sample year calender..... Interesting approach using tGrid. It could be a manual workaround for calender as MVD calender component is very basic and doesn't support few things needed when one wants to use in a reminders etc. app.

What we need are:
1. Ability to click on a cell (single and double-click) to select a day to add events to it.
2. Enabling user to add a small image (with max constrains of 32x32 px) in day cell to highlight there is a some kind of entry for the day.
3. For weekends and holidays we could use font coloring rather than cell coloring.


Question:
How did you fill months and days on your tGrid?

Adam
God... please help me become the person my dog thinks I am.

Re: About annual calendar

Hello Derek, Mathmatou and AD1408

Thanks for your own calendar

Derek : A little after posting my question, I realized by stretching Calendar component, I coul obtain an annual calendar. Thanks again

Mathmatou : your answer suits to me. I wish use your calendar to manage the rentals of a cottage during the holidays.
As says AD1408, how can I fill cells of a different color for a certain length of time (ie from 1 July to 15 July)?

Thnaks

JB

Re: About annual calendar

Hello all,


I've worked a little on you question, and here is what I came up with, after creating a table to save bookings :

procedure Form1_Button2_OnClick (Sender: string; var Cancel: boolean);
var
    bookings : TDataSet;
    s_month, s_day, e_month, e_day : Integer; //STARTING AND ENDING DAYS, MONTHS

    r, c : Integer; //Row, Column
    nb_day_s_month, nb_day_e_month, x, y : Integer;
begin
    SQLQuery('SELECT '+
             'strftime("%m",booking_start) AS SM,'+
             'strftime("%d",booking_start) AS SD,'+
             'strftime("%m",booking_end) AS EM,'+
             'strftime("%d",booking_end) AS ED '+
             'FROM '+
             'booking',bookings);
        while not bookings.Eof do
            begin
                s_month := Bookings.FieldByName('SM').AsInteger; //Start Month
                s_day := Bookings.FieldByName('SD').AsInteger;   //Start Day
                e_month := Bookings.FieldByName('EM').AsInteger; //End Month
                e_day := Bookings.FieldByName('ED').AsInteger;   //End Day
                        for c := s_day to e_day do
                            begin
                                for r := s_month - 1 to e_month - 1 do
                                    begin
                                        Form1.TableGrid1.Cell[c,r].Color := clGreen;
                                    end;
                            end;
                bookings.Next;
            end;
        bookings.Free;
end;

Unfortunately, this code works only if start and end date for the stay are in the same month.
A soon as the reservation spans over tow or more moth, it does not work anymore.


I spent some time trying to figure out how to arrange this, but professional life is too heavy on me right now, and I can not spend enough time on it to solve the problem.


This is probably limited by the way I arranged the dates in my database


Have fun guys and post your solutions if you find some


Cheers



Mathias

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: About annual calendar

After checking samples in SQLite studio I noticed that Derek and Mathias populated items in question manually. If I'm wrong please correct me.


Mathias, if and when you have a time if you could add following futures to your calendar sample app, it would be great.

1. Ability to click on a cell (single and double-click) to select a day to add events to it.
2. Enabling user to add a small image (with max constrains of i.e. 32x32 px) in day cell to highlight there is a some kind of entry for the day.
3. For weekends and holidays we could use font coloring rather than cell coloring.

Adam
God... please help me become the person my dog thinks I am.

Re: About annual calendar

Hello Jean, Mathias, Adam,
I've been away so only just now catching up on comments in the forum.
Jean, I'm not sure if it helps but attached is a little application I wrote a while ago when I was VERY new to MVD (which is why the script is terrible - LOL!).  I use it for simple diary / notes / reminders but I'm sure if you changed the labels, you could use it for bookings.
In the meantime, I might 'steal' some of Mathias' good ideas and try and develop it around tgrid more.
Adam - correct, it was simpler and quicker to knock up the data in Excel and then import it into sqlite so that each day is already there, as a container, waiting for any notes to be written.
Regards,
Derek.

Post's attachments

Attachment icon reminder2.zip 377.57 kb, 600 downloads since 2017-03-16 

Re: About annual calendar

Hello Derek,
I am trying to build a doctor's appointment calendar based on your example. However, double-clicking the date in calendar produces an error message and fails to open the desired search result. The button2 does not seem to work. How to correct the error?

Post's attachments

Attachment icon 03 Appointment Schedule.7z 655.57 kb, 375 downloads since 2019-03-17 

10 (edited by derek 2019-03-17 16:21:50)

Re: About annual calendar

Hello Eyeman,
I don't even remember writing that, it's been so long ago - LOL!
I have since written a couple of alternative appointment calendar programs that I think (hope!) are an improvement (I just wanted something that was quick and easy to use and not weighed down with lots of features I didn't need).
I've attached the most recent one which may be of interest to you - I think it should be possible to use it as a 'front-end' to your specific requirements (in effect, replacing your A1_cal_date).  Feel free to use/change/improve anything and if you have any questions, just let me know (for info', I use a 'bounce-bar' in this program so just take the cursor down to the bottom of the form to reveal the buttons).
Regards,
Derek.

Post's attachments

Attachment icon Reminder365.zip 347.4 kb, 409 downloads since 2019-03-17