Solved

Insert first leaf to an existing tree via stingray

Posted on 2002-04-24
7
250 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
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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how do i create updater to My Activex application? 3 79
Complete beginner needs help making a cron job 9 110
Path of Workbook 3 61
JQuery serialize and unserialize 8 52
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

26 Experts available now in Live!

Get 1:1 Help Now