Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - CaptionBar <-> doesn't honor datepicker range
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CaptionBar <-> doesn't honor datepicker range

 Post Reply Post Reply
Author
Message
Fabian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 22 November 2004
Location: Switzerland
Status: Offline
Points: 336
Post Options Post Options   Thanks (0) Thanks(0)   Quote Fabian Quote  Post ReplyReply Direct Link To This Post Topic: CaptionBar <-> doesn't honor datepicker range
    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
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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;

Back to Top
Fabian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 22 November 2004
Location: Switzerland
Status: Offline
Points: 336
Post Options Post Options   Thanks (0) Thanks(0)   Quote Fabian Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Fabian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 22 November 2004
Location: Switzerland
Status: Offline
Points: 336
Post Options Post Options   Thanks (0) Thanks(0)   Quote Fabian Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2009 at 9:02am
Other people can use another logic... And improve your code to cover MonthView case
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.