M
My Pet Programmer
Ok guys, I'm really looking for someone to tell me how bad a hack this
is, and if I'm close to where I should be with it.
The basic situation is that I have a class which creates a basic
calendar control, the only difference is I stole the navigation scheme
from Vista (e.g., if you click on the year you zoom out to the months
list, then out to the decade, and back in when you click a year, then a
month).
I ran into some trouble setting the onclick events dynamically, then did
some reading on why I was getting a "too much recursion" error, which I
fixed. No problem. Now what I have is this:
function VistaCal() {
VistaCal.instance = this;
}
and then later on, when I am building the calendar controls:
mNameCell.onclick = function(){ updateCal("year", dateString);};
Where mNameCell is the year header, you click it, it zooms you out to
the list of months.
The updateCal function is outside the prototyping, and uses
VistaCal.instance to call the member function I need:
function updateCal(type, date) {
VistaCal.instance.displayChange(type, date);
}
I couldn't find any other way to get a reference to the current
VistaCal, and I looked. I fought with this thing for three hours last
night, and I got it working, but it feels like a hack.
Thoughts?
~A!
is, and if I'm close to where I should be with it.
The basic situation is that I have a class which creates a basic
calendar control, the only difference is I stole the navigation scheme
from Vista (e.g., if you click on the year you zoom out to the months
list, then out to the decade, and back in when you click a year, then a
month).
I ran into some trouble setting the onclick events dynamically, then did
some reading on why I was getting a "too much recursion" error, which I
fixed. No problem. Now what I have is this:
function VistaCal() {
VistaCal.instance = this;
}
and then later on, when I am building the calendar controls:
mNameCell.onclick = function(){ updateCal("year", dateString);};
Where mNameCell is the year header, you click it, it zooms you out to
the list of months.
The updateCal function is outside the prototyping, and uses
VistaCal.instance to call the member function I need:
function updateCal(type, date) {
VistaCal.instance.displayChange(type, date);
}
I couldn't find any other way to get a reference to the current
VistaCal, and I looked. I fought with this thing for three hours last
night, and I got it working, but it feels like a hack.
Thoughts?
~A!