1. MonthCalendar triggering problem
- Posted by Alan Oxley <fizzpop at icon.co.za> Dec 25, 2002
- 401 views
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)
2. Re: MonthCalendar triggering problem
- Posted by Alan Oxley <fizzpop at icon.co.za> Dec 26, 2002
- 407 views
Yeah, I could just use w32HChange, but: this requires me to add another pushbutton to "confirm" that this date is the desired one... because w32HChange is also triggered by any change, eg rolling forward to another month. Funny thing is, w32hClick does work, sometimes! Normally the first time that you make the calendar visible, its ok; make it invisible and visible again and w32HClick laughs at you. At least, thats whats happening in my app, so I created the minimal demo to show the problem. Murphy's law - the demo IS consistent, in that it w32HClick never works. Sigh... Its the inconsistent behaviour thats very annoying and timewasting when writing an app. Its bad form to critisize Derek's code when its entirely free I suppose, but I'm hoping Derek will comment or fix this in the next Win32lib release. Probably after Eu 2.4 ? Thanks, Alan > Seems like you have two choices: > Either ignore/change the beta documentation, or modify the beta win32lib source to conform to what-ever behavior you > prefer. > Don't mean this to be a 'smartass' answer, but Derek's flipped 'Click', and 'Change' more than once in the last year, > for "LIST" behaviors, ...as well ) > Your demo works 'as-is', ( using w32HChange(), in win32libs 0.55.1, 0.55.5, 055.10. > ...sigh! > >