[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] timeline/schedule

If you want complete control over the look and feel of your timeline, you 
probably want to draw it all yourself on a Canvas.
You'll need to add events for painting & resize, events for handling 
traversal and other key events, drag & drop handling, etc.

There are a couple of SWT graphics examples that you might find useful.
One is called PaintExample (which shows how to do rubber-band line drawing 
- might be useful), and one is called GraphicsExample (lots of animations 
and moving lines <grin>).
You can see how to download and run both of these examples here: 
http://www.eclipse.org/swt/examples.php

Also, depending on how you want the date line to look when it is being 
dragged, you might find Tracker interesting:
http://www.eclipse.org/swt/snippets/#tracker

Or maybe you prefer to have your users drag around a borderless shell 
containing their selected date range, something like this:

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;

public class ShellNoTrimDrag {
public static void main(String[] args) {
        final Display display = new Display();
        final Shell shell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP);
        shell.setBackground(display.getSystemColor(SWT.COLOR_RED));
        shell.setSize(200, 100);
        Listener listener = new Listener() {
                Point origin;
                public void handleEvent(Event e) {
                        switch (e.type) {
                                case SWT.MouseDown:
                                        origin = new Point(e.x, e.y);
                                        break;
                                case SWT.MouseUp:
                                        origin = null;
                                        shell.close();
                                        break;
                                case SWT.MouseMove:
                                        if (origin != null) {
                                                Point p = 
display.map(shell, null, e.x, e.y);
                                                shell.setLocation(p.x - 
origin.x, p.y - origin.y);
                                        }
                                        break;
                        }
                }
        };
        shell.addListener(SWT.MouseDown, listener);
        shell.addListener(SWT.MouseUp, listener);
        shell.addListener(SWT.MouseMove, listener);
        shell.open();
        while (!shell.isDisposed()) {
                if (!display.readAndDispatch())
                        display.sleep();
        }
        display.dispose();
}
}

Hope this helps,
Carolyn






[platform-swt-dev] timeline/schedule

Javier Godinez 
to:
platform-swt-dev
04/09/2008 09:38 PM


Sent by:
platform-swt-dev-bounces@xxxxxxxxxxx
Please respond to "Eclipse Platform SWT component developers list." 
<platform-swt-dev@xxxxxxxxxxx>






Hey guys/gals,

I am trying to build a timeline/schedule application where one can
choose a start and end date and populate the timeline with events of
different types. The events should be draggable as to extend the time
interval as well as to shift the dates (move both start and end
dates). I am just wondering which widget/widgets would be the best to
use. I am thinking I can use some sort of canvas? Does anyone know
anything that has similar functionality? Here is an image of what I'm
talking about: http://www.flickr.com/photos/25490294@N02/2401496683/


Thanks,
Javier Godinez
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev