Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Date Selector Widget
Date Selector Widget [message #467102] Wed, 25 January 2006 01:53 Go to next message
Tim McKnight is currently offline Tim McKnightFriend
Messages: 6
Registered: July 2009
Junior Member
Does anyone know of a solid Date Selector widget? I know there is a source forge project called twister, but it's restricted by the size of the combo box.
Re: Date Selector Widget [message #467105 is a reply to message #467102] Wed, 25 January 2006 08:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ashraf.fouad.gmail.com

I used SWTCalendar found http://swtcalendar.sourceforge.net/ and really
cool :)
Re: Date Selector Widget [message #467134 is a reply to message #467102] Wed, 25 January 2006 16:49 Go to previous messageGo to next message
Daniel Spiewak is currently offline Daniel SpiewakFriend
Messages: 263
Registered: July 2009
Senior Member
I strongly recomend <a href="http://www.cwroethel.com/Projects/JPopupCalendar/">JPopupCalendar.</a> It still doesn't have the *most* SWT conventions compliant API - the developer is fixing this in the next release. It looks great on Windows and Linux and I really haven't had any performance or visual issues with it whatsoever. In lieu of a natively peered calendar control, this is pretty good.
Re: Date Selector Widget [message #467165 is a reply to message #467102] Thu, 26 January 2006 00:45 Go to previous messageGo to next message
Tim McKnight is currently offline Tim McKnightFriend
Messages: 6
Registered: July 2009
Junior Member
Those are both nice. The nicest one I have found so far is in a project called Twist. http://sourceforge.net/projects/twist/

These are some missing feature though (and the widget takes up some real estate. I am looking for a widget the has the ability to select a date from a calender (that pops up), type in the date and have spinners change the date

So if a user entered in 06/20/2006 i would want it to keep the slashes in place as they type. With respect the spinner if the cursor was in the Month field i would want it to control the month. If it was in the date it would move the date up and down.. so on and so forth. I

It's alot to ask, but i think it's the perfect date widget.
Re: Date Selector Widget [message #467282 is a reply to message #467102] Fri, 27 January 2006 17:05 Go to previous messageGo to next message
Peter Kliem is currently offline Peter KliemFriend
Messages: 35
Registered: July 2009
Member
Tim McKnight wrote:
> Does anyone know of a solid Date Selector widget? I know there is a source forge project called twister, but it's restricted by the size of the combo box.

just another datechooser: http://www.jaret.de/datechooser.html.
Features I missed in other datepickers
- date can be typed in (selectable error behaviour)
- week display
- display of special days (holidays)

Peter
Re: Date Selector Widget [message #467456 is a reply to message #467165] Tue, 31 January 2006 16:54 Go to previous messageGo to next message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 22
Registered: July 2009
Junior Member
Tim,

the code referenced in my recent post "Feedback *Greatly* Appreciated"
may be of interest.
(a screenshot is on sourceforge: http://sourceforge.net/projects/calypsorcp)

two notes regarding the missing features:
1. when entering the date via the keyboard, I had difficulty figuring
out when the user wanted to type a 2 digit date, or move to the next
field. Thus, I did the following:
- if they enter a digit, the current field is overwritten with the digit
- if they enter another digit, it is placed as the 2nd digit of the
current field (if that number would be valid: 23 is not considered a
valid month, otherwise it is thrown away and nothing happens)
- if they enter "/" (or use the arrow keys) it moves to the next field
- the "year" is special: you can set a max and min allowable range, and
if the entered value is outside of this range, it is reset to its
previous value when the selection changes fields. it waits until the
selected field changes because it would be entered as follows: 2, then
20, then 200, then 2006 - until the last, these are probably invalid
years (outside of the set range)

2. you can select a field with the arrow keys, and then use "-" or
SWT.KEYPAD_SUBTRACT to decrease its value, and "+", "=", or
SWT.KEYPAD_ADD to increase its value. I used the SWT.ARROW_DOWN to drop
the datepicker widget, so I couldn't use SWT.ARROW_DOWN & SWT.ARROW_UP
for spinning field values - which is one of the things I need feedback
on, do you have a preference?

Lastly, I also implemented vertical scrolling of the datepicker widget,
but I haven't yet figured out the best way to implement the scroll bar
(or if it should be there at all... maybe the mouse wheel and keyboard
are enough?)


anyway, sorry for the long post - hope this helps get you at least a
little closer to what you're looking for...



Tim McKnight wrote:
> Those are both nice. The nicest one I have found so far is in a project called Twist. http://sourceforge.net/projects/twist/
>
> These are some missing feature though (and the widget takes up some real estate. I am looking for a widget the has the ability to select a date from a calender (that pops up), type in the date and have spinners change the date
>
> So if a user entered in 06/20/2006 i would want it to keep the slashes in place as they type. With respect the spinner if the cursor was in the Month field i would want it to control the month. If it was in the date it would move the date up and down.. so on and so forth. I
>
> It's alot to ask, but i think it's the perfect date widget.
Re: Date Selector Widget [message #467494 is a reply to message #467456] Wed, 01 February 2006 03:06 Go to previous messageGo to next message
Tim McKnight is currently offline Tim McKnightFriend
Messages: 6
Registered: July 2009
Junior Member
------=_Part_758_27118177.1138763240261
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Jeremy,

Attached is something I started to layout for the way that my users want to enter the date.

Basically they way it will work is this (sorry for long response):

- Right click will pop up a calendar that will allow them to enter a date
- Given any text box they're in up arrow and down arrrows will allow them to change the number where the cursor is positioned
- Typing any number will over write whatever position the cursor is currently at and move onto the next skipping over any "/" so they don't have to type it (fairly similiar to the way you did it). i think you are spot on with the way you treat years, but see my next comment on how i might validate it
- from a validation perspective i will validate the date everytime it changes and make all the text red if a bad date is entered. i would allow them to enter an invalid date, but provide a method to make sure it's valid before any action is taken on that date. I find that when nothing happens users blame the app for being broke. This way they can only blame themselves.
*FeedBack* I like the add and subtract button but probably would reconsider having the down arrow drop down the date selector and here's why(please note i speak from the way i see people user my apps). Most business users live and die by the mouse. Rarely do i see them soley rely on the keyboard like myself so I don't think the down arrow would be used. I the case of someone like myself who may use the keyboard more to navigate and app i would liek the up and down arrows to move the date and maybe the F1 or F2 key to pop up a calender.

Hope this helps,
Tim
------=_Part_758_27118177.1138763240261
Content-Type: application/octet-stream; name=DateSelector.java
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=DateSelector.java

/*
* Created on Jan 26, 2006
*/
package com.ae.potool.viewer.form;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;


public class DateSelector extends Composite{

private Text monthText;
private Text dayText;
private Text yearText;
private Label slashLabel;
private FormLayout formLayout;

public DateSelector(Composite aParent){
super(aParent, SWT.BORDER);

formLayout = new FormLayout();
this.setLayout(formLayout);

//month text box
monthText = new Text(this, SWT.FLAT);
monthText.setTextLimit(2);
FormData data = new FormData(14, SWT.DEFAULT);
monthText.setLayoutData( data);

//first slash label
slashLabel = new Label(this, SWT.NULL);
slashLabel.setText("/");
slashLabel.setBackground(this.getShell().getDisplay().getSys temColor(SWT.COLOR_WHITE));
data = new FormData();
data.left = new FormAttachment (monthText, 0, SWT.DEFAULT);
slashLabel.setLayoutData(data);

//the text box for day
dayText = new Text(this, SWT.FLAT);
dayText.setTextLimit(2);
data = new FormData(14, SWT.DEFAULT);
data.left = new FormAttachment (slashLabel, 0, SWT.DEFAULT);
dayText.setLayoutData(data);

//here is the second slash
slashLabel = new Label(this, SWT.NULL);
slashLabel.setText("/");
slashLabel.setBackground(this.getShell().getDisplay().getSys temColor(SWT.COLOR_WHITE));
data = new FormData();
data.left = new FormAttachment (dayText, 0, SWT.DEFAULT);
slashLabel.setLayoutData(data);

//the year text
yearText = new Text(this, SWT.FLAT);
yearText.setTextLimit(4);
data = new FormData(30, SWT.DEFAULT);
data.left = new FormAttachment (slashLabel, 0, SWT.DEFAULT);
yearText.setLayoutData(data);

this.pack();


}

}

------=_Part_758_27118177.1138763240261--
Re: Date Selector Widget [message #467498 is a reply to message #467494] Wed, 01 February 2006 06:36 Go to previous messageGo to next message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 22
Registered: July 2009
Junior Member
Tim,

thanks for the feedback - I'm convinced regarding the down arrow key,
it's much better used in conjunction with the up arrow for inc/dec of
the active field. I've gotten so used to Ctrl-Space in Eclipse that it
is now used to drop the date selector.

I still don't automatically move to the next field (typing "/" is
required) because I'm not sure how to do this if single digit fields are
allowed (M/d/yyyy is its current setting), but perhaps if fields are set
to be two digits (MM/dd/yyyy) then an "auto-field-over" would be
activated...? (Note that being able to set the date format is an
important goal of this widget that should be completed by week's end)

I also changed the behavior for an invalid year. You're right that the
user needs to be alerted to the problem or something worse is going to
happen, so it now allows an "out of range" year, but changes the text
red until corrected.

As for the right click you mention, I'm not sure I follow... a left
click on the button will drop the calendar, but a right click on the
text drops the text box's native menu - something I wanted to leave
alone so the user can cut/copy/paste dates to and from the text box.
Did I miss your intent here?

thanks again!


Tim McKnight wrote:
> Jeremy,
>
> Attached is something I started to layout for the way that my users want to enter the date.
>
> Basically they way it will work is this (sorry for long response):
>
> - Right click will pop up a calendar that will allow them to enter a date
> - Given any text box they're in up arrow and down arrrows will allow them to change the number where the cursor is positioned
> - Typing any number will over write whatever position the cursor is currently at and move onto the next skipping over any "/" so they don't have to type it (fairly similiar to the way you did it). i think you are spot on with the way you treat years, but see my next comment on how i might validate it
> - from a validation perspective i will validate the date everytime it changes and make all the text red if a bad date is entered. i would allow them to enter an invalid date, but provide a method to make sure it's valid before any action is taken on that date. I find that when nothing happens users blame the app for being broke. This way they can only blame themselves.
> *FeedBack* I like the add and subtract button but probably would reconsider having the down arrow drop down the date selector and here's why(please note i speak from the way i see people user my apps). Most business users live and die by the mouse. Rarely do i see them soley rely on the keyboard like myself so I don't think the down arrow would be used. I the case of someone like myself who may use the keyboard more to navigate and app i would liek the up and down arrows to move the date and maybe the F1 or F2 key to pop up a calender.
>
> Hope this helps,
> Tim
Re: Date Selector Widget [message #467732 is a reply to message #467498] Sun, 05 February 2006 14:33 Go to previous messageGo to next message
Tim McKnight is currently offline Tim McKnightFriend
Messages: 6
Registered: July 2009
Junior Member
The right click i mentioned was refering to bringing up the calandar dialog. It looks like you solved this with the control space. What i was talking about with the right click was actually to have it bring up a menu with one of the actions the be able to bring up the calaneder (others may clear the date and give other actions that may may be helpful). One way i have seen other widgets get around telling the one vs 2 characters in the date is to default the date the second any character is typed in and over write the part in the date that the user typed in.

for example if a user was going to type in a 3 in the first spot in the year column it would look like thiis after it defauled:

02/05/3006

~Tim
Re: Date Selector Widget [message #467745 is a reply to message #467732] Sun, 05 February 2006 18:35 Go to previous messageGo to next message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 22
Registered: July 2009
Junior Member
Tim McKnight wrote:
> The right click i mentioned was refering to bringing up the calandar dialog. It looks like you solved this with the control space. What i was talking about with the right click was actually to have it bring up a menu with one of the actions the be able to bring up the calaneder (others may clear the date and give other actions that may may be helpful).

I started thinking that this was your intent, and certainly don't
disagree with it. Ideally these would be added to the top of the native
text widget's menu (which already has the edit commands).
I haven't done this only because I'm short on time and my two use cases
are covered: 1. Keyboard only - drop with the Ctrl-Space option (date
selector is fully usable via keyboard too); 2. Mouse (or Stylus) only
with reduced screen space - set the CDatepickerCombo's
"buttonVisibility" style to AUTO causes the button to be hidden whenever
the widget looses focus, and shown when the widget gains focus.
Adding the menu options is, however, on the to-do list.

One way i have seen other widgets get around telling the one vs 2
characters in the date is to default the date the second any character
is typed in and over write the part in the date that the user typed in.
>
> for example if a user was going to type in a 3 in the first spot in the year column it would look like thiis after it defauled:
>
> 02/05/3006

To handle this I ended up changing the number of digits based on the
active, or selection, status of each field: if the format is "M/d/yyyy"
and no field is active, it will display as "2/5/2006", but if field1 is
active (you are editing the month field) it will display as "02/5/2006"
with the "02" highlighted. This way it is consistant that when typing
in dates, the maximum digits must always be used, and it will
automatically move to the next field.
its probably easiest to try it out. I put a new demo in the project's
download section today: http://sourceforge.net/projects/calypsorcp

I also modified it so you can put the fields in any order (M/d/yy or
yyyy/MM/dd, etc.)
Re: Date Selector Widget [message #467746 is a reply to message #467745] Sun, 05 February 2006 19:45 Go to previous messageGo to next message
Tim McKnight is currently offline Tim McKnightFriend
Messages: 6
Registered: July 2009
Junior Member
I downloaded your demo and checked it out. It's quite impressive. Nice job. The only thing i notcied is that when using M/d/yyyy you cannot type in 10-12 months. You have to use the arrow key to get there. Other than that I think it's one of the nicest SWT date widgets i've seen yet. My favortie part is that it doesn't take up a ton of realestate.
Re: Date Selector Widget [message #467748 is a reply to message #467746] Sun, 05 February 2006 22:19 Go to previous message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 22
Registered: July 2009
Junior Member
Thanks for the compliments and bug - a fix is in CVS and a new release
(0.1.2) will be out shortly.

thanks again!


Tim McKnight wrote:
> I downloaded your demo and checked it out. It's quite impressive. Nice job. The only thing i notcied is that when using M/d/yyyy you cannot type in 10-12 months. You have to use the arrow key to get there. Other than that I think it's one of the nicest SWT date widgets i've seen yet. My favortie part is that it doesn't take up a ton of realestate.
Previous Topic:java.library.path settings when running an SWT application
Next Topic:Check box in Table viewer
Goto Forum:
  


Current Time: Thu Sep 19 04:05:30 GMT 2019

Powered by FUDForum. Page generated in 0.02363 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top