Preventing editing item labels in tree view

This article was contributed by Marius Bakelis.

If we have created tree view control with the TVS_EDITLABELS style we can edit all its items labels. But sometimes we do need that not all tree view control items labels could be editable. So we must prevent editing of item labels we don't want to be editable. We can override the PreTranslateMessage() function:

BOOL CTreeCtrlX::PreTranslateMessage(MSG* pMsg) 
    if( pMsg->message == WM_LBUTTONDOWN )
		CPoint		pt = pMsg->pt;

		if( HitTest( pt, &flag ) == GetSelectedItem() 
			// && there you can check is the item which cannot be editable
			SetFocus();	//We must set focus to the tree view control
					//becouse it can have no focus

			return TRUE ;   // DO NOT process further

    return CTreeCtrl::PreTranslateMessage(pMsg);


  • What To Do About nike Before Time Expires

    Posted by Dethysheree on 03/11/2013 07:16pm

    SobRcjIeoJvj [url=]nike[/url] TroPofPnbHbb [url=]ナイキシューズ[/url] PytSnzDkwZdf [url=]nike[/url] MboLibNupJjq [url=]ナイキシューズ[/url] QjaKuuZcgBcb [url=]nike シューズ[/url] MiaFnvIioBut [url=]ナイキスニーカー[/url] DsvNmyDzwWuh [url=]スニーカーナイキ[/url] MmtEdpBarNkz [url=]スニーカー nike[/url] OovEzkVpnEab [url=]スニーカー nike[/url] PfoJaqErqUlg NlcCqlUqkOsz [url=]nike id[/url] HqeIqhSqeRmi [url=]nike エア[/url] DpuEaoFgaAub [url=]ナイキ[/url] DiqPnjGwuEud [url=]ナイキ[/url] ItqWxqGkpBjj [url=]nike air[/url] FkhHmiJfyXss [url=]スニーカーナイキ[/url] YluYrpRuwWec [url=]ナイキ air[/url] UrjUqtDruFfn [url=]ナイキ air[/url] IaoFfcEniTeb [url=]ナイキスニーカー[/url] YapXmvWwkBpk NloXroYkcRcl [url=]nike id[/url]YvlKcsYvmIld [url=]ナイキランニング[/url]VuqWlnGrsQug [url=]nike ランニング[/url]EybUklWzqEzj [url=]ナイキゴルフ[/url]BtxOqnNakOvw [url=]nike sb[/url]HowWgsNqsNey [url=]free nike[/url] BfyDbvNdzNvb [url=]nike sb[/url] PryEscMzbPzo [url=]nike sb[/url]SfzSjgXdeKtb

  • Preventing editing item labels in tree view

    Posted by Legacy on 08/05/1999 12:00am

    Originally posted by: Chris Grieve

    This was a great help but it has a tiny buggette in the way that HitTest is used which stops you D&D ing something by the icon that is already selected. This is the correction;

    As before except;

    UINT flag = 0;

    if( ( ( tree.HitTest( pt, &flag ) == tree.GetSelectedItem()
    &&( flag & TVHT_ONITEMLABEL ) ) // new bit
    && ( FALSE ) ) // your check in here

    But I wouldn't have got this far without the original code(!)



  • Why not handle TVN_BEGINLABELEDIT notification?

    Posted by Legacy on 01/16/1999 12:00am

    Originally posted by: Peter Schregle

    A more straightforward way to inhibit label editing would be to handle the TVM_BEGINLABELEDIT notification. Return FALSE to allow and TRUE to cancel label editing.

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • The open source cloud computing project OpenStack has come a long way since NASA and Rackspace launched it in 2010. Backed by leading technology infrastructure providers including Cisco, Dell, EMC, HP, IBM, Intel, and VMware, OpenStack underpins significant workloads at an increasingly diverse set of organizations, including BWM, CERN, Comcast, eBay, and Wal-Mart. For CIOs engaged in broader programs to win, serve, and retain customers -- and refocus business technology (BT) spend -- a planned and pragmatic …

  • Today's enterprise datacenter can be one of the most complex business environments with dozens (for smaller business), hundreds (for larger and midsize business), even thousands (for hyperscale businesses) of servers that must be managed and monitored. At this level, just managing the cords can be challenging — let alone keeping up with the growing need for more agility and scalability within the datacenter. Simply put, companies are aggressively looking for less complexity and more agility from their …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date