MonthCalendar triggering problem
Hi guys & gals,
I have a work-in-progess 70k program, about 30 percent complete.
The program has a calendar made visible / invisible at times, and the user
selects a date by clicking on it. A few days of tinkering later, and I can't
get
it to work. (Can mail the whole thing but won't bore everybody)
Here is a demo of what I mean... can anybody else confirm similar
results, or show me where I am off my trolly/ smoking my socks..?
TIA, Alan
--
-- What's this? : Demo of inconsistent event handling of
-- : MonthCalendar, that w32HClick does
-- : not properly trigger when a date is
-- : clicked. w32HChange does trigger.
-- : setVisible might be involved, but it
-- : seems to make no difference here.
--
-- Date : 20th December 2002
-- Euphoria version: Eu 2.3 licenced (interpreter used here)
-- Machine : Athlon 1700, 256Mb DDR ram
-- OS : Win98SE
-- Display : 1280x1024, Voodoo3 16Mb, DirectX 8.0
-- Win32lib version: 0.57.9, 24/6/2002, Derek Parnell, et al,
-- : originally by David Cuny
--
-- runtime options
--
with trace
with type_check
with warning
without profile
--
-- includes
--
include win32lib.ew
--
-- GUI
--
constant Main = create(Window,"Strange Calendar",
0, Default,Default,230,300,0),
-- name owner hpos vpos hsiz vsiz flags
pb01 = create(PushButton,"Show Calendar",
Main, 010, 010, 090, 030, 0),
pb02 = create(PushButton,"Hide Calendar",
Main, 110, 010, 090, 030, 0),
cal1 = create(MonthCalendar,"unused title",
Main, 010, 090, 200, 180, 0),
ti01 = create(LText,"Date / status",
Main, 010, 050, 080, 020, 0),
et01 = create(EditText," ",
Main, 090, 050, 100, 020, 0)
--
-- variable declarations
--
sequence datetext
--
-- variable initial values
--
datetext = "Nothing yet"
--
-- Procedures and functions
--
procedure main()
setText(et01,datetext)
end procedure
procedure hide_calendar()
setVisible(cal1,False)
setText(et01,"Cal hidden")
end procedure
procedure show_calendar()
setVisible(cal1,True)
setText(et01,"Cal visible")
end procedure
--
-- triggered event procedures
--
procedure calendar_clicked(integer self,
integer event,
sequence parms)
sequence s1, s2, s3, s4, s5
integer i1
s1 = getSelectedDate(cal1)
i1 = s1[1] -- year
s2 = sprintf("%04d",i1)
i1 = s1[2] -- month
s3 = sprintf("%02d",i1)
i1 = s1[4] -- day
s4 = sprintf("%02d",i1)
s5 = s2 &s3 &s4 -- japanese date format
setText(et01,s5)
end procedure
procedure button_clicked(integer self,
integer event,
sequence parms)
if self = pb01 then show_calendar() end if
if self = pb02 then hide_calendar() end if
end procedure
--
-- define event handlers
--
setHandler({pb01, pb02},
w32HClick, -- works perfectly for buttons
routine_id("button_clicked"))
setHandler({cal1}, -- but for calendars....
-- w32HClick, -- This is what the win32lib doc says
w32HChange, -- but this is what works
routine_id("calendar_clicked"))
main()
WinMain(Main,Normal)
|
Not Categorized, Please Help
|
|