MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Re: Re: Change CellTags with FrontEnd

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68896] RE: [mg68777] Re: [mg68698] Re: Change CellTags with FrontEnd
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Tue, 22 Aug 2006 05:20:48 -0400 (EDT)
  • Reply-to: jfultz at wolfram.com
  • Sender: owner-wri-mathgroup at wolfram.com

FrontEndExecute[] will not become obsolete.  In fact, it's implemented (as 
of 5.2) using MathLink`CallFrontEnd[].  I shouldn't have neglected to 
mention FrontEndExecute[] in my previous email...sorry about that.  Any 
code using FrontEndExecute[] will safely survive the transition into the 
next version of Mathematica.

Note that the change isn't because of a change in functionality to 
LinkWrite[]/LinkRead[] or to $ParentLink, but because $ParentLink will be 
an insufficient description the FE-kernel connection in future versions.

Sincerely,

John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.


On Sun, 20 Aug 2006 23:03:41 +0200, Ingolf Dahl wrote:
> Hi,
>
> The following three commands seem to be equivalent:
>
> LinkWrite[$ParentLink,
> FrontEnd`SelectionAddCellTags[nb, "newtag"]]
>
> MathLink`CallFrontEnd[FrontEnd`SelectionAddCellTags[nb, "newtag"]]
>
> FrontEndExecute[FrontEnd`SelectionAddCellTags[nb, "newtag"]]
>
> Likewise, the following three commands seem to be equivalent with each
> other:
>
> LinkWrite[$ParentLink,
> FrontEnd`CellInformation[nb]];LinkRead[$ParentLink]
>
> MathLink`CallFrontEnd[FrontEnd`CellInformation[nb]]
>
> FrontEndExecute[FrontEnd`CellInformation[nb]]
>
> (FrontEnd` before CellInformation can be omitted.)
> The version with LinkWrite is the only variant that I have seen
> published anywhere. Is the MathLink form to prefer before the
> FrontEndExecute? Is there any difference (e.g. in buttons) between the
> commands? FrontEndExecute is a few letters shorter to write, but will it
> become obsolete?
>
> Best regards
>
> Ingolf Dahl
> Sweden
>
>> -----Original Message-----
>> From: John Fultz [mailto:jfultz at wolfram.com]
To: mathgroup at smc.vnet.net
>> Subject: [mg68896] [mg68777] Re: [mg68698] Re: Change CellTags with FrontEnd
>>
>> Here's what you want...
>>
>> LinkWrite[$ParentLink,
>> FrontEnd`SelectionAddCellTags[FrontEnd`InputNotebook[], "newtag"]]
>>
>> That last argument can be a list as well as a single string,
>> and there's a complementary SelectionRemoveCellTags[]
>> command, too, which accepts the same syntax.  Sorry for not
>> sending this out in response to your first request, which I
>> saw, but hit me at a particularly busy time and slipped
>> through the cracks.
>>
>> And, while we're talking about notebook programming, let me
>> add one more important point.  In 5.2 (and future) front
>> ends, the preferred incantation is no longer LinkWrite, but
>> MathLink`CallFrontEnd.  In this case, for example, it would be...
>>
>> MathLink`CallFrontEnd[FrontEnd`SelectionAddCellTags[nb, "newtag"]]
>>
>> It is generally true that anyplace where LinkWrite of
>> $ParentLink used to be used to communicate with the FE,
>> MathLink`CallFrontEnd is recommended in
>> 5.2 and will be required in all future versions of Mathematica.
>>
>> Sincerely,
>>
>> John Fultz
>> jfultz at wolfram.com
>> User Interface Group
>> Wolfram Research, Inc.
>>
>>
>> On Thu, 17 Aug 2006 04:17:58 -0400 (EDT), Markus Huber wrote:
>>> Unfortunately this is not what I was looking for.
>>>
>>> But I found a possibility how to do it with the FrontEnd:
>>>
>>> SetOptions[NotebookSelection@InputNotebook[], CellTags -> ...];
>>>
>>> One problem still remains: You can only set CellTags this way (and
>>> overwrite existing ones), not add CellTags (that is what I
>> was looking
>>> for).
>>>
>>> Markus Huber
>>>
>>> David Park schrieb:
>>>
>>>> Ingolf Dahl has an extensive package for manipulating cell
>> tags. It
>>>> is available at
>>>>
>>>> And a new version of my package is available at
>>>> http://web.telia.com/~u31815170/Mathematica/
>>>>
>>>> and his email address for more information is
>> ingolf.dahl at telia.com.
>>
>>>> David Park
>>>> djmp at earthlink.net
>>>> http://home.earthlink.net/~djmp/
>>>>
>>>> From: mqh [mailto:mhla at gmx.at]
To: mathgroup at smc.vnet.net
>>>>
>>>> I'd like to change the celltags of several cells that are not
>>>> adjacent via a program (not via the menu). Doing this for
>> one cell is
>>>> no
>>>> problem: I use a rule like
>>>>
>>>> {Cell[a_, st_String, b___, CellTags -> tgs_, c___] :>
>> Cell[a, st, b,
>>>> CellTags -> Union[Flatten[{tgs, newtag}]], c], Cell[a_, st_String,
>>>> b___ /; FreeQ[{b}, CellTags, \[Infinity]]] :> Cell[a, st,
>> b, CellTags
>>>> -> settag]}.
>>>>
>>>> The problem arises now if several cells are selected: I
>> read them in,
>>>> apply the rule and paste them back, but the new cells
>> appear now at
>>>> the wrong place. One can simply imitate this behaviour of M by
>>>> selecting several not adjacent cells and doing copy and paste: One
>>>> will see that the cells are pasted at the wrong place.
>>>> Doing the same thing via the menu entry Find > Add/Remove
>> Cell Tags
>>>> this is no problem at all. So it appears to me that a
>> solution using
>>>> the FrontEnd would be the best thing. But: I can find no
>>>> documentation about a FrontEndToken like "AddCellTags". The best
>>>> thing I can do is use
>>>>
>>>> FrontEndTokenExecute[CellTagsEditDialog]
>>>>
>>>> to open the dialog to change CellTags, but this is not what I want.
>>>> So can anybody tell me if there is an additional
>> FrontEndToken that
>>>> can do what I want or has another idea? It should work for
>> M4.0 - M5.2.


  • Prev by Date: Re: Re: List Help Needed
  • Next by Date: Installing Mathematica via SMS
  • Previous by thread: RE: Re: Re: Change CellTags with FrontEnd
  • Next by thread: Wolfram Workbench and package development