MCPack - a small Delphi XE component pack

I put together 4 components in just 4 days, so please lower your expectations. I needed some controls for a hotel reservation application so I searched to find some free ones, but with no success. So I decided to make them. I didn't follow the naming conventions so the properties I published for the controls, are all named with a prefix, so you can find them more easily. The prefix is (obviously) "mc"

They should work under XE2, XE3 - XE8, but I haven't tested them. They should also work for Delphi 7 - up. I will add here any other components that I will make

TMCPlanner TMCMonthCalendar TMCRating

TMCRatingMini















  • MCPlanner

    A Gantt-like grid descended from TStringGrid for your planning necessities.

  • MCMonthCalendar

    Also descended from a TStringGrid, but this time it looks like the default TMonthCalendar component, except it allows you to display a selection of dates (an interval).

  • MCRating

    A component that mimics any star-rating widget you can see on many web-pages. It has a ReadOnly property so you can use it interactively or not

  • MCRatingMini

    A component that mimics any star-rating widget you can see on many web-pages, just like above, except this one is smaller.

  • Download demo

    A small demo with all 4 controls (please scan the file for viruses before executing it).

    Download How to use




TMCPlanner

Descendant of TStringGrid to which I added a few extra properties so it would show a calendar-like grid, for an interval set with mcShowFrom and mcShowTo properties usable at design-time or at runtime.

So basically, you place the control on your form, set the properties and voila: you have a Planner showing you an interval of dates, on how many rows you want. The actual drawing of the intervals where you want to plan something, need to be done in the onDrawCell event of the component. I will post an example later on how to do that. Go to top

TMCMonthCalendar TMCRating TMCRatingMini



The added published properties are:








TMCMonthCalendar.

You get a regular TMonthCalendar with an extra feature: you can display an interval with it. The interval will be highlighted with a color of your choosing.

If your interval has multiple months then just use more TMCMonthCalendar controls with the same from-to interval settings.

or...

while it's added properties are...

More stuff.

The control is descended from TStringGrid, so you can access the dates as cells in a regular TSTringGrid. Except this grid looks exactly like a TMonthCalendar and auto-calculates and displays the layout of any month you want to show. Plus it can display an interval

Go to top

TMCPlanner TMCRating TMCRatingMini







TMCRating.

Wanting to be able to show the number of stars that are rewarded to a room in a hotel, I ended up building this 4 star control. It can be set to readOnly so it wont accept mouse events. Otherwise it behaves like any Star-rating widget on the web, except this is desktop.

There are only a few custom properties published. The rest is drawn internally


having the properties...


More stuff.

It's a TPanel descendant using some images and the onMouseUp event of the TImages. Allows rating using mouse, allows setting the rating programatically using setRating(), returns the rating through getRating() method.

Go to top

TMCPlanner TMCMonthCalendar TMCRatingMini







TMCRatingMini.

Same thing as TMCRating, except here the stars are smaller and they can have 2 colors (red and blue).

Also you have the readonly property too so you can use the control in ownerdraw controls like grids or treeviews.



Having the properties:

More stuff.

Not much more to say, you just have to try it and you'll see what you can use it for.

Go to top

TMCPlanner TMCMonthCalendar TMCRating
Code for showing an interval using 2 TMCMonthCalendars. Just place 2 DateTimePickers (dt1 and dt2), 2 MCMonthCalendars (cal1 and cal2) and add these events
procedure TForm2.dt1Change(Sender: TObject);
var
  a,l,z:word;
begin
  decodedate(dt2.Date,a,l,z);
  cal2.mcYear:=a;
  cal2.mcMonth:=l;
  cal2.Invalidate;
  if CompareDate(dt1.Date,dt2.Date)<1 then
  begin
    cal1.mcSelectedDateStart:=dt1.Date;
    cal1.mcSelectedDateStop:=dt2.Date;
    cal2.mcSelectedDateStart:=dt1.Date;
    cal2.mcSelectedDateStop:=dt2.Date;
  end;
end;

procedure TForm2.dt2Change(Sender: TObject);
var
  a,l,z:word;
begin
  decodedate(dt2.Date,a,l,z);
  cal2.mcYear:=a;
  cal2.mcMonth:=l;
  cal2.Invalidate;
  if CompareDate(dt1.Date,dt2.Date)<1 then
  begin
    cal1.mcSelectedDateStart:=dt1.Date;
    cal1.mcSelectedDateStop:=dt2.Date;
    cal2.mcSelectedDateStart:=dt1.Date;
    cal2.mcSelectedDateStop:=dt2.Date;
  end;
end;
			
Go to top

TMCPlanner TMCMonthCalendar TMCRating TMCRatingMini