Thank you Mark S.! I believe I understand now.
The widgets within the body of the $button widget happen as part of the button definition only - nothing actually happens until the button is pressed. Since the tiddler has not yet been created, the tiddler $:/temp/create has not been created and therefore the new title is not available in this context. When the button is pressed, the action-createtiddler is executed as defined, thus creating the new tiddler and saving the actual title in $:/temp/create as requested. Once the button has finished doing its job, the actions in the actions attribute are executed. At this point the new title is available for the $fieldmangler widget to access, and the tm-remove-tag message can work as expected. Pardon my detailed explanation, but I needed to work through it and thought it might be helpful for others. It makes total sense to me now. I just wish I was more comfortable with all the subtleties of widgets, macros and messages. Sometimes I get totally lost when trying to do something very simple! Thank you again for taking the time to help me. Ken On Monday, April 26, 2021 at 1:54:53 PM UTC-7 Mark S. wrote: > By using the actions attribute, you can add the things that have to happen > AFTER the creation -- otherwise the button widget doesn't see the new > tiddler. > > \define myactions() > <$fieldmangler tiddler={{x:/temp/create}} > > <$action-sendmessage > $message="tm-remove-tag" > $param="Templates"/> > </$fieldmangler> > > <$action-deletetiddler $tiddler="x:/temp/create"/> > \end > > <$button actions=<<myactions>> > > <$action-createtiddler > $basetitle="Created Tiddler" > $savetitle = "x:/temp/create" > $template="Source Tiddler"/> > > Create New Tiddler > </$button> > > I changed your savetitle tiddler name while testing. Also, I kept things > simple by not using a field since you were going to delete the tiddler > anyway. > > On Monday, April 26, 2021 at 1:28:56 PM UTC-7 Ken wrote: > >> I am having a problem getting a fairly simple process working in >> TiddlyWiki. >> >> I want to create a new tiddler based on a template. The template includes >> a Templates tag so I can see all my templates in my TOC. When I create a >> new tiddler using the template, I want to remove the Templates tag. >> >> The name of the template tiddler is "Source Tiddler". In a button, I use >> $action-createtiddler. Because the title of the created tiddler may be >> different from what's specified in the $basetitle attribute, I supply the >> $savetitle attribute with a place to store the actual title. In the code >> below I used a field in a temporary tiddler ($:/temp/create!!actual-title). >> I then try to remove the Templates tag from the newly created tiddler, as >> show in the $fieldmangler widget in the code. >> >> <$button> >> <$action-createtiddler >> $basetitle="Created Tiddler" >> $savetitle = "$:/temp/create!!actual-title" >> $template="Source Tiddler"/> >> >> <$fieldmangler tiddler={{$:/temp/create!!actual-title}}> >> <$action-sendmessage >> $message="tm-remove-tag" >> $param="Templates"/> >> </$fieldmangler> >> >> <$action-deletetiddler $tiddler="$:/temp/create"/> >> Create New Tiddler >> </$Button> >> >> This creates the new tiddler, and stores the correct value in the field >> (which I verified by commenting out the action-deletetiddler code). >> However, the tag does not get removed. I have tried storing the actual >> title in a field in the tiddler containing the button and in the text of a >> new tiddler, but cannot seem to figure out the correct syntax to use so the >> $fieldmangler widget correctly sets the currentTiddler. >> >> Note that if I hard code the $fieldmangler widget as follows, the tag is >> correctly removed! >> >> <$fieldmangler tiddler="Created Tiddler"> >> >> So I would like advice on 1) Where should I store the savetitle and 2) >> what is the appropriate syntax to use for the tiddler attribute in the >> $fieldmangler widget? >> >> Thank you. >> >> Ken >> > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/8c0f50aa-a2f1-4d28-845c-f97abb25d4e9n%40googlegroups.com.