Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Moving to Tinderbox 6 >> Alternative to drag between windows in Outline?
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1431713289

Message started by Lucas D on May 15th, 2015, 2:08pm

Title: Alternative to drag between windows in Outline?
Post by Lucas D on May 15th, 2015, 2:08pm

I understand from what I've read here that in in version 6 and above, it isn't possible to drag items between different windows in the way one could in in previous versions. So I'm wondering what the best alternative would be for when I want to move a group of notes from one part of an outline in one window to a very different part of the outline in another window. Should I manually change the parent note? Or just cut and paste? (I should note that I do need to preserve the original note creation timestamps.) There's probably some obvious way to do this --- I just always relied on drag-and-drop in the past, and now I'm drawing a blank. Thanks for any help!

Title: Re: Alternative to drag between windows in Outline?
Post by Mark Bernstein on May 15th, 2015, 5:31pm

Cut and paste is your friend.

Is there some reason you can't open a tab with the whole outline, expand the source and destination sections, and move the notes there?

Title: Re: Alternative to drag between windows in Outline?
Post by Lucas D on May 16th, 2015, 3:08pm

Great, thanks. I guess I was nervous about the the "cut" part of cut-and-past, but it works just fine. (Indeed, much of the time it works to just drag within a single window, but sometimes with complex outlines it's handy to work with multiple windows that are focused on different parts of the outline, and cut-and-past can come in handy.)

Title: Re: Alternative to drag between windows in Outline?
Post by J Fallows on May 16th, 2015, 3:44pm


Quote:
I guess I was nervous about the the "cut" part of cut-and-past, but it works just fine.

Here is the only obvious-once-you-think-about-it potential pitfall with cut-and-paste. If you're moving things from one container (or, section of an outline) to another, and if that new container has some On-Add Action that you've forgotten about, the results could be different from what you're anticipating. Don't ask me how I know this.

Also, if you're worried about the "cut" part (as I often am for atavistic reasons, despite Undo and so on) you can always do copy-and-paste, rather than cut-and-paste, and then go back and delete the originals once everything is safe and sound.

Title: Re: Alternative to drag between windows in Outline?
Post by Lucas D on May 16th, 2015, 11:06pm

@J Fallows, thanks for those helpful tips!

Title: Re: Alternative to drag between windows in Outline?
Post by Scott Heftler on Apr 7th, 2016, 9:17pm

Hello all.  I just today made the switch to TB6.  The new iMindMap-like broad style link arrows looked so attractive that I actually upgraded to El Capitan just so I could run 6.5 and admire them.  (I was also hoping that running under the latest OS would also help TB6 preserve window sizes and positions, which was the reason I'd stayed with TB5 for so long.  Alas, this is not the case.)

The first thing I noticed was the demise of between-window dragging.  

Using cut and paste as an alternative works great.  Unless the note you're moving is an original that has aliases.  In that case, cutting the note will kill all aliases.

I'm guessing that the only workaround is to switch to Outline View, unhoist until the destination container is visible, and then drag the original it to the destination container.  Is this correct?

Title: Re: Alternative to drag between windows in Outline?
Post by Mark Bernstein on Apr 8th, 2016, 10:45am

Window sizes: should be better in the next release (b200 and later).

Copy and paste do what you want for moving notes to a new document; there's no need to cut!

If you're doing a lot of reorganizing -- moving notes to new containers -- consider using outline, chart, or treemap view.  

Title: Re: Alternative to drag between windows in Outline?
Post by Scott Heftler on Apr 12th, 2016, 6:40pm

If we want to move a note within the same document from one window to another, I believe we must use cut.  I'm worried now whenever I do a cut because if any of the notes inside the cut note have aliases elsewhere in the document, they will be deleted (and will remain deleted after I paste).

Is there any way to move a note between windows without losing all aliases?

UPDATE: Copy the note A in window A.  Paste it window B.  Then delete the original in A.  I think this should solve the problem.  But what about links from A?

Title: Re: Alternative to drag between windows in Outline?
Post by Mark Anderson on Apr 13th, 2016, 3:16am

I know it's not a copy/cut approach, but don't overlook action code and setting $Container. Setting a new $Container value for a note moves it to the container stipulated - and any links, etc., would be maintained.  Not tested, but I assume the new container's $OnAdd would be triggered - in case the latter might be an issue, though a 'drop' into a container would fire $OnAdd too.

To move a note (or selection) for container A to container B use this code:

$Container = "B";

…where 'B' is the $Name of the new container. If $Name might be ambiguous you can always give the full $Path instead.

This code could be used in a $Rule, $Edict, stamp, adornment $OnAdd, etc. If using in an agent's action you must set the $Container for the original or else you simply move the alias out of the agent. thus for an agent context:

$Container(original) = "B".

Title: Re: Alternative to drag between windows in Outline?
Post by Mark Bernstein on Apr 13th, 2016, 7:43am

Copy and paste will work fine within a document.

If you want to have a fresh instance of a note and its links, use Duplicate.  You can then move the duplicate note, if necessary, to its destination in outline, chart, or treemap view.

Title: Re: Alternative to drag between windows in Outline?
Post by J Fallows on Apr 13th, 2016, 9:49am


Quote:
If you want to have a fresh instance of a note and its links, use Duplicate.


Thanks for that reminder. I had forgotten about that differential effect of Duplicate, vs Copy, and it's useful to be reminded.

Title: Re: Alternative to drag between windows in Outline?
Post by Mark Anderson on Apr 13th, 2016, 11:43am

It's worth noting that 'duplicate' replicates outbound links but not inbound links. I'm not sure there a right or wrong there, but it's worth noting the status quo in case one assumed differently.

[Note to self: these facts need adding to aTbRef]

Title: Re: Alternative to drag between windows in Outline?
Post by Scott Heftler on Apr 15th, 2016, 1:45am

Thanks for pointing that out Mark A.  I just tested copy and paste.  Copy, too, deletes incoming links.

So it looks like notes with links or aliases cannot make the journey across windows.  Good thing notes now display incoming/outgoing links in Outline View.  Is there any way to know from the icon which notes have aliases and which do not?  If not then it looks like dragging within the same window and in Outline View is the only safe way to go for now.  That will mean lots of outline-expanding and scrolling for deep files.

Title: Re: Alternative to drag between windows in Outline?
Post by Mark Anderson on Apr 15th, 2016, 5:06am

Aliases aren't particularly easy to track as, for good reason, most searches try to disambiguate and return a single reference to an object even if it has many aliases. The best option is to use find() as this doesn't de-dupe results - indeed you have to filter if you don't want pointers to original and aliases.

I suggest you make a note - not an agent - called 'Alias Checker'. Make $MyString and $MyNumber a key attribute. Give the note this rule (or edit if you prefer):

$MyList = find($MyString(that)==$Name);
$MyNumber = $MyList.size;
$Text = $MyList.isort.format("\n");


The rule presumes we enter the $name of the note in which we're interest in the alias checker's $MyString; the '[url=]that[/url]' designator lets us use the value in a query. In the rule, firstly find() will return the path ($Path) of all notes and aliases whose $Name matches that test $MyString value. The query is full document scope - you could narrow this with additional terms. For instance if you only want to return aliases and not originals, add '&$IsAlias==true' to the find query; this will cause the original of the searched-for title not to match.

An assumption here is that the note $Name is unique, i.e. the additional matches are all aliases. If that's not the case you've a more complex case to solve. Another assumption is you're not looking for adornments, these are not query-able (or so I understand it).

The second expression in the rule stores the number of matches in $MyNumber. If the number is 5, that tells you you've a note with 4 aliases. If you want the $MyNumber to give the alias count, adjust line #2 of the rule: $MyNumber = ($MyList.size)-1;

The last part is optional and helps if you want to know where the aliases are, as it sorts the paths and places them in $Text as discrete lines (paragraphs). You can't tell at this pooint which is the original. If you really just need the aliases, use the modification to the find() query I mention above. If you just want a count, you can delete this last part of the rule.

Lastly, when using this it's probably a good idea to set $MyString to "" and let the $MyList and $Text flush back to nothing and then disable the rule (easy via the rule Inspector's tick-box. This stops hidden data piling up, and running one more whole scope query that doesn't need running all the time. That said, as we're storing info about aliases rather  than creating addition ones, it has no effect on the number of aliases.

Writing all this makes me thing that having a $AliasCount might seem a useful addition. Still the above is not hard to do, and a count wouldn't tell you where the aliases are. We've already got >300 system attributes to wade through when looking for the one we want. Note: don't worry about the latter figure, TB only stores (to TBX) non-default values for system & user attributes.  Having greater or fewer system attributes in the app doesn't significantly affect TBX size.

Title: Re: Alternative to drag between windows in Outline?
Post by Mark Bernstein on Apr 15th, 2016, 9:52am

Outline, or chart, or treemap.....

Title: Re: Alternative to drag between windows in Outline?
Post by Mark Anderson on Apr 20th, 2016, 5:34pm

aTbRef6 note on copying notes updated to reflect the point about whether links are duplicated or not.

Title: Re: Alternative to drag between windows in Outline?
Post by Scott Heftler on May 10th, 2016, 2:34am

After some excellent discussion with Tinderbox master Mark Anderson, I've found a perfectly satisfying solution to the cut-and-paste problem.  The problem was that cutting and pasting should not be used if the note (or its descendants) contain aliases elsewhere in the document (because cutting will kill them and pasting will not restore them).

My solution was to make an agent that marks notes that have non-agent-made aliases in bold.  I've never used $NameBold and I'm very glad for it.  It compliments the use of italics perfectly.  Both are now associated with alias-hood.  Here's the code:

$AgentQuery: $IsAlias & !$AgentQuery(parent(this));
$AgentAction: $NameBold=1;


As a side effect, I have grown a new perceptual organ, for knowing that a note has (non-agent) aliases out and about is itself informative, and interesting, and gives me some sense of the note's importance.

Title: Re: Alternative to drag between windows in Outline?
Post by J Fallows on May 10th, 2016, 5:02am


Quote:
$AgentQuery: $IsAlias & !$AgentQuery(parent(this));

$AgentAction: $NameBold=1;


Thanks for this very interesting suggestion about ways to find potentially orphaned aliases — ones not created (and thus automatically re-created) by agents.

I have a very literal-minded question about the code in your example. I understand that in the sample above, the attributes shown in blue are descriptions. You want to set the agent's query to the expression you show after ":" on the first line, and the agent's action to the expression after ":" on the second line.

What I have to ask is about the attribute shown in red. Are you saying to literally type in "$AgentQuery" as part of the query description? Or, the path-and-name of the agent itself? Sorry not to immediately grasp this, but it seems very useful so I would be grateful if you could further spell it out. Thanks!

Title: Re: Alternative to drag between windows in Outline?
Post by Mark Anderson on May 10th, 2016, 5:58am

!$AgentQuery(parent(this))

$AgentQuery(parent(this)) fetches the value of $AgentQuery for the parent of the item currently being evaluated. In a query this is essentially a Boolean test - is there a value (true) or no value (false). The '!' prefix flip the evaluated boolean.

For an alias created by an agent, i.e. its child, the $AgentQuery(parent(this)) test is true as the agent has a query. Thus $AgentQuery(parent(this)) is only false if the alias being evaluated is not the child of an agent.

As the desired query is for $AgentQuery(parent(this)) of false to be true, i.e. to match the query, the '!' prefix does the job of flipping the boolean outcome. See more on the !$AttributeName syntax.

Aside: if a straight ! prefix doesn't work in a query, as in !$AgentQuery(parent(this)), you can try the more explicit !() form as in !($AgentQuery(parent(this)))

Title: Re: Alternative to drag between windows in Outline?
Post by J Fallows on May 10th, 2016, 8:01am

Mark A, thanks for yet another quick and clear explanation! In my prowling through Tinderbox land I of course have come across the ! operator for Boolean searches and queries. But I hadn't ever put the attribute $AgentQuery to use. And now I can give it a try. Appreciate it.

Title: Re: Alternative to drag between windows in Outline?
Post by Mark Anderson on May 10th, 2016, 9:47am

On a more general note, if you need to ask if something is an agent, $AgentQuery!="" and things that co-erce to the same, are good tests for this. This is useful if you were hunting for an $IsAgent attribute (there isn't one).

I should note that an agent can have no query set, in which case the above fails.  However, generally I find one is testing for an active agent so the above suffices.

Title: Re: Alternative to drag between windows in Outline?
Post by J Fallows on May 10th, 2016, 1:36pm

And, just to close the loop (at least one that had been left open in my own mind), I do now understand that a test for $AgentQuery, or for $AgentQuery!="", is another way of testing for the (nonexistent) attribute $IsAgent.

I was imagining something more rococo, but now I see the simple elegance of the test !$AgentQuery(parent(this)) or $AgentQuery(parent(this))!="" , as a way of determining whether you are locating a stand-alone alias, or one generated by an agent. Thanks!

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.