Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » DateChooser
DateChooser [message #84154] Wed, 23 April 2008 07:06 Go to next message
Eclipse UserFriend
Originally posted by: seenivasan.ramasubbu.gmail.com

Am new to RAP, as we are developing an enterprise application using RAP, I
need DateChooser urgently. pl help.

Seeni
Re: DateChooser [message #84184 is a reply to message #84154] Wed, 23 April 2008 07:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

This is a multi-part message in MIME format.

------=_NextPart_000_0068_01C8A527.72811970
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

Hi,

here is a simple DatePicker implementation based on composition of RWT
controls (see attachments). This is taken from the RAP Workbench Demo
(http://rap.eclipse.org/rapdemo/rms). The following codesnippet shows
how to position the datepicker at the correct position:


// parent container that contains button and text field
final Composite client = ...
final Button button = ...
final Text result = ...
button.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( final SelectionEvent evt ) {
Point location = calculateDatePickerLocation( client, button );
DatePickerDialog datePicker = new DatePickerDialog(
client.getShell() );
datePicker.setLocation( location );
Date selected = ( Date )STRING_TO_DATE_CONVERTER.convert( date
);
datePicker.setSelectedDate( selected );
String selectedDate = ( String )datePicker.open();
if( selectedDate != null ) {
result.setText( selectedDate );
}
}
} );


private static Point calculateDatePickerLocation( final Composite
client,
final Button botton
)
{
Point location
= client.getDisplay().map( client, null, botton.getLocation() );
int x = location.x + 3;
int y = location.y + botton.getSize().y + 4;
return new Point( x, y );
}

Hope that helps.


Ciao
Frank


-----Urspr
Re: DateChooser [message #84320 is a reply to message #84184] Wed, 23 April 2008 14:47 Go to previous message
Eclipse UserFriend
Originally posted by: seenivasan.ramasubbu.gmail.com

Thank you very much Frank. Let me try this code and come back to you.

Thanks again,
seeni
Previous Topic:theme variants not working on Text and Composite
Next Topic:Documentation?
Goto Forum:
  


Current Time: Tue Sep 24 06:37:11 GMT 2024

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

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

Back to the top