Print Page | Close Window

How to deselect items in tree control

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=22185
Printed Date: 21 November 2024 at 7:05pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to deselect items in tree control
Posted By: Norbini
Subject: How to deselect items in tree control
Date Posted: 30 January 2014 at 11:39am
Hi,

  I've seen that I can select items in a multi-select tree control using SelectItem() or SelectItems(), but what is the correct way to deselect items?

  I guess it is possible to do (in pseudocode):
    CTypedPtrList<CPtrList, HTREEITEM> CurrentSelection;
    GetSelectedItems(CurrentSelection);   // Get the list of currently selected items
    SelectAll(FALSE, NULL); // Deselect all items
    for (PreviouslySelectedItem in CurrentSelection) {
        if (PreviouslySelectedItem != ItemToDeselect) {
            SelectItem(PreviouslySelectedItem); // Select all previously selected items except the item to deselect
        }
    }

  However, I suspect this will generate a large number of TVN_SELCHANGED messages and probably make the selection flicker.

  Is there a better way that I'm missing or would this approach be ok?

  Many thanks in advance,
    -Nige



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net