From: Andre A. <ar...@ki...> - 2012-06-11 17:54:15
|
Andre Arpin <arpin@...> writes: > cal:Connect(wx.wxID_ANY, wx.wxEVT_CALENDAR_DAY_CHANGED, > function(event) > dt = event:GetDate() problem is that event:GetDate() is not cal:GetDate() but a temporary wxDateTime() the code should probably be dt = wx.wxDateTime(event:GetDate().JDN) but Houston we have a problem event:GetDate():GetJDN() returns a double and wx.wxDateTime expect an unsigned integer the best solution I could find is local tdt = event:GetDate() -- must init with a valid time (a valid JDN would work like 2456100) dt = wx.wxDateTime(os.time()) dt:SetYear(tdt:GetYear()) -- copy time from temporary dt:SetMonth(tdt:GetMonth()) dt:SetDay(tdt:GetDay()) dt:SetHour(tdt:GetHour()) dt:SetMinute(tdt:GetMinute()) dt:SetMillisecond(tdt:GetMillisecond()) I am sure there is a better way. Andre |