inapathtolearn
inapathtolearn

Reputation: 75

Making a TcxTreeList column visible or invisible in c++ builder during run time to implement a search and find functionality

Is it possible to hide/unhide columns of a TcxTreeList ? I am using C++ Builder 6. I am doing a search in one column of a TcxTreeList and adding the matched items to another column. Once its done, I want to hide the first column and display the second column.

void TForm::RefreshTree()
{

   Grid->Clear();
   RefreshGrid(); //loads the tree 

   String colpropname = "";
   String searchmethod = EdtSearch->Text;



   for (TcxTreeListNode* node = Grid->TopNode; node != NULL ; node = node->GetNext())
   {
      if (!node->Values[colpropname ->ItemIndex].IsNull())
         colpropname =  node->Values[ColPropName->ItemIndex] ;
         colpropname = ConvertToOnlyCharacters(colpropname );

      if(colpropname .Pos(searchmethod) >0 || EdtSearch->Text.IsEmpty())  // if the item contains the keyword
      {

         node->Values[ColGridMatch->ItemIndex] = node->Values[ColPropName->ItemIndex];

      }
   }
}

This is my broken code. Has anyone tried search functionality in a TcxTreeList ? Is it possible to hide/unhide the columns? I have these approached in my mind to implement the search function. Can some one please tell me are these feasible? .

**a.When the word matches (partially/completely) any of the item in the TreeList, those nodes should be made visible and the remaining ones invisible.

b. When the word matches (partially/completely) any of the item in the TreeList, those items should be moved to another column (in the same treelist) and display the 2nd column in the treelist and hide the first one.

c. The items which doesn't match the word should be deleted( delete the node), and then added back later on clearing teh Edit field.**

Are these approaches feasible with TcxTreeList. Please feel free to chip in if you have any better suggetsion on how to implement this search functionality. Thanks

UPDATE: Based on the replies from DevExpress Team in the DevExpress Forum, the visibility function of a column can be adjusted by changing the values of 'Width' and 'MinWidth' properties of the column (since setting IsVisible == true, is not working). But still, there is an issue of column overlapping. Looks like the TreeList which I am using(v4.9) doesn't support much of the functionality. Hope this info helps someone!

Upvotes: 0

Views: 281

Answers (0)

Related Questions