Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Need help for creating custim cell
Need help for creating custim cell [message #16225] Sun, 05 November 2006 12:31 Go to next message
Kaniska Mandal is currently offline Kaniska MandalFriend
Messages: 34
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_00CC_01C70104.5E2330D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

I want to display a check box, read only text and a button in a single =
cell of CTableTreeItem.
I created a custom cell having the following createTitleContents() ...

protected void createTitleContents(Composite contents, int style) {
contents.setLayout(new FillLayout());

checkBox =3D new Composite(contents, SWT.WRAP);

checkBox.setBackgroundImage(checkBoxImage);

text =3D new Text(contents, SWT.BORDER | SWT.WRAP);

browseDomain =3D new Composite(contents, SWT.WRAP);

browseDomain.setBackgroundImage(browseDomainImage);

}

But nothing is displayed and the UI is scrwed up!

How should I create my custom cell ?

I also need to display a dialog box as the user clicks the button. Is =
it possible to handle button selection within this cell ?

TIA

Kaniska

------=_NextPart_000_00CC_01C70104.5E2330D0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2668" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I want to display a check box, read =
only text and a=20
button in a single cell of CTableTreeItem.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I created a custom cell having the =
following=20
createTitleContents() ...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>protected void=20
createTitleContents(Composite contents, int style) {</FONT></DIV>
<P align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2>contents.setLayout(new=20
FillLayout());</FONT></P>
<P align=3Dleft><FONT face=3DArial color=3D#0000ff size=3D2>checkBox =3D =
new=20
Composite(contents, SWT.WRAP);</FONT></P>
<P align=3Dleft><FONT face=3DArial color=3D#0000ff=20
size=3D2>checkBox.setBackgroundImage(checkBoxImage);</FONT ></P>
<P align=3Dleft><FONT face=3DArial color=3D#0000ff size=3D2>text =3D new =
Text(contents,=20
SWT.BORDER | SWT.WRAP);</FONT></P>
<P align=3Dleft><FONT face=3DArial color=3D#0000ff size=3D2>browseDomain =
=3D new=20
Composite(contents, SWT.WRAP);</FONT></P>
<P align=3Dleft><FONT face=3DArial color=3D#0000ff=20
size=3D2>browseDomain.setBackgroundImage(browseDomainImage); </FONT></P>
<P><FONT face=3DArial color=3D#0000ff size=3D2>}</FONT></P>
<P><FONT face=3DArial size=3D2>But nothing is displayed and the UI is =
scrwed=20
up!</FONT></P>
<P><FONT face=3DArial size=3D2>How should I create my custom cell =
?</FONT></P>
<P><FONT face=3DArial size=3D2>I&nbsp;also need to display a dialog box =
as the user=20
clicks the button.&nbsp; Is it possible to handle button selection =
within this=20
cell ?</FONT></P>
<P><FONT face=3DArial size=3D2>TIA</FONT></P>
<P><FONT face=3DArial size=3D2>Kaniska</FONT></P></BODY></HTML>

------=_NextPart_000_00CC_01C70104.5E2330D0--
Re: Need help for creating custim cell [message #16242 is a reply to message #16225] Sun, 05 November 2006 13:45 Go to previous messageGo to next message
Cal is currently offline CalFriend
Messages: 70
Registered: July 2009
Member
Hi

>But nothing is displayed and the UI is scrwed up!
>How should I create my custom cell ?
There's a property of FillLayout that tells the composite to fill
horizontally or vertically, it may be trying to fill horizontally...or try
maybe a GridLayout with numColumns=1 and each control has
gridData.grabExcessHorizontal=true

>I also need to display a dialog box as the user clicks the button. Is it
>possible to handle button selection within this cell ?
add a selectionListener to the button, in the widgetSelected() method put
the code to open the dialog

Cal
Re: Need help for creating custim cell:correction [message #16256 is a reply to message #16242] Sun, 05 November 2006 14:07 Go to previous messageGo to next message
Cal is currently offline CalFriend
Messages: 70
Registered: July 2009
Member
Hi

Just thought that you might *want* the controls to display horizontally
aligned..
I'm a newcomer myself so grain of salt..I'm not sure how to get the effect
you want with FillLayout, but with another layout like FormLayout you can
specify distance between controls and have controls grab excess space...

In code below the "top" of the comboProjectName control is 2pxls away from
the labelProjectName control, 10pxls away from the "left" of the composite
and 10pxls away from the "right" of the composite.

composite.setLayout(new FormLayout());
....
//PROJECT LIST COMBO
comboProjectName = new Combo(composite,SWT.DROP_DOWN);

formData = new FormData();
formData.top = new FormAttachment(labelProjectName, 2);
formData.left = new FormAttachment(0, 10);
formData.right = new FormAttachment(100, -10);
comboProjectName.setLayoutData(formData);
.....
.....
Re: Need help for creating custim cell [message #16282 is a reply to message #16225] Sun, 05 November 2006 14:30 Go to previous message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 181
Registered: July 2009
Senior Member
Hi Kaniska,

Just to make sure, is the SWT.TITLE style bit being set in the
constructor of the cell?

something like this:
public MyCell(CContainerItem item, int style) {
super(item, style | SWT.TITLE);
}

also, could you also expand a little on "the UI is screwed up" :)

cheers

Kaniska wrote:
> Hi,
>
> I want to display a check box, read only text and a button in a single
> cell of CTableTreeItem.
> I created a custom cell having the following createTitleContents() ...
>
> protected void createTitleContents(Composite contents, int style) {
>
> contents.setLayout(new FillLayout());
>
> checkBox = new Composite(contents, SWT.WRAP);
>
> checkBox.setBackgroundImage(checkBoxImage);
>
> text = new Text(contents, SWT.BORDER | SWT.WRAP);
>
> browseDomain = new Composite(contents, SWT.WRAP);
>
> browseDomain.setBackgroundImage(browseDomainImage);
>
> }
>
> But nothing is displayed and the UI is scrwed up!
>
> How should I create my custom cell ?
>
> I also need to display a dialog box as the user clicks the button. Is
> it possible to handle button selection within this cell ?
>
> TIA
>
> Kaniska
>
Re: Need help for creating custim cell [message #568038 is a reply to message #16225] Sun, 05 November 2006 13:45 Go to previous message
Cal is currently offline CalFriend
Messages: 70
Registered: July 2009
Member
Hi

>But nothing is displayed and the UI is scrwed up!
>How should I create my custom cell ?
There's a property of FillLayout that tells the composite to fill
horizontally or vertically, it may be trying to fill horizontally...or try
maybe a GridLayout with numColumns=1 and each control has
gridData.grabExcessHorizontal=true

>I also need to display a dialog box as the user clicks the button. Is it
>possible to handle button selection within this cell ?
add a selectionListener to the button, in the widgetSelected() method put
the code to open the dialog

Cal
Re: Need help for creating custim cell:correction [message #568068 is a reply to message #16242] Sun, 05 November 2006 14:07 Go to previous message
Cal is currently offline CalFriend
Messages: 70
Registered: July 2009
Member
Hi

Just thought that you might *want* the controls to display horizontally
aligned..
I'm a newcomer myself so grain of salt..I'm not sure how to get the effect
you want with FillLayout, but with another layout like FormLayout you can
specify distance between controls and have controls grab excess space...

In code below the "top" of the comboProjectName control is 2pxls away from
the labelProjectName control, 10pxls away from the "left" of the composite
and 10pxls away from the "right" of the composite.

composite.setLayout(new FormLayout());
....
//PROJECT LIST COMBO
comboProjectName = new Combo(composite,SWT.DROP_DOWN);

formData = new FormData();
formData.top = new FormAttachment(labelProjectName, 2);
formData.left = new FormAttachment(0, 10);
formData.right = new FormAttachment(100, -10);
comboProjectName.setLayoutData(formData);
.....
.....
Re: Need help for creating custim cell [message #568130 is a reply to message #16225] Sun, 05 November 2006 14:30 Go to previous message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 181
Registered: July 2009
Senior Member
Hi Kaniska,

Just to make sure, is the SWT.TITLE style bit being set in the
constructor of the cell?

something like this:
public MyCell(CContainerItem item, int style) {
super(item, style | SWT.TITLE);
}

also, could you also expand a little on "the UI is screwed up" :)

cheers

Kaniska wrote:
> Hi,
>
> I want to display a check box, read only text and a button in a single
> cell of CTableTreeItem.
> I created a custom cell having the following createTitleContents() ...
>
> protected void createTitleContents(Composite contents, int style) {
>
> contents.setLayout(new FillLayout());
>
> checkBox = new Composite(contents, SWT.WRAP);
>
> checkBox.setBackgroundImage(checkBoxImage);
>
> text = new Text(contents, SWT.BORDER | SWT.WRAP);
>
> browseDomain = new Composite(contents, SWT.WRAP);
>
> browseDomain.setBackgroundImage(browseDomainImage);
>
> }
>
> But nothing is displayed and the UI is scrwed up!
>
> How should I create my custom cell ?
>
> I also need to display a dialog box as the user clicks the button. Is
> it possible to handle button selection within this cell ?
>
> TIA
>
> Kaniska
>
Previous Topic:Need help for creating custim cell
Next Topic:How to use individual widgets
Goto Forum:
  


Current Time: Wed May 08 13:49:36 GMT 2024

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

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

Back to the top