1. wxEuphoria: delete_tree_item() Not Working

Modify the demo "tree_list_demo.exw" by adding this as the last line of procedure "setup":

delete_tree_item( tree, {} ) 

When you run the program, there should be an empty tree, but it doesn't clear the list. Shouldn't it?

It's possible I have conflicting DLLs or otherwise faulty setup, but I need confirmation that it's working when everything is set up properly.

Thank you!

EDIT: wxEuphoria_Version is 0.17.0.

new topic     » topic index » view message » categorize

2. Re: wxEuphoria: delete_tree_item() Not Working

I think the documentation for delete_tree_item() is wrong. Here is the code for that function.

void WXEUAPI  delete_tree_item(intptr_t tree, object item) 
{ 
 
	//void Delete(const wxTreeItemId& item) 
	if( IS_SEQUENCE(item) ){ 
		int len = LENGTH( item ); 
		for( int i = 1; i <= len; i++) 
			((wxTreeCtrl *)tree)->Delete( wxTreeItemId( (void *) get_int( item, i ))); 
	} 
	else{ 
		((wxTreeCtrl *)tree)->Delete( wxTreeItemId( (void *) get_int( item ))); 
	} 
	wxDeRef( item ); 
} 

If item is a sequence, it will loop through that sequence deleting the items contained within. If item is not a sequence (i.e. an atom) then it will delete that one item.

If you want to clear a wxTreeCtrl, just delete the root item.

atom root = get_tree_root( tree ) 
delete_tree_item( tree, root )  

-Greg

new topic     » goto parent     » topic index » view message » categorize

3. Re: wxEuphoria: delete_tree_item() Not Working

ghaberek said...

If you want to clear a wxTreeCtrl, just delete the root item.

atom root = get_tree_root( tree ) 
delete_tree_item( tree, root )  

Thanks for the heads-up, Greg. I swear the code I had was working before to clear the tree. Weird!

Your suggestion seems to work for me now. Thank you!

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu