Wx::DatePickerCtrl

From WxPerl wiki

Jump to: navigation, search

A control that allows a user to select a date.

Contents

Inheritance

Wx::DatePickerCtrl derives from Wx::Control, Wx::Window, Wx::EvtHandler, and Wx::Object.

Styles

Several "styles" are available for this control. These can be combined with the Perl binary-or operator ( | ).

wxDP_SPIN Creates a control without a month calendar drop down but with spin-control-like arrows to change individual date components. This style is not supported by the generic version.
wxDP_DROPDOWN Creates a control with a month calendar drop-down part from which the user can select a date.
wxDP_DEFAULT Creates a control with the style that is best supported for the current platform (currently wxDP_SPIN under Windows and wxDP_DROPDOWN elsewhere).
wxDP_ALLOWNONE With this style, the control allows the user to not enter any valid date at all. Without it - the default - the control always has some valid date.
wxDP_SHOWCENTURY Forces display of the century in the default date format. Without this style the century could be displayed, or not, depending on the default date representation in the system.

Events

Event Parameters Description
EVT_DATE_CHANGED ($win, $dp_ctrl, \&func) this event fires when the user changes the current selection in the control.

Constructor

new

$dp = Wx::DatePickerCtrl->new($parent, $id, $init_date, $pos, $size, $style, $validator, $name);

Parameters

Param Description
$parent Parent window object, must not be undef.
$id An integer specifying the window identifier. Usually you will specify -1 to let the system assign a window ID automatically.
$init_date The initial value for the control, a Wx::DateTime object. If omitted, today's date is used.
$pos The control position, a reference to an array containing an x and a y coordinate. The special value [-1, -1] tells the system to choose the window's starting position. Optional.
$size The size of the control. Usually you will specify [-1, -1] to tell the system to use a default size. Optional.
$style The style(s) to apply to this control; see above. Optional.
$validator TBD.
$name The name of the control. This parameter is used to associate a name with the control, which allows certain windowing systems to search for the window by name, and allows X resources values to be applied to the window by name.

Methods

GetRange

($lower, $upper) = $dp->GetRange();

Returns the current range limit, if one has been set with SetRange, as two Wx::DateTime objects: the lower (earlier) limit and the upper (later) limit.

If no range has been set, the results appear to be undefined.

GetValue

$dt = $dp->GetValue();

Returns the current value of the control.

SetRange

$dp->SetRange($lower, $upper);
Param Description
$lower The earlier date limit.
$upper The later date limit.

SetValue

$dp->SetValue($new_value);

Sets the value of the control. Calling this method does not fire a date-change event.

Unimplemented Methods

SetFormat

Google AdSense