![]()  | 
 
DatePicker DayMetrics | 
 
    Post Reply  
   | 
  
| Author | |
   
   apuhjee  
   
   Senior Member  
   Joined: 02 September 2005 Location: United States Status: Offline Points: 130  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Topic: DatePicker DayMetricsPosted: 19 June 2007 at 3:39pm  | 
 
| 
   
    
   Is this event fired for all visible days every time the selection is changed? 
 
   
  jp 
    | 
 |
![]()  | 
 |
   
   apuhjee  
   
   Senior Member  
   Joined: 02 September 2005 Location: United States Status: Offline Points: 130  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 19 June 2007 at 4:09pm | 
 
| 
   
    
   Let's assume that it does...  let's also assume that the process needed to determine the metrics is non-trivial.  Two questions:
 
   
  1)  Is there a way to update the metrics once, then set AskDayMetrics = false until the months displayed change?  I guess another way of asking this would be:  Is there a way to determine when the control has finished updating...? 
2)  Is the metrics object being destroyed after the event handler exits?  I've tried passing this object on to a non-blocking handler... but modifications to that object are not reflected in the control. 
jp  
    | 
 |
![]()  | 
 |
   
   apuhjee  
   
   Senior Member  
   Joined: 02 September 2005 Location: United States Status: Offline Points: 130  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 19 June 2007 at 8:44pm | 
 
| 
   
    It's worse than I thought. Several things seem to cause every single day to refire the DayMetrics event: 1) Change selected date 
2) Change to another month 
3) MouseEnter Today button 
4) MouseLeave Today button 
5) MouseEnter None button 
6) MouseLeave None button 
That pretty much renders this event completely unusable - thus eliminating the ability to modify DatePicker font style. 
Please - someone chime in here and tell me I'm crazy.  Why would I want to refresh font metrics for something that's still visible on the screen? 
    | 
 |
![]()  | 
 |
   
   sserge  
   
   Moderator Group  
   Joined: 01 December 2004 Status: Offline Points: 1297  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 06 July 2007 at 5:45pm | 
 
| 
   
    
   Currently DayMetrics asked for each control's redraw for each visible day.  
   
  This operation assumed to be fast and lightweight. And yes, metrics object is created and destroyed for each method call. It could be still visible, but it's size, font or position could be already changed for a moment of redraw. Certainly additional improvements could be added like some caching, but this is a target for future versions. -- WBR, Serge  | 
 |
![]()  | 
 |
   
   LarryInCanada  
   
   Newbie  
   Joined: 28 April 2009 Status: Offline Points: 7  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 14 November 2012 at 12:39pm | 
 
| 
   
    
   
This issue is driving me insane.   
   
  I want to be able to run the Day Metrics one single ime, and then set it so id does not re-run.  I know this post is 7 or 8 years old, so I am hoping to god that this has finally been addressed???? Someone, anyone, please help me out here......  | 
 |
![]()  | 
 |
   
   Boris  
   
   Senior Member  
   Joined: 21 June 2007 Location: United Kingdom Status: Offline Points: 179  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 19 December 2012 at 3:06am | 
 
| 
   
    
   No it hasn't. 
 
   
  I only need to read my db once or when the user changes the month so I was doing this: 
Private Sub DatePicker1_DayMetrics(ByVal Day As Date, ByVal Metrics As XtremeCalendarControl.IDatePickerDayMetrics) 
Dim rst As ADODB.RecordSet 
Set rst = New ADODB.RecordSet ' query db based on day. If Not rst.EOF Then 
    rst.MoveFirst 
    Do 
    Metrics.Font.Bold = True 
rst.MoveNext Loop Until rst.EOF End If 
rst.Close 
If Day = Me.DatePicker1.LastVisibleDay Then Me.DatePicker1.AskDayMetrics = False End Sub 
now i would have thought that if day equals the last visible day I could turn off the metrics. Yes that works. until the control loses focus then all the dates disappear. Also you have to load the form with metrics on. Explicity turning back on the metrics does not refresh the dates and you have to manually select the control with the mouse and use a DatePicker1.AskDayMetrics = True in the .selectionchanged event. Not good! Perhaps Larry you could try modifying my code and share if you fix it. Cheers 
    | 
 |
| 
   
     
     Boris 
   
  Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1 Platform: Windows XP (32bit) - SP 3 Language: Visual Basic 6.0 SP6 VS 2005-2008-2010-2013  | 
 |
![]()  | 
 |
    Post Reply  
   | 
  |
|       
  
  Tweet   	
    | 
 
| Forum Jump | Forum Permissions  ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum  |