Tree

Using (or providing) components based on the "Win32" framework

Tree

Postby MikeBa on Fri Mar 15, 2013 3:57 pm

I know the world is moving on from the Windows GUI, but for me it is sometimes quite useful. One object that I rather like is TreeView, but I have struggled with methods 'GetItemState' and 'SetItemState'. Using 'GetItemState' by trial and error, I eventually managed to work out what the states mean, and then I found the following in the 12.1 documentation.

The result indicates the state of the item as the sum of one or more of the following
codes:
1 Item has the focus
2 Item is selected
8 Item is highlighted for dropping
16 Item is displayed in bold text
32 Item is expanded
64 Item is or has been expanded
4096 Item is checked (see CheckBoxes)

These states seem to have gone walkabout in version 13 documentation!!

Knowing that SetItemState only works on one item at a time, I found the following works just fine.

+2 ⎕NQ'Family.Tree' 'SetItemState' 6 4096

However, when I try to set multiple states I cannot devise a remotely efficient or elegant expression. My only working expression is so bad I'd be too ashamed to post it here.

Could someone perhaps provide a couple of examples (maybe one using namespaces and one without) to set this rusty old APLer in the right direction.
MikeBa
 
Posts: 27
Joined: Thu Mar 14, 2013 11:40 am

Re: Tree

Postby Vince|Dyalog on Mon Mar 18, 2013 4:09 pm

Hi Mike,

The state codes were last seen in our version 13.0 manuals. Another customer has also recently noticed this omission in our newer manuals. I’ve logged an issue for our documentation team to look into this.

You could try using D-fns, and writing code like this (where F.TV is my treeview object):
      {2 ⎕NQ'F.TV' 'SetItemState'⍵ 4096}¨⍳⍴F.TV.Items

Regards,

Vince
Vince|Dyalog
 
Posts: 412
Joined: Wed Oct 01, 2008 9:39 am

Re: Tree

Postby MikeBa on Mon Mar 18, 2013 7:49 pm

Thanks Vince, works a treat. I had tried something similar which failed, too many gaps in my knowledge of modern APL!

Regards,
Mike
MikeBa
 
Posts: 27
Joined: Thu Mar 14, 2013 11:40 am


Return to Windows: GUI, COM/OLE/ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest