Solved

Insert first leaf to an existing tree via stingray

Posted on 2002-04-24
7
258 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
Pressing cancel button with C# UI Automation 3 101
VBA "SendKeys" Syntax for Multiple Keystrokes 7 133
Line meaning 9 96
Capture logon name 13 119
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…
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.
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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