🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
2 messages
2 total messages Started by John Dawson Thu, 12 Nov 1992 17:19
Transorming leaf to nonleaf & expand with one mouse click in NXBrowser
#1578
Author: John Dawson
Date: Thu, 12 Nov 1992 17:19
23 lines
1622 bytes
HeaderViewer has a neat UI for flattening parts of its browser tree;
you can control-click on nodes with a tree of subnodes underneath, and
get a flattened version of the tree displayed there.  Very slick;
HeaderViewer is a shining gem of user interface design, IMHO.

But what I want to do in my app is control click on nodes which can be
LEAF nodes, and expand them.  See, each node in my tree has an array
associated with it, and I want to display the contents of the array
underneath the node in the browser.  If I control-click on the node, I
can have my browser:fillMatrix:inColumn: method change the node from
leaf to nonleaf, if necessary, but it's too late then; the NXBrowser
has already gotten the click and interpreted it as a click on a leaf
node.  I can't expand the node in the browser until the next mouse
click.

What I'd like would be a method like "performClickOnSelectedCell" that
I could send to the NXBrowser, or better yet, "expandSelectedCell".
Nothing resembling these facilities seem to be present.  Anybody have
ideas on how to fake it?

Thanks in advance.
-- 
jdawson@ccwf.cc.utexas.edu (John Dawson)
Re: Transorming leaf to nonleaf & expand with one mouse click in NXBrowser
#1772
Author: Brian Willoughby
Date: Mon, 16 Nov 1992 01:07
64 lines
3675 bytes
John Dawson writes
| [...]
| But what I want to do in my app is control click on nodes which can be
| LEAF nodes, and expand them.  See, each node in my tree has an array
| associated with it, and I want to display the contents of the array
| underneath the node in the browser.  If I control-click on the node, I
| can have my browser:fillMatrix:inColumn: method change the node from
| leaf to nonleaf, if necessary, but it's too late then; the NXBrowser
| has already gotten the click and interpreted it as a click on a leaf
| node.  I can't expand the node in the browser until the next mouse
| click.
| 
| What I'd like would be a method like "performClickOnSelectedCell" that
| I could send to the NXBrowser, or better yet, "expandSelectedCell".
| Nothing resembling these facilities seem to be present.  Anybody have
| ideas on how to fake it?

I use -addColumn to accomplish this in my program.  See the NXBrowser Class  
Description, paragraph two.

In my case, the program supports editor/inspectors of multiple items at  
different levels in the browser simultaneously.  In the case where editing the  
cell changes it from a leaf to a parent node, my -updateBrowser routine checks  
to see if this node is in the last displayed column, and if this is true a new  
column is added (which is automatically filled by NXBrowser when it calls its  
delegate).  Here is the relevant excerpt:

- updateBrowser
{
	int	i,
		selected = [theBrowser selectedColumn],
		last = [theBrowser lastColumn];
	id	cell;

	[windowMusic disableFlushWindow];
	// reload all columns since the location of the edited cell is unknown
	for (i = 0; i <= last; i++)
		[theBrowser reloadColumn:i];
	// add a column if the selectedCell has become a branch
	if (cell = [[theBrowser matrixInColumn:selected] selectedCell])
		if (![cell isLeaf] && selected == last)
			[theBrowser addColumn];
	[[windowMusic reenableFlushWindow] flushWindowIfNeeded];
	return self;
}

Enjoy - I hope this helps...

P.S.  I just noticed that the 3.0 docs have changed the wording a bit for  
-addColumn.  In 2.1, the wording implied to me that your code did not "need" to  
call this method because it was done for you.  In 3.0, the wording has been  
changed to "your code should never invoke this method".  Sounds somewhat  
alarming to me, but I can say that my code has worked fine running under 3.0,  
both as a 2.1 binary and recompiled as a 3.0 binary.  My hunch is that the key  
is how I specifically -reloadColumn: the column which contains the node which  
has just lost its leaf status before trying to -addColumn, avoiding possible  
inconsistancies with any cached information in the NXBrowser instance.   
However, I haven't proven this hunch by testing the converse, since I just  
noticed the change in wording while investigating my response to this post (so  
thanks for the incite to insight).
-- 
Brian Willoughby	Software Design Engineer, BSEE NCSU
BrianW@SoundS.WA.com	Sound Consulting and Signal Processing Software
NeXTmail welcome	- NO EMAIL SOLICITATION without prior permission
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads