Print Page | Close Window

CaptionBar <-> doesn't honor datepicker range

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=15055
Printed Date: 21 December 2024 at 9:53pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CaptionBar <-> doesn't honor datepicker range
Posted By: Fabian
Subject: CaptionBar <-> doesn't honor datepicker range
Date Posted: 27 August 2009 at 8:44am

If I set the range of dates of the datepicker control and link this datepicker control to the calendar control all works perfect. But one minor problem is, that the user is able to ignore these settings by clicking the caption bars prev. / next buttons.

Is there a property that I don't found or an other (simple) method to restrict the caption bars scrolling range?
 
 
Thanks for any idea
 
Using V13.1.0 unde VB6/SP6


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.3

Platform: Windows 7 (32bit)

Language: Visual Basic 6.0 / SP6



Replies:
Posted By: mdoubson
Date Posted: 28 August 2009 at 12:28am
You can hide this navigation buttons from Caption Bar if you don't need it - may be there is some notification on this button click (please check) - if yes - you can fix user choice in your reaction on notification XTP_NC_CALENDAR_CAPTIONBARPART_BEFORE_CLICK
 
with nPartID =

xtpCalendarCaptionBar_ScrollPrevDate = 0x00000100, // Defines ScrollDateBar PrevDateButton.

xtpCalendarCaptionBar_ScrollNextDate = 0x00000200, // Defines ScrollDateBar NextDateButton.

void CXTPCalendarCaptionBarTheme::OnPartClick(int nPartID)

{

BOOL bCancel = FALSE;

if (m_pConnection)

m_pConnection->SendEvent(XTP_NC_CALENDAR_CAPTIONBARPART_BEFORE_CLICK, (WPARAM)nPartID, (LPARAM)&bCancel);

if (GetCalendarCtrl() && !bCancel)

GetCalendarCtrl()->SendNotification(XTP_NC_CALENDAR_CAPTIONBARPART_BEFORE_CLICK, (WPARAM)nPartID, (LPARAM)&bCancel);

if (bCancel)

return;



-------------
Mark Doubson, Ph.D.


Posted By: Fabian
Date Posted: 28 August 2009 at 1:45am
I definitively need the previous/next buttons. They are very handy! But I use ActiveX under VB6 and I don't see how to restrict the working range of these buttons...

-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.3

Platform: Windows 7 (32bit)

Language: Visual Basic 6.0 / SP6


Posted By: mdoubson
Date Posted: 28 August 2009 at 1:55am
I already explained you - there is Event and Notification - see my prev post. You can react on it - if bCancel = TRUE - action (change date range) will be canceled
 
Another idea - if you don't want to react on CaptionBar notification - react on Calendar or DatePicker dates range changed
 
e.g.
 
Private Sub CalendarControl_SelectionChanged(ByVal SelType As XtremeCalendarControl.CalendarSelectionChanged)
    If SelType = xtpCalendarSelectionDays Then
        Debug.Print "SelectionChanged. Day(s)."
       
        If CalendarControl.ActiveView.Selection.IsValid Then
            Debug.Print CalendarControl.ActiveView.Selection.Begin
            Debug.Print CalendarControl.ActiveView.Selection.End
        End If
    End If
    If SelType = xtpCalendarSelectionEvents Then
        Debug.Print "SelectionChanged. Event(s)."
    End If
End Sub
Btw - you can make a post about new tooltip-related flag (show tooltip in non-active calendar app) - let's people know


-------------
Mark Doubson, Ph.D.


Posted By: Fabian
Date Posted: 28 August 2009 at 8:55am
OK - works partially but my solution is not very elegant because MonthView doesn't work:
 
Private Sub CalendarControl1_SelectionChanged(ByVal SelType As XtremeCalendarControl.CalendarSelectionChanged)
  Static InProgress_OK As Boolean
  Dim d1 As Date
  Dim d2 As Date
 
  If SelType = xtpCalendarSelectionDays And CalendarControl1.ViewType <> xtpCalendarMonthView And Not InProgress_OK Then
    InProgress_OK = True
    d1 = DateSerial(Year(Now()), Month(Now()) - AppConfig.Value("Agenda.nMonateRet", 0), 1)
    d2 = DateSerial(Year(Now()), Month(Now()) + APPFORWARD + 1, 1)
    If CalendarControl1.ActiveView.Days(0).Date < d1 Then
      CalendarControl1.ViewType = xtpCalendarDayView
      CalendarControl1.ActiveView.ShowDay d1
    End If
    If CalendarControl1.ActiveView.Days(CalendarControl1.ActiveView.DaysCount - 1).Date > d2 Then
      CalendarControl1.ViewType = xtpCalendarDayView
      CalendarControl1.ActiveView.ShowDay d2
    End If
    InProgress_OK = False
  End If
End Sub
 
 
probably there is a better solution. Best if caption bar buttons would honore the useable range of the attached date picker!
 
I use the built in caption bar!
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.3

Platform: Windows 7 (32bit)

Language: Visual Basic 6.0 / SP6


Posted By: mdoubson
Date Posted: 28 August 2009 at 9:02am
Other people can use another logic... And improve your code to cover MonthView case

-------------
Mark Doubson, Ph.D.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net