Page 1 of 1

Error using subscribeEvent()

Posted: Mon Feb 21, 2005 06:01
by krithigal
Hi we are developing a calendar control, with the foll sub controls.
Calendarcontrol
MonthPane
DateButton.


Iam firing an event EventDateClicked from DateButton class on OnMouseButtonUp().

I have subscribed for EventDateClicked of DateButton in Monthpane and has associated an event handler OnDateClick() in monthpane to handle the same. From within OnDateClick() I am firing EventDateClicked to its parent i.e CalendarControl

I have subscribed for EventDateClicked of MonthPane in CalendarControl and has associated an event handler OnDateClick() in calendarControl to handle the same. I receive the error "Exception: No event named 'Clicked' is defined for this EventSet" on execution of subscribeevent for this.

From the log I could make out that the events are getting fired from datebutton and monthpane. But the last subscription fails.

Pl find the code snippet below.

const utf8 DateButton::EventDateClicked[] = "Clicked";

void DateButton::addDateButtonEvents(void)
{
//events to be sent to parent
addEvent(EventDateClicked);

}

const utf8 MonthPane::EventDateClicked[] = "Clicked";

void MonthPane::addMonthPaneEvents(void)
{
addEvent(EventDateClicked);
}

void MonthPane::layoutDateButton(uint *lastDateButtonId, Point dateButtonPosition)
{

...
dateButton->subscribeEvent(DateButton::EventDateClicked,
Event::Subscriber(&MonthPane::onDateClick, this));
}


void CalendarControl::createMonthPaneInstance(Point positionOfMonthPane, uint * lastMonthPaneId)
{


...
monthPane->subscribeEvent(MonthPane::EventDateClicked,
Event::Subscriber(&CalendarControl::onDateClick, this));
}

Pl. let me know the exact problem, and how to resolve it


Looking forward towards your early help. My work is stuck up.


regards
krithiga

Re: Error using subscribeEvent()

Posted: Tue Feb 22, 2005 09:34
by CrazyEddie
I have subscribed for EventDateClicked of MonthPane in CalendarControl and has associated an event handler OnDateClick() in calendarControl to handle the same. I receive the error "Exception: No event named 'Clicked' is defined for this EventSet" on execution of subscribeevent for this.

Which means you are attempting to subscribe to an event that does not exist (that is, has not been added to the EventSet that you are making a subscription to).

You need to double-check the names of the event strings and that you are indeed adding them to the EventSet for which you are attempting the subscription.

CE.