LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

problen using the activex calendar control with CVI

Hi, Im having a problen using the activex calendar control with CVI8.
When I click the date at the control, it looks like it change, but if I try to read the day value (MSACAL_ICalendarGetDay(caleHandle,NULL,&DayVal)) ,
I read the day that was before I clicked the calander.
So only after I re-click the date , that function that get the day value return the correct day (DayVal).
 
I tried to use the before/after update functions, but it didnt work.
The EVENTS (EVENT_LEFT_CLICK) are working properly, and when I click at the calendar the function works and tried to read the values so the problem is not there.
 
Does anyone have a solution?
 
Thank you,
 
trz.
0 Kudos
Message 1 of 6
(4,258 Views)

I'm not sure what you mean. I tried this little example program and it seemed to work correctly. Does this work for you?

- jared

0 Kudos
Message 2 of 6
(4,238 Views)

Hi,

 

Thank you for your example. The thing is that I didnt wanted to use a "set day" botton. For example, when you use your MS outlook, you dont push  "set day" bottom everytime you choose day from the calendar.

I tried to declare the activex calander as a function(at the UIR), and indeed every time I press a day at the calander, I reached to that function, but inside that function when I use the Get day function, It retuens the previous calander status (before I pushed it).If I'll push the same day value again at the calendar, I'll get the right day. I have "one read Shift" between the pushed day and the read (get day) day.

 

Thank's again;

 

Trz

0 Kudos
Message 3 of 6
(4,223 Views)
Ok, I understand the problem. The EVENT_LEFT_CLICK events are swallowable. That means that if you return 1 from the left click event, the control (or whatever you clicked on) will not respond to the click. This means that the callback receives the EVENT_LEFT_CLICK before the control is able to respond to the click. This explains why you got the last value every time you clicked on the calendar.
 
To get around this, you can post a deferred call to another function that will be called after the left click is processed by the calendar. Try this example program.
 
- jared
Message 4 of 6
(4,211 Views)

Hello, Here I am, 11 years later 😄

 

The example works fine. thank you Jared.

I tried to do the same thing in my application, using a deferred function. 

The problem is that the date don't change. Each time :  EVENT_LEFT_CLICK => Deferred function Call => I get the same date

 

Even if as I said, the example works fine. 

 

0 Kudos
Message 5 of 6
(3,011 Views)

Hello, Here I am, 11 years later 😄

 

The example works fine. thank you Jared.

I tried to do the same thing in my application, using a deferred function. 

The problem is that the date don't change. Each time :  EVENT_LEFT_CLICK => Deferred function Call => I get the same date

 

Even if as I said, the example works fine. 

 

0 Kudos
Message 6 of 6
(3,011 Views)