Solved

Insert first leaf to an existing tree via stingray

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

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…
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 …
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 brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

728 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