Class
Ldatebox
Home
In: locana/l_datebox.rb
Parent: Lspinner

This is a date object that allows you to enter a date. This class is based on the Lspinner class. The spinner adds 1 day or subtracts one day from the date. This includes an additional button that opens the Lcalendar_window object allowing you to interactively select a date and/or time. To change the default format for all date objects you can redefine the default_date_format method. To change the default format for the time for all date objects you can redefine the default_time_format method.

Here are some interesting differences regarding events in the Ldatebox object:

Here is a list of additional attributes supported only by the Ldatebox class:

Operation:

Methods

add_seconds, clientW, close, date_format, date_format=, default_date_format, default_time_format, get_date, include_objects, include_time?, move, on_decrement, on_down_key, on_increment, on_key_press, on_pagedown_key, on_pageup_key, on_up_key, open, open_calendar, pixel_width, prepare, state=, time_format, time_format=, valid_attribute?, value, value=,
Public Instance methods
valid_attribute?(attribute, lvalue=nil) src

Supports the :value, :otype, :date_format, and :time_format attributes.

include_objects() src

Creates the button that opens the Lcalendar_window.

default_date_format() src

Returns the default date format used by the Ldatebox object. The default is ’%m/%d/%Y’. To change the default for all dates, you can redefine this method to return the date format of your choice. You can also include the following in a theme to have a per-theme default:

 :default => {
    :datebox => {:date_format=>'%m/%d/%Y', :time_format=>' %I:%M %p'}
 },

These values can be supplied directly to the object so you can have a different format for each Ldatebox object.

default_time_format() src

This method returns the default time format used by the Ldatebox object. See default_date_format() above for more details. Ignored unless :otype = :include_time. The default is ’ %I:%M %p’.

open(parent) src

Need to open the button.

close() src

Close this object, we need to make sure we close the listbox and button.

prepare(parent=nil, move_obj=nil) src

Make sure the button is positioned and sized correctly. The height of the buttons matches the height of the spinner.

move(x, y, w=nil, h=nil, remember_position=nil) src

Repositions the button based on the new size of the datebox.

date_format() src

Returns the date format for this object. If the :date_format attribute has been specified, it is returned. Otherwise returns default_date_format().

date_format=(new_value) src

Sets the date format for this object. Please note, this should not include the time format.

time_format() src

Returns the time format for this object. If the :time_format attribute has been specified, it is returned. Otherwise returns default_time_format().

time_format=(new_value) src

Sets the time format for this object. Please note, this should not include the date format.

pixel_width() src

The pixel width of the textbox + the width of the buttons.

clientW() src

The pixel width of the spinner less the pixel width of the button.

include_time?() src

Returns true when this datebox includes the time.

state=(new_value) src

Forward this to the button.

get_date() src

Returns the value in the textbox as a date (Time object). Raises InvalidDateError if the date in the datebox is invalid. Alias for value.

value() src

Returns the content of the datebox as a Time object. Alias for get_date.

value=(new_value) src

Sets the date in the datebox. new_value - a Time object.

on_increment(levent=nil, &block) src

Adds one day to the date.

on_decrement(levent=nil, &block) src

Subtracts one day from the date.

add_seconds(seconds) src

Add seconds to the date in the datebox.

open_calendar() src

Opens the Lcalendar_window, allows the user to interactively select a date, places the selected date in the textbox, and triggers the :on_change event after a date has been selected.

on_pageup_key(levent=nil, &block) src

Holding shift, ctrl, or alt opens the calendar window, otherwise adds 1 month to the date.

on_pagedown_key(levent=nil, &block) src

Holding shift, ctrl, or alt opens the calendar window, otherwise subtracts 1 month from the date.

on_up_key(levent=nil, &block) src
on_down_key(levent=nil, &block) src
on_key_press(levent=nil, &block) src

’+’ key adds 1 day, ’-’ key subtracts 1 day.


Seva Software


Thank you for taking the time to visit this web page. I trust you found the information contained in this page useful.
Please email any questions, concerns, or issues with this web site to webmaster@sevasoftware.com.
Please remember Seva Software when your company would benefit from an experienced database architect and software engineer.

http://www.arunadb.org http://www.locana.org http://www.ruby-lang.org http://www.coolwell.org http://www.sevasoftware.com