October 29, 2025, 06:57:04 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Treeview control parent items

Started by LarryMc, August 01, 2009, 11:37:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

How can I determine if a selected item has a parent.

I know I can test if a particular selected item has children but I haven't found a test to determine if it is a child.

Another way to say it is how can I determine at what nesting level a selected treeview item reside?

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Turns out it is real simple once you stumble upon the correct portion of the MS documentation.

CONST TV_FIRST = &H1100
CONST TVM_GETNEXTITEM = (TV_FIRST + 10)
CONST TVGN_PARENT = &H3
'tvhand is handle to currently selected node
uint ih=SendMessage(mywin,TVM_GETNEXTITEM,TVGN_PARENT,tvhand ,mytree)

'ih will contain the handle to the parent of the selected item or 0 if there is no parent


Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ZeroDog


LarryMc

I was lucky this time.

Most of the time I'm ticked off and not speaking to myself!

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library