Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Attempting to control checkbox visibility in a tree by node
Attempting to control checkbox visibility in a tree by node [message #438408] Tue, 22 June 2004 22:56 Go to next message
Sean is currently offline SeanFriend
Messages: 20
Registered: July 2009
Junior Member
Hi,

I am trying to create a tree where only certain nodes have checkboxes on a
Windows platform using Eclipse 3.0 M8. According to another post, such a
feat using only the SWT.CHECK is impossible due limitations in Windows
(e.g. TreeItem does not support the SWT.CHECK style; it must be declared
at the Tree level). Thus, I am trying to create a new widget that uses the
Button class (with SWT.CHECK), and using that widget in a TreeView.
Hopefully I can control those individual widgets in displaying the actual
checkbox.

Here are my constraints:
1. checkbox must be able to be hidden for certain nodes in the tree (a
parent may have no checkbox and a child may)
2. need to reuse the TreeView class by extending it (to avoid rewriting it)
3. need to reuse the TreeItem class by extending it (to avoid writing
native code, and to be able to reuse TreeView)

My current approach:
- create new widget that extends TreeItem
- add Button widget as a member variable
- display by using Button.setLocation ( this.getBounds().x,
this.getBounds().y );

My problem:
- the button widget does not seem to be bound to the TreeItem - more like
just the Tree
- since my new widget does not extend composite, I cannot treat it like a
normal custom widget
- multiple inheritance is out (e.g. extends TreeItem, Composite)
- I'm not sure what is the proper way to draw it


I am just wondering if my approach is even feasible, or if there is a
better approach from someone who has attempted this previously. I know
it's going to be a workaround of some sort, but any help or comments would
be greatly appreciated.


Thanks in advance!
Sean
Re: Attempting to control checkbox visibility in a tree by node [message #438424 is a reply to message #438408] Wed, 23 June 2004 23:04 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
You are talking about implementing your own widget and that's a tone of
work. How about doing it differently in your UI (maybe using check Buttons
and a TabFolder)?

"Sean" <carver_dm@hotmail.com> wrote in message
news:cbadfq$t8l$1@eclipse.org...
> Hi,
>
> I am trying to create a tree where only certain nodes have checkboxes on a
> Windows platform using Eclipse 3.0 M8. According to another post, such a
> feat using only the SWT.CHECK is impossible due limitations in Windows
> (e.g. TreeItem does not support the SWT.CHECK style; it must be declared
> at the Tree level). Thus, I am trying to create a new widget that uses the
> Button class (with SWT.CHECK), and using that widget in a TreeView.
> Hopefully I can control those individual widgets in displaying the actual
> checkbox.
>
> Here are my constraints:
> 1. checkbox must be able to be hidden for certain nodes in the tree (a
> parent may have no checkbox and a child may)
> 2. need to reuse the TreeView class by extending it (to avoid rewriting
it)
> 3. need to reuse the TreeItem class by extending it (to avoid writing
> native code, and to be able to reuse TreeView)
>
> My current approach:
> - create new widget that extends TreeItem
> - add Button widget as a member variable
> - display by using Button.setLocation ( this.getBounds().x,
> this.getBounds().y );
>
> My problem:
> - the button widget does not seem to be bound to the TreeItem - more like
> just the Tree
> - since my new widget does not extend composite, I cannot treat it like a
> normal custom widget
> - multiple inheritance is out (e.g. extends TreeItem, Composite)
> - I'm not sure what is the proper way to draw it
>
>
> I am just wondering if my approach is even feasible, or if there is a
> better approach from someone who has attempted this previously. I know
> it's going to be a workaround of some sort, but any help or comments would
> be greatly appreciated.
>
>
> Thanks in advance!
> Sean
>
Re: Attempting to control checkbox visibility in a tree by node [message #438427 is a reply to message #438424] Thu, 24 June 2004 00:15 Go to previous messageGo to next message
Sean is currently offline SeanFriend
Messages: 20
Registered: July 2009
Junior Member
I think I have heard about something like this before, where you use a
tree-table where we can control the checkbox widget in each cell? So in
other words, it would be using a totally different view altogether
(instead of TreeView)?

I'll give it a try - thanks!


Steve Northover wrote:

> You are talking about implementing your own widget and that's a tone of
> work. How about doing it differently in your UI (maybe using check Buttons
> and a TabFolder)?

> "Sean" <carver_dm@hotmail.com> wrote in message
> news:cbadfq$t8l$1@eclipse.org...
> > Hi,
> >
> > I am trying to create a tree where only certain nodes have checkboxes on a
> > Windows platform using Eclipse 3.0 M8. According to another post, such a
> > feat using only the SWT.CHECK is impossible due limitations in Windows
> > (e.g. TreeItem does not support the SWT.CHECK style; it must be declared
> > at the Tree level). Thus, I am trying to create a new widget that uses the
> > Button class (with SWT.CHECK), and using that widget in a TreeView.
> > Hopefully I can control those individual widgets in displaying the actual
> > checkbox.
> >
> > Here are my constraints:
> > 1. checkbox must be able to be hidden for certain nodes in the tree (a
> > parent may have no checkbox and a child may)
> > 2. need to reuse the TreeView class by extending it (to avoid rewriting
> it)
> > 3. need to reuse the TreeItem class by extending it (to avoid writing
> > native code, and to be able to reuse TreeView)
> >
> > My current approach:
> > - create new widget that extends TreeItem
> > - add Button widget as a member variable
> > - display by using Button.setLocation ( this.getBounds().x,
> > this.getBounds().y );
> >
> > My problem:
> > - the button widget does not seem to be bound to the TreeItem - more like
> > just the Tree
> > - since my new widget does not extend composite, I cannot treat it like a
> > normal custom widget
> > - multiple inheritance is out (e.g. extends TreeItem, Composite)
> > - I'm not sure what is the proper way to draw it
> >
> >
> > I am just wondering if my approach is even feasible, or if there is a
> > better approach from someone who has attempted this previously. I know
> > it's going to be a workaround of some sort, but any help or comments would
> > be greatly appreciated.
> >
> >
> > Thanks in advance!
> > Sean
> >
Re: Attempting to control checkbox visibility in a tree by node [message #438447 is a reply to message #438427] Thu, 24 June 2004 13:49 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Or don't use a tree at all. Allow the user to check options from pages in a
tab folder (or some other widget that contains check buttons).

"Sean" <carver_dm@hotmail.com> wrote in message
news:cbd6e7$9a3$1@eclipse.org...
>
> I think I have heard about something like this before, where you use a
> tree-table where we can control the checkbox widget in each cell? So in
> other words, it would be using a totally different view altogether
> (instead of TreeView)?
>
> I'll give it a try - thanks!
>
>
> Steve Northover wrote:
>
> > You are talking about implementing your own widget and that's a tone of
> > work. How about doing it differently in your UI (maybe using check
Buttons
> > and a TabFolder)?
>
> > "Sean" <carver_dm@hotmail.com> wrote in message
> > news:cbadfq$t8l$1@eclipse.org...
> > > Hi,
> > >
> > > I am trying to create a tree where only certain nodes have checkboxes
on a
> > > Windows platform using Eclipse 3.0 M8. According to another post, such
a
> > > feat using only the SWT.CHECK is impossible due limitations in Windows
> > > (e.g. TreeItem does not support the SWT.CHECK style; it must be
declared
> > > at the Tree level). Thus, I am trying to create a new widget that uses
the
> > > Button class (with SWT.CHECK), and using that widget in a TreeView.
> > > Hopefully I can control those individual widgets in displaying the
actual
> > > checkbox.
> > >
> > > Here are my constraints:
> > > 1. checkbox must be able to be hidden for certain nodes in the tree (a
> > > parent may have no checkbox and a child may)
> > > 2. need to reuse the TreeView class by extending it (to avoid
rewriting
> > it)
> > > 3. need to reuse the TreeItem class by extending it (to avoid writing
> > > native code, and to be able to reuse TreeView)
> > >
> > > My current approach:
> > > - create new widget that extends TreeItem
> > > - add Button widget as a member variable
> > > - display by using Button.setLocation ( this.getBounds().x,
> > > this.getBounds().y );
> > >
> > > My problem:
> > > - the button widget does not seem to be bound to the TreeItem - more
like
> > > just the Tree
> > > - since my new widget does not extend composite, I cannot treat it
like a
> > > normal custom widget
> > > - multiple inheritance is out (e.g. extends TreeItem, Composite)
> > > - I'm not sure what is the proper way to draw it
> > >
> > >
> > > I am just wondering if my approach is even feasible, or if there is a
> > > better approach from someone who has attempted this previously. I know
> > > it's going to be a workaround of some sort, but any help or comments
would
> > > be greatly appreciated.
> > >
> > >
> > > Thanks in advance!
> > > Sean
> > >
>
>
Previous Topic:ContextMenu on TabbedView ?!
Next Topic:printer buffer out of memory?
Goto Forum:
  


Current Time: Thu Apr 25 13:40:20 GMT 2024

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

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

Back to the top