Home » Eclipse Projects » Remote Application Platform (RAP) » problem in selecting a particular date
problem in selecting a particular date [message #659148] |
Fri, 11 March 2011 09:55 |
marie Missing name Messages: 63 Registered: March 2011 |
Member |
|
|
hi all,
protected Control createContents(Composite parent)
{
//Composite container = new Composite(parent, SWT.NONE);
final CalenderUtil cal1 = new CalenderUtil(parent,SWT.NONE ,m_selDate );
final Label selectedDate = new Label(parent, SWT.NONE);
final DateFormat fmt = SimpleDateFormat.getDateInstance(DateFormat.LONG);
// Button cal=new Button(m_shell, SWT.PUSH);
cal1.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent e) {
String data=cal1.getdate();
selectedDate.setText(data);
System.out.println(data);
selectedDate.getParent().layout();
}
});
return selectedDate;
}
here i am calling claender util class i which is
public CalenderUtil(Composite parent, int style,Text selDate) {
m_comp = parent;
m_selDate = selDate;
final Button cals=new Button(m_comp, SWT.PUSH);
cals.setText("calendar");
cals.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent e) {
DateTime calendar = new DateTime (m_comp, SWT.CALENDAR | SWT.BORDER);
Button ok = new Button (m_comp, SWT.PUSH);
ok.setText ("OK");
ok.setLayoutData(new GridData (SWT.FILL, SWT.CENTER, false, false));
ok.addSelectionListener (new SelectionAdapter () {
public void widgetSelected (SelectionEvent e) {
m_comp.getShell().close ();
}
});
m_comp.getShell().setDefaultButton (ok);
m_comp.getShell().pack ();
m_comp.getShell().open ();
}
});
my problems
1) i tried with d mouselistener but is there any diff b/w rap control class
2) whn i click on calendar button it creates the calendar but it again created calendar button on calender dialog
can anybody help me to resolve it please
thanks in advance
|
|
|
Re: problem in selecting a particular date [message #659570 is a reply to message #659148] |
Mon, 14 March 2011 15:38 |
Ivan Furnadjiev Messages: 2426 Registered: July 2009 Location: Sofia, Bulgaria |
Senior Member |
|
|
Hi Mariya,
to be honest I don't understand what is your problem. Could you explain
it a little bit more?
Thanks,
Ivan
On 3/11/2011 11:55 AM, mariya wrote:
> hi all,
> protected Control createContents(Composite parent)
> {
>
> //Composite container = new Composite(parent, SWT.NONE);
> final CalenderUtil cal1 = new CalenderUtil(parent,SWT.NONE
> ,m_selDate );
> final Label selectedDate = new Label(parent, SWT.NONE);
> final DateFormat fmt =
> SimpleDateFormat.getDateInstance(DateFormat.LONG);
> // Button cal=new Button(m_shell, SWT.PUSH);
> cal1.addSelectionListener(new SelectionAdapter(){
> public void widgetSelected(SelectionEvent e) {
> String data=cal1.getdate();
> selectedDate.setText(data);
> System.out.println(data);
> selectedDate.getParent().layout();
> }
> });
> return selectedDate;
>
> }
> here i am calling claender util class i which is
>
> public CalenderUtil(Composite parent, int style,Text selDate) {
>
> m_comp = parent;
> m_selDate = selDate;
> final Button cals=new Button(m_comp, SWT.PUSH);
>
> cals.setText("calendar");
> cals.addSelectionListener(new SelectionAdapter(){
> public void widgetSelected(SelectionEvent e) {
>
> DateTime calendar = new DateTime (m_comp, SWT.CALENDAR
> | SWT.BORDER);
> Button ok = new Button (m_comp, SWT.PUSH);
> ok.setText ("OK");
> ok.setLayoutData(new GridData (SWT.FILL, SWT.CENTER,
> false, false));
> ok.addSelectionListener (new SelectionAdapter () {
> public void widgetSelected (SelectionEvent e) {
>
> m_comp.getShell().close ();
>
> }
> });
> m_comp.getShell().setDefaultButton (ok);
> m_comp.getShell().pack ();
> m_comp.getShell().open ();
>
> }
>
> });
>
> my problems
> 1) i tried with d mouselistener but is there any diff b/w rap control
> class
> 2) whn i click on calendar button it creates the calendar but it again
> created calendar button on calender dialog
>
> can anybody help me to resolve it please
>
> thanks in advance
|
|
| |
Re: problem in selecting a particular date [message #659680 is a reply to message #659659] |
Tue, 15 March 2011 08:27 |
Ivan Furnadjiev Messages: 2426 Registered: July 2009 Location: Sofia, Bulgaria |
Senior Member |
|
|
Hi Mariya,
add a selection listener to the DateTime (calendar) control and you
will be notified when the date is changed.
HTH,
Ivan
On 3/15/2011 6:36 AM, mariya wrote:
> ok
> here is the problem I am able to get the calendar but i want to select
> particular date from calendar and want to print this date in a text box.
> It is like some web application in which when u open a calendar and as
> u click on a particular date and this date will come in text box.
> see my code
>
> cals.setText("calendar");
> cals.addSelectionListener(new SelectionAdapter(){
> public void widgetSelected(SelectionEvent e) {
>
> DateTime calendar = new DateTime (m_comp, SWT.CALENDAR
> | SWT.BORDER);
> final Button ok = new Button (m_comp, SWT.PUSH);
> ok.setText ("OK");
> ok.setLayoutData(new GridData (SWT.FILL, SWT.CENTER,
> false, false));
> ok.addSelectionListener (new SelectionAdapter () {
> public void widgetSelected (SelectionEvent e) {
>
>
> m_comp.getShell().close ();
>
> }
> });
>
> m_comp.getShell().setDefaultButton (ok);
> m_comp.getShell().pack ();
> m_comp.getShell().open ();
>
> }
>
> });
>
>
> thanks in advance
> P.S. its an rap application
|
|
|
Goto Forum:
Current Time: Tue Apr 23 14:23:47 GMT 2024
Powered by FUDForum. Page generated in 0.03128 seconds
|