QUESTION: How to loop selection of dates |
Post Reply |
Author | |
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
Posted: 25 January 2009 at 7:20am |
Hi,
I'm totally new to this but for some of you this will be a piece of cake
Thanks a lot |
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Hi, Aaron, in current (12) version selection always means continious range
You can check in VB sample finction
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 which give you range: Selection.Begin and Selection.End - so you don't need smth between as it always in.
in Release 13 I add (in Month View only) discrete selection of days where you can have any set.
See snapshot: [unfortunately - Microsoft standard Month Picker (and similar CJ Month Picker) - used in DatePicker control - not supported discrete selection - so DatePicker at least now not reflect discrete selection inside Month View but user can use such temporary discrete selection e.g. to paste previously copied event into many different dates).
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi Mark,
I only want to use DatePicker control (not calendar control) for selecting dates. I would like to get the selected dates and save selection in a database and in a next session I would like to select the dates loading them from that database. Also I would like some days (which are special) to select with different backgrounds, so user easely sees what previously was selected.
I only want to present the dates, visual to the user, in for example a year, that's why I need this
Thanks a lot in advance
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
dentor
Senior Member Joined: 30 November 2005 Location: France Status: Offline Points: 102 |
Post Options
Thanks(0)
|
Hi Aaron,
For your application, you can use this subroutine CalcSelectDays to put the list of the selected days in SelectDays().
Dim NbDays As Long
Dim SelectDays() As Date Private Sub CalcSelectDays(NbDays as Long, SelectDays() as Date)
Dim i As Long NbDays = 0
ReDim SelectDays(NbDays) With DatePicker1.Selection For i = 0 To .BlocksCount - 1 AddSelectDays .Blocks(i).DateBegin, .Blocks(i).DateEnd, NbDays, SelectDays() Next End With For i = 1 To NbDays Debug.Print SelectDays(i) Next End Sub Private Sub AddSelectDays(DateBegin As Date, DateEnd As Date, Nb As Long, SelDays() As Date)
Dim Day As Date Day = DateBegin Do Nb = Nb + 1 ReDim Preserve SelDays(Nb) SelDays(Nb) = Day Day = DateAdd("d", 1, Day) Loop Until Day > DateEnd End Sub I Hope it was usefull for you.
And thanks for your so many contributions that make this forum so living.
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
You can use Descrete Selection Mode in DatePicker doing LeftClick holding Ctrl key pressed
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi @Dentor
This is very helpfull Thanks a lot for code snippet. This is how it should be in a forum: sharing knowlegde and willing to help others.
Thank you
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
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 |