Overwhelming?  Aye... just drink a lot of beer aftewards, thats what I did.

Well, because CalendarLayout's methods do a LOT, I just extended the class, 
copied the methods and overwrote them; basically, you copy 140 lines of code 
just so you can modify 3 lines.

For example, it creates the textfields in the size method, within 2 for 
loops.  I replaced that there with my custom class that can render colors 
for dates.

And yeah, in setSelectedMonthAndYear, that is where I loop through the 
dataprovider (passed in from my modified DateChooser) so I can color the 
dates.

In DateChooser, I added a dataProvider like this:

private var _dp:Array = [];


public function get dataProvider():Array

{

return _dp;

}


public function set dataProvider(val:Array):Void

{

_dp = val;

dateGrid.dataProvider = _dp;

}

And I do the same in my modified CalendarLayout:



private var _dp:Array = [];


public function get dataProvider():Array

{

return _dp;

}


public function set dataProvider(val:Array):Void

{

_dp = val;

_dp.removeEventListener("modelChanged", this);

_dp.addEventListener("modelChanged", this);

setSelectedMonthAndYear(__displayedMonth, __displayedYear);

}



The only other thing I added, which you don't need, was the ability to have 
the next and back buttons trigger an event when you change the months since 
my manager who got suckered into writing the controller code needed events 
when the user changed months; but those methods are assigned in a Flash 6 
fashion, so the scope is a little weird; again, I just copied the entire 
functions, and modifed them.



Good luck!





----- Original Message ----- 
From: "Andrew Spaulding" <[EMAIL PROTECTED]>
To: <flexcoders@yahoogroups.com>
Sent: Monday, May 02, 2005 11:54 PM
Subject: [flexcoders] Re: flex calendar component


Ok here goes.

I'll have an extra attribute in my dateChooser which is the
dataprovider for the dates that need some sort of indicator (i.e a
task is on that day).

There's a method in CalendarLayout thats named setSelectedMonthAndYear
which updates the UI to display the days in the month. I'm guessing
that somewhere in here i can access my dataprovider and apply a
different skin on the days with tasks?

Sound like a plan?



--- In flexcoders@yahoogroups.com, "Andrew Spaulding" <[EMAIL PROTECTED]> wrote:
> Well isnt that encouraging :p
>
> I'm just taking a look at mx.controls.CalendarLayout and its 2000 odd
> lines of code, what a day I'm gonna have!
>
> Any idea where to start? It's all a bit overwhelming.
>
> Andrew.
>
>
> --- In flexcoders@yahoogroups.com, "JesterXL" <[EMAIL PROTECTED]> wrote:
> > The way I'm tackling the immense challenge of extending the
> > not-made-to-be-extended DateChooser in Flash
> > (mx.controls.fateworsethandeathtoextend.DateChooser) is by replacing
> the
> > CalendarLayout's drawing mechnism to create custom class objects
> instead of
> > simple TextFields.  Then, in the DateChooser, when she does a redraw
> of the
> > month, you do a run through of a dataProvider, and highlight the days
> > accordingly, by comparing dates.
> >
> > Looking through the docs, it doesn't look like CalendarLayout is a
> public
> > API, so you can either A> hack it anyway (you can find the methods
> chilling
> > on prototype), or B> file a wish request, or C> extend the Flash
> one, then
> > bring over the SWC.  I can tell you, though, C is, at minimum, a 2
> day job.
> >
> >
> > ----- Original Message ----- 
> > From: "Andrew Spaulding" <[EMAIL PROTECTED]>
> > To: <flexcoders@yahoogroups.com>
> > Sent: Monday, May 02, 2005 11:05 PM
> > Subject: [flexcoders] flex calendar component
> >
> >
> > Hi all,
> >
> > I was wondering if anyone had a sample of a flex calendar component?
> > Or possibly have given any thought to extending the date chooser so
> > that we can highlight specific days by a given data provider?
> >
> > I have a zip file of a calendar, but god only knows where I got it
> > from, I can't remember. It returns a hash map of objects and draws
> > canvas 'day' objects in a grid. I rekcon there might be a better way
> > to attack such a problem.
> >
> > Does anyone have a sample or suggestions? A sample would be great :p
> >
> > Andrew Spaulding
> > www.flexdaddy.com
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links






Yahoo! Groups Links








 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to