Solved

Insert first leaf to an existing tree via stingray

Posted on 2002-04-24
7
246 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
  • 2
  • 2
7 Comments
 
LVL 16

Expert Comment

by:AlexNek
Comment Utility
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
Comment Utility
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 50 total points
Comment Utility
Did you tried this one?
TreeCtrlItem.hInsertAfter = TVI_FIRST;
0
 
LVL 6

Expert Comment

by:snoegler
Comment Utility
Are you using Objective Toolkit (SECTreeCtrl)?
0
 

Author Comment

by:RanBN
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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 this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now