Hi,
I'm trying to count the blocks selected with progress langage.
The action is done with the "OCX.selectionChanged" and I have a problem, when I select more than 1 day on the datePicker, the blocksCount is always equals to "1".
this is my code:
DEF VAR DTdateDebut AS DATE NO-UNDO. DEF VAR DTdateFin AS DATE NO-UNDO. DEF VAR DTcpt AS INT NO-UNDO.
chDAtePick:DatePicker:Selection():AllowNoncontinuousSelection = TRUE. /*autorise la séléction multiple*/ DTcpt = chDAtePick:DatePicker:Selection():BlocksCount. /*nb de jours séléctionnés*/ MESSAGE DTcpt VIEW-AS ALERT-BOX INFO BUTTONS OK.
CASE DTcpt: WHEN 1 THEN DO: DTdateDebut = chdatepick:datepicker:SELECTION(0):datebegin. /*séléction d'un block*/ chctrlframe:calendarcontrol:dayview:showday(STRING(DTDateDebut),TRUE). RUN init-initDemarrage. chCtrlFrame:CalendarControl:ViewType = 0. /*vue sur 1 jours*/ END.
WHEN 2 OR WHEN 3 OR WHEN 4 OR WHEN 5 OR WHEN 6 THEN DO: DTDateDebut = chDAtePick:DatePicker:Selection():Blocks(0):DateBegin. /*récupère le premier jour*/ DTDateFin = chDAtePick:DatePicker:Selection():Blocks(DTcpt - 1):DateEnd. /*récupère le dernier jour séléctionné*/ chctrlframe:calendarcontrol:dayview:showdays(STRING(DTdateDebut),STRING(DTDateFin)). RUN init-initDemarrage. chCtrlFrame:CalendarControl:ViewType = 1. /*vue sur 5 jour*/ END.
WHEN 7 THEN DO: DTDateDebut = chDAtePick:DatePicker:Selection():Blocks(0):DateBegin. /*récupère le premier jour*/ DTDateFin = chDAtePick:DatePicker:Selection():Blocks(DTcpt - 1):DateEnd. /*récupère le dernier jour séléctionné*/
chctrlframe:calendarcontrol:dayview:showdays(STRING(DTdateDebut),STRING(DTDateFin)). RUN init-initDemarrage. chCtrlFrame:CalendarControl:ViewType = 2. /*vue sur 7 jour*/ END.
OTHERWISE DO: DTDateDebut = chDAtePick:DatePicker:Selection():Blocks(0):DateBegin. /*récupère le premier jour*/ DTDateFin = chDAtePick:DatePicker:Selection():Blocks(DTcpt - 1):DateEnd. /*récupère le dernier jour séléctionné*/ chctrlframe:calendarcontrol:dayview:showdays(STRING(DTdateDebut),STRING(DTDateFin)). RUN init-initDemarrage. chCtrlFrame:CalendarControl:ViewType = 3. /*vue sur 1 mois*/ END.
END CASE.
Can you help me? I don't know where is my problem.
Thanks.
Tristan
|