Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Insert first leaf to an existing tree via stingray

Posted on 2002-04-24
7
Medium Priority
?
261 Views
Last Modified: 2013-11-20
Hi all,
I want to insert new item into SECTreeCtrl. The tree is not empty already, and  new item must be first in the tree.
Does anybody know the answer ?
10x, RanBN
0
Comment
Question by:RanBN
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 16

Expert Comment

by:AlexNek
ID: 6965760
By Sampe:
static HTREEITEM InsertTreeItem(SECTreeCtrl* ctrl,LPCTSTR txt,int imgind,int selimgind)
{
     TV_INSERTSTRUCT  TreeCtrlItem;      

     TreeCtrlItem.hParent = TVI_ROOT;
     TreeCtrlItem.hInsertAfter = TVI_LAST; //HERE
     TreeCtrlItem.item.mask = TVIF_IMAGE | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_TEXT;

     TreeCtrlItem.item.iImage = imgind;
     TreeCtrlItem.item.iSelectedImage = selimgind;
     TreeCtrlItem.item.lParam = 0;
     TreeCtrlItem.item.pszText = (LPTSTR)txt;
     
     HTREEITEM hTreeItem = ctrl->InsertItem(&TreeCtrlItem);
     return(hTreeItem);
}

try to use TVI_FIRST not TVI_LAST
0
 

Author Comment

by:RanBN
ID: 6966042
10x AlexNek,
I need to insert the leaf as the FIRST in the tree. your comment put it as the LAST one.
any other suggestion?
10x again, RanBN
0
 
LVL 16

Accepted Solution

by:
AlexNek earned 200 total points
ID: 6967108
Did you tried this one?
TreeCtrlItem.hInsertAfter = TVI_FIRST;
0
 
LVL 6

Expert Comment

by:snoegler
ID: 6967184
Are you using Objective Toolkit (SECTreeCtrl)?
0
 

Author Comment

by:RanBN
ID: 6974597
Yep,
I use Objective Toolkit,
I solved the problem in an ugly way. I got parent and checked if it wasn't leaf, i gave an exceptional threatment.
10x all for trying
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question