File: w_dropdown_calendar.srw
Size: 1480
Date: Mon, 07 Apr 2008 21:32:01 +0200
$PBExportHeader$w_dropdown_calendar.srw
forward
global type w_dropdown_calendar from w_base_dropdown
end type
type mc_1 from u_mc within w_dropdown_calendar
end type
end forward

global type w_dropdown_calendar from w_base_dropdown
integer width = 736
integer height = 560
mc_1 mc_1
end type
global w_dropdown_calendar w_dropdown_calendar

on w_dropdown_calendar.create
int iCurrent
call super::create
this.mc_1=create mc_1
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.mc_1
end on

on w_dropdown_calendar.destroy
call super::destroy
destroy(this.mc_1)
end on

event ke_initvalue;call super::ke_initvalue;Date ldt
string ls
IF ISNULL(value) THEN RETURN

TRY
   ls = STRING(value)
   ldt = DATE(ls)
   IF ldt <>  DATE('1900-01-01') THEN
      mc_1.SetSelectedDate(ldt)
   END IF
CATCH (RuntimeError ex)
   //swallow
END TRY
end event

event ke_postinit;call super::ke_postinit;this.Resize(mc_1.width + 8, mc_1.height + 8)
end event

event key;call super::key;IF key = KeyEnter! THEN
   IF ISVALID(inv_dropdown) THEN
      date ld
      mc_1.GetSelectedDate(ld)
      inv_dropdown.POST of_SetReturnValue(ld)
   END IF
END IF
end event

type mc_1 from u_mc within w_dropdown_calendar
integer width = 782
integer height = 612
integer taborder = 10
end type

event doubleclicked;call super::doubleclicked;IF ISVALID(inv_dropdown) THEN
   date ld
   this.GetSelectedDate(ld)
   inv_dropdown.POST of_SetReturnValue(ld)
END IF
end event