DateChooser [message #84154] |
Wed, 23 April 2008 07:06 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03688 seconds