1. What do triggers this event in MonthCalendar ?

My program has these lines, among others.

.. 
constant CAL1 = create( MonthCalendar,"Calendar", WIN1,10, 10, 386, 269, 0) 
.. 
setHandler( CAL1, w32HChange, routine_id("onSelectDate")) 
..  

Although I am not doing any action on the program, but the routine "onSelectDate" is being called every 60 seconds exactly.

I can not find what might be causing this event.

I wonder if I can change some setting for this event does not happen spontaneously.

Please, any idea?

new topic     » topic index » view message » categorize

2. Re: What do triggers this event in MonthCalendar ?

see if this helps
http://openeuphoria.org/forum/m/56256.wc

new topic     » goto parent     » topic index » view message » categorize

3. Re: What do triggers this event in MonthCalendar ?

Thanks Euman
But, I'm looking for a way to suppress the events that are not made by the user directly in the function MonthCalendar.
Is it impossible or is not an easy job?

new topic     » goto parent     » topic index » view message » categorize

4. Re: What do triggers this event in MonthCalendar ?

sergelli said...

Thanks Euman
But, I'm looking for a way to suppress the events that are not made by the user directly in the function MonthCalendar.
Is it impossible or is not an easy job?

Hi

I did some testing. This problem seems not to appear if your program uses Visual Styles. (new comctl32.dll)

The problem should disappear if you use the default Euphoria binaries (not the binaries i built without Visual Styles), but then you can't change the fonts for the calendar.

You may try the following solution.

-- File theme.ew 
include std/dll.e 
 
constant uxtheme = open_dll ("uxtheme.dll") 
     
constant mySetWindowTheme = define_c_proc(uxtheme,"SetWindowTheme",{C_HANDLE,C_POINTER,C_POINTER}) 
 
public procedure ThemeOff (atom handle) 
atom empty_string 
 
    empty_string=allocate_string("") 
     
    c_proc (mySetWindowTheme,{handle,empty_string,empty_string}) 
 
    free (empty_string) 
 
end procedure 

Use the default Euphoria binaries for you program and give this a try.

-- your program 
include theme.ew 
[..] 
constant CAL1 = create( MonthCalendar,"Calendar", WIN1,10, 10, 386, 269, 0)  
-- your code 
[..] 
 
ThemeOff(getHandle(CAL1)) 
 
WinMain( Win, Normal ) 
 

This way your program uses the new comctl32.dll but the calendar is without Visual Styles and you can change the font for it.
Hope this works for you-

Andreas

Andreas

new topic     » goto parent     » topic index » view message » categorize

5. Re: What do triggers this event in MonthCalendar ?

Your welcome,


Ok so Ive been away for a very long time from euphoria but as I remember things "w32HChange" is an OnChange event fired by either user activity or windows updating the date information and redrawing the control and is handled by the underlying win32lib

creating monthcalender2 and changing the routine to handle this change should have worked granted the code posted prior was for the parms passed was setup to change a certain text font.. you could remove that and check that this eliminates or changes the behavior, you could also have this output certain debug info ofcourse.. let me know if this might work

procedure MonthCalendar2_onChange (integer self, integer event, sequence 
 params) 
    object aDate 
    if length(params) > 0 then 
      .. out debug  
    end if 
 end procedure 

Derek wrote:

Anyhow, the way to work with this is to check the length of the 'params'
parameter in your event handler. If this is zero, then it is an
implicit date selection (e.g. The Next/Prev month was pressed). If
the length is 2 then it is an explicit user selection.

new topic     » goto parent     » topic index » view message » categorize

6. Re: What do triggers this event in MonthCalendar ?

change:
setHandler( CAL1, w32HChange, routine_id("onSelectDate"))

to
setHandler( CAL1, w32HChange, routine_id("MonthCalendar2_onChange"))
and in the above where I added .. out debug call your onSelectDate routine
if params > 0

new topic     » goto parent     » topic index » view message » categorize

7. Re: What do triggers this event in MonthCalendar ?

Euman said...

.. let me know if this might work

procedure MonthCalendar2_onChange (integer self, integer event, sequence 
 params) 
    object aDate 
    if length(params) > 0 then 
      .. out debug  
    end if 
 end procedure 

This feature does not differentiate one click to change the month and events that are not coming from the user.
For this, and others reasons who have not used the .. "if parms = 0 then" ..
Of course we can compare dates and solve the problem. but there was much more to be done. So, I dreamed I had an easier solution ..

Many thanks to Andreas and Euman

You give me the information needed to solve the problerma

new topic     » goto parent     » topic index » view message » categorize

8. Re: What do triggers this event in MonthCalendar ?

sergelli said...

the routine "onSelectDate" is being called every 60 seconds exactly.

I can not find what might be causing this event.

I'm sorry that I have not got back to you earlier about this.

The Change event for MonthCalendar controls gets invoked when either the user explicitly changes the control or when the system sends a 'heartbeat' notification. To quote the Microsoft documentation ...

Microsoft said...

This notification code is also sent by the system at regular intervals so that the control can respond to date changes.

Your application can tell the difference by looking at the third parameter in your handler routine. If that is an empty sequence, then it is a Windows generated event otherwise the third parameter contains the currently selected date range in the control ...

{  
  {Begin_year, Begin_Month, Begin_DayOfWeek, Begin_Day}, 
  {End_year,   End_Month,   End_DayOfWeek,   End_Day}, 
} 
new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu