Tree Control

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Tree Control

Sebastián
Hi all,

    for a project we concluded to use a control that I'll try to describe:

    it is like the typical system tree that you have in your windows
explorer plus a trhee-state checkbox at the left of the folder icon. So the
user can select path or several diferent paths and/or drives.

    I didn't see anything like that in dolphin's standards.

    Any clue?

    If I have to use an OCX, do you know wich one?
    can be distributed as part of an app?

best regards

Seb


Reply | Threaded
Open this post in threaded view
|

Re: Tree Control

Keith Alcock-3
In addition to the control described below, I would be interested in a
tree view in which there could be three different symbols in the box
to the left of the text (where normally there are only + and -).  
Windows Explorer will put a + sign next to a diskette drive even when
there is no diskette inserted.  The + sign implies that there are
subdirectories, but Windows doesn't really know that.  Something like a
question mark would be more appropriate.  If anyone can come up with a
three-state tree view, please let me know.

Keith



Smalltalkiano wrote:

>
> Hi all,
>
>     for a project we concluded to use a control that I'll try to describe:
>
>     it is like the typical system tree that you have in your windows
> explorer plus a trhee-state checkbox at the left of the folder icon. So the
> user can select path or several diferent paths and/or drives.
>
>     I didn't see anything like that in dolphin's standards.
>
>     Any clue?
>
>     If I have to use an OCX, do you know wich one?
>     can be distributed as part of an app?
>
> best regards
>
> Seb


Reply | Threaded
Open this post in threaded view
|

Re: Tree Control

Udo Schneider
In reply to this post by Sebastián
"Smalltalkiano" <[hidden email]> schrieb im Newsbeitrag
news:a92omd$104hec$[hidden email]...
>     it is like the typical system tree that you have in your windows
> explorer plus a trhee-state checkbox at the left of the folder icon. So
the
> user can select path or several diferent paths and/or drives.
>
>     I didn't see anything like that in dolphin's standards.

Maybe the #hasCheckBoxes Property of the TreePresenter satisfies you needs?


Udo


Reply | Threaded
Open this post in threaded view
|

Re: Tree Control

Don Rylander-3
I think the #hasCheckBoxes property will do exactly what Smalltalkiano wants,
but using those is a bit of a pain.  They are not exposed in the way you'd
like, they're really tightly coupled into the view.  I've got some code
somewhere that made using the checkboxes less obnoxious, but I don't recall
whether I really got it to work properly.  I'll check on that as soon as I'm
done rebooting ;-).

Don

"Udo Schneider" <[hidden email]> wrote in message
news:a93fp1$10l1nk$[hidden email]...

>
> "Smalltalkiano" <[hidden email]> schrieb im Newsbeitrag
> news:a92omd$104hec$[hidden email]...
> >     it is like the typical system tree that you have in your windows
> > explorer plus a trhee-state checkbox at the left of the folder icon. So
> the
> > user can select path or several diferent paths and/or drives.
> >
> >     I didn't see anything like that in dolphin's standards.
>
> Maybe the #hasCheckBoxes Property of the TreePresenter satisfies you needs?
>
>
> Udo
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Tree Control

Don Rylander-3
OK, below is the package (just save it as "(TreeView mods).pac"--sorry about
the parentheses; just use them so all my packages sort to the top ;-).
Absolutely no guarantees (just like an MS license), of course, but hopefully it
will save you some time in figuring out what to do and how to do it.

Don
=============================================
| package |
package := Package name: '(TreeView mods)'.
package paxVersion: 0;
 basicComment: ''.

package basicPackageVersion: ''.

"Add the package scripts"

"Add the class names, loose method names, global names, resource names"
package classNames
 yourself.

package methodNames
 add: #TreeView -> #beChecked:;
 add: #TreeView -> #beUnChecked:;
 add: #TreeView -> #isItemChecked:;
 add: #TreeView -> #setCheckedStateOf:to:;
 yourself.

package globalNames
 yourself.

package resourceNames
 yourself.

"Binary Global Names"
package binaryGlobalNames: (Set new
 yourself).
"Resource Names"
package allResourceNames: (Set new
 yourself).

"Add the prerequisite names"
package setPrerequisites: (IdentitySet new
 add: 'Dolphin';
 yourself).

package!

"Class Definitions"!

"Loose Methods"!

!TreeView methodsFor!

beChecked: anObject

 #drAdded.
 self setCheckedStateOf: anObject to: true!

beUnChecked: anObject

 #drAdded.
 self setCheckedStateOf: anObject to: false!

isItemChecked: anObject
 "This is lifted pretty much directly from the MSDN article entitled
''Tree-View Controls,''
 last seen (8 August, 2001) at this URL:


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platfo
rm/CommCtls/TreeView/TreeView.asp

 The only difference is that getting the item's state happens with #dwState,
rather than
 #state.  Any other problems there might be with it are their fault, not mine.

 NB: For now, assume that the object should be in the model, and that its
absence is an error."

 |hItem tvItem|
 #drAdded.
 self hasCheckBoxes ifFalse: [^false].
 hItem := self handleFromObject: anObject ifAbsent: [self errorNotFound:
anObject].
 (tvItem := TVITEM new)
  hItem: hItem;
  mask: (TVIF_HANDLE | TVIF_STATE);
  stateMask: TVIS_STATEIMAGEMASK.
 self tvmGetItem: tvItem.
 ^((tvItem dwState >> 12) - 1) asBoolean
!

setCheckedStateOf: anObject to: aBoolean
 "This is lifted pretty much directly from the MSDN article entitled
''Tree-View Controls,''
 last seen (8 August, 2001) at this URL:


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platfo
rm/CommCtls/TreeView/TreeView.asp

 The only difference is that getting (and setting) the item's state happens
with #dwState(:),
 rather than #state(:).  Any other problems there might be with it are their
fault, not mine.

 NB: We assume that the object should be in the model, and that its absence is
an error."

 |hItem tvItem newState|
 #drAdded.
 self hasCheckBoxes ifFalse: [^self].
 hItem := self handleFromObject: anObject ifAbsent: [^self errorNotFound:
anObject].
 (tvItem := TVITEM new)
  hItem: hItem;
  mask: (TVIF_HANDLE | TVIF_STATE);
  stateMask: TVIS_STATEIMAGEMASK.
 self tvmGetItem: tvItem.
 newState := (aBoolean asDword + 1) << 12.
 tvItem dwState: newState.
 self tvmSetItem: tvItem.! !
!TreeView categoriesFor: #beChecked:!accessing!public! !
!TreeView categoriesFor: #beUnChecked:!accessing!public! !
!TreeView categoriesFor: #isItemChecked:!accessing!public! !
!TreeView categoriesFor: #setCheckedStateOf:to:!accessing!public! !

"End of package definition"!


"Binary Globals"!

"Resources"!


Reply | Threaded
Open this post in threaded view
|

Re: Tree Control

Smalltalkiano-2
Thanks for that Don,

        I'll be experimenting

        regards

Seb