Re: wxEuphoria Calendar Control: Getting Count of Days in Month
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Dec 01, 2005
- 535 views
cklester wrote: > > I created the following, but it doesn't work! Helllp! > > }}} <eucode> > --/topic wxCalendarCtrl > --/func get_daysinmonth( atom cal ) > -- > --Returns the number of days in the currently selected month. > global function get_daysinmonth( atom cal ) > return cpp:call_member( wxDateTime_GetNumberOfDays_1, cal, {}) > end function > </eucode> {{{ > > I tried also the wxDateTime_GetNumberOfDays, but apparently I don't know > how to form the parameters, but I'm sure that's the one I want to call. :/ wxDateTime_GetNumberOfDays_1 is actually a static function, which means that you don't pass the object, so you just use cdecl to call it. Also, you appear to be passing a wxCalendarCtrl when it would be expecting a wxDateTime. Try this code instead:
--/topic wxDateTime --/func get_days_in_month( atom dt ) -- --Returns the number of days in the specified month and year. global function get_days_in_month( integer month, integer year ) return cpp:call_cdecl( wxDateTime_GetNumberOfDays, { month-1, year, 0 }) end function --/topic wxCalendarCtrl --/func get_cal_days_in_month( atom cal ) -- --Returns the number of days in the currently selected month. global function get_cal_days_in_month( atom cal ) sequence d d = read_datetime( get_date_time( cal ) ) return get_days_in_month( d[Dt_month], d[Dt_year] ) end function
Matt Lewis