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






------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
wxlua-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to