Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Accessing Properties of Custom Dialog(I've to access the properties of a custom dialog i created)
icon5.gif  Accessing Properties of Custom Dialog [message #754033] Mon, 31 October 2011 10:51 Go to next message
Arul  is currently offline Arul
Messages: 2
Registered: October 2011
Junior Member
I'm learning SWT and i have created a custom dialog by extending the Dialog class.

KeyDialog:

public class KeyDialog extends Dialog 
{
	Object result;
	String str;

	public KeyDialog(Shell parent,int style)
	{
		super(parent,style);
	}
	
	public KeyDialog(Shell parent)
	{
		this(parent,0);
	}
	
	public Object open () 
	{
	      //My code goes here
	
		return result;
	}	
}


I have opened this dialog from another class as :

Object res;
kd1=new KeyDialog(shell);
res=kd1.open();


How can i access the String str in KeyDialog class ?

Any suggestions are welcome......
Re: Accessing Properties of Custom Dialog [message #754040 is a reply to message #754033] Mon, 31 October 2011 11:00 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
On 2011-10-31 15:51, Arul wrote:
> I'm learning SWT and i have created a custom dialog by extending the
> Dialog class.
>
> KeyDialog:

[..]

> I have opened this dialog from another class as :
>
> Object res;
> kd1=new KeyDialog(shell);
> res=kd1.open();

This form of getting the return type of open looks suspicious. What does
it help that you query the int value as an Object?

> How can i access the String str in KeyDialog class ?
>
> Any suggestions are welcome......

There is no much magic behind that, just do it as you would do it in
other classes: Provide a getter for it.

HTH & Greetings from Bremen,

Daniel Krügler
Re: Accessing Properties of Custom Dialog [message #754049 is a reply to message #754040] Mon, 31 October 2011 11:21 Go to previous message
Arul  is currently offline Arul
Messages: 2
Registered: October 2011
Junior Member
Thank you Daniel...

I didn't think about that. Worked superb....
Previous Topic:Problem with ScrolledPageBook, SashFom and TableViewer combined
Next Topic:Tooltip on Text
Goto Forum:
  


Current Time: Fri Jul 25 15:58:28 EDT 2014

Powered by FUDForum. Page generated in 0.01983 seconds