SWT: Datetime Widget on top of Spinner [ Progress Report]

What is the problem with DateTime widget ?

Datetime is an SWT widget that shows DATE/TIME/CALENDAR, so overall very useful widget!

In current version of SWT  it looks like this:

So as you might have guessed DateTime  is a Composite of Text, Button with Arrow Up and Button  with Arrow Down. All this elements are separate widgets that are brought together to work synchronously at the time when widget is created. The problem is that creating a separate widget for every element and making all these widgets work together takes a lot of resources.

Also, If I use some weird GTK+ theme (Gnome-Cuepertino in screenshot) my Arrows on the buttons become invisible:


Finally, if we take a look at other widget with similar functionality (Spinner photo below) we may see that it has different buttons, so there is no consistency between widgets in SWT.


Is there an alternative solution ?

One of the possible solutions that we (Red Hat Eclipse Team) have proposed is to use Spinner widget as a back-end for DateTime widget.

Why to use Spinner ?

1. It has 2 buttons and a Text area, and all this works together by single widget. (Less resources required)
2. Spinner buttons are part of the Spinner itself, so they won’t disappear if you change to some weird theme3. Spinner and DateTime will have similar look, which will create consistency

So the next question would be:

What was being done on this front ?

I have been working on  migrating the  DateTime widget to Spinner couple of months ago, but due a lot of other work that was supposed to be done and long review time, this work was put into a shelf. However recently, when most of the crucial work on GTK+ 3 was done, I have decided to come back to it, and some significant progress was achieved.

So here is the first look of how DateTime may look when running on top of Spinner:

Theme Adwaita (GTK+ 2):
datetime_newAs you might see it still has Text area and Buttons, but they act as a single widget this time. (less resources needed)

So if I try to look at the same widget using some weird GTK+ theme (again Gnome-Cuepertino), you still can see buttons:


Finally if we take a  look at the  Spinner widget  next to DateTime widget:


You can see the consistency :)
I will continue working on it, and hopefully soon it will take its place in the SWT family.

I will keep you updated!



About the author

Anatoly Spektor

IT Consultant with 6 years experience in Software Development and IT Leadership. Participated in such projects as Eclipse IDE, Big Blue Button, Toronto 2015 Panam Games.

View all posts

1 Comment

  • First time into your blog and got fascinated by GTK+, though had heard about it, some of my php friends were talking about it. But nice to know that it has got cool visual components to be used in front end. Though it is not much of my use because I am a VB programmer. But its nice to see some great work being done in open-source space.

Leave a Reply

Your email address will not be published. Required fields are marked *