Wt::WDatePicker Class Reference

A date picker. More...

#include <WDatePicker>

Inheritance diagram for Wt::WDatePicker:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 WDatePicker (WInteractWidget *displayWidget, WLineEdit *forEdit, bool i18n=false, WContainerWidget *parent=0)
 Create a new date picker.
void setFormat (const WString &format)
 Set the format used for parsing or writing the date in the line edit.
const WStringformat () const
 Get the format.
WCalendarcalendar () const
 The calendar widget.
WLineEditlineEdit () const
 The line edit.
WInteractWidgetdisplayWidget () const
 The display widget.
WDate date () const
 The current date.
void setDate (const WDate &date)
 Set the current date.


Detailed Description

A date picker.

A date picker works in conjunction with a WLineEdit to popup a WCalendar for editing the date. The date picker itself is typically displayed as a button next to the line edit. When the user clicks the button, a calendar pops up which may be used to pick a new date. Any date entered in the line edit is reflected in the calendar, and vice-versa.

Each of these widgets may be accessed individually (lineEdit(), calendar(), and displayWidget()).

The date format used by default is 'dd/MM/yyyy', but can be changed using setFormat(). At any time, the date set may be read using date(), or can be changed using setDate().

WDatePicker-1.png

WDatePicker using a WPushButton as displayWidget


Constructor & Destructor Documentation

Wt::WDatePicker::WDatePicker ( WInteractWidget displayWidget,
WLineEdit forEdit,
bool  i18n = false,
WContainerWidget parent = 0 
)

Create a new date picker.

The displayWidget represents the button or image which much be clicked to open the date picker. This widget may not yet have a parent, and becomes owned by the picker.

The forEdit argument is the lineEdit which works in conjunction with the date picker. This widget is not part of the date picker, and may be located anywhere else.

i18n is passed to the WCalendar constructor.


Member Function Documentation

void Wt::WDatePicker::setFormat ( const WString format  ) 

Set the format used for parsing or writing the date in the line edit.

Sets the format used for parsing the value of the lineEdit, or for setting the value of the lineEdit.

See also:
format(), WDate::toString(const WString&) const

const WString& Wt::WDatePicker::format (  )  const [inline]

Get the format.

Get the current format used to parse dates from the lineEdit text, or to set the lineEdit text from a selected date in the calendar.

See also:
setFormat()

WCalendar* Wt::WDatePicker::calendar (  )  const [inline]

The calendar widget.

Returns the calendar widget.

WLineEdit* Wt::WDatePicker::lineEdit (  )  const [inline]

The line edit.

Returns the line edit which works in conjunction with this date picker.

WInteractWidget* Wt::WDatePicker::displayWidget (  )  const [inline]

The display widget.

Returns the widget which is displayed to activate the calendar.

WDate Wt::WDatePicker::date (  )  const

The current date.

Reads the current date from the lineEdit().

Returns an invalid date (for which WDate::isValid() returns false) if the date could not be parsed using the current format().

See also:
setDate()

WDate::fromString(const WString&, const WString&)

WLineEdit::text()

void Wt::WDatePicker::setDate ( const WDate date  ) 

Set the current date.

Does nothing if the current date is Null.

See also:
date()


The documentation for this class was generated from the following files:
Generated on Mon Apr 14 15:15:01 2008 for Wt by doxygen 1.5.3