News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Syncing the ScreenTip and a shape data field (string) on change

Started by Visisthebest, June 06, 2024, 05:50:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Visisthebest

I would like to do the following with these elements:

1. The ScreenTip
2. A shape data field called ScreenTip

Each time the user edits the ScreenTip (multiline editor), the (changed) text is pushed to the shape data field.

Each time the user edits the shape data field, the (changed) text is pushed to the ScreenTip.

What is the best way to accomplish this?

Thank you!
Visio 2021 Professional

Yacine

That's Wapperdude's domain with the setatrefexpr stuff. He's written a quite good explanatory post on it. But you still need some concentration to get it right.
Yacine

wapperdude

 ::)    ;D  ineresting.

I rarely work with screen tips.  The SETATREF() fcn might work.  They work with Shapedata, not sure about interaction with screen tips.

I would begin with macro recorder.  After you have your shape, data, and tip defined, start the recorder to see what it captures when you make a change to the screen tip.  This would provide idea how to reference the tip in code.  That reference would be my 1st try for the target in the SETATREF() fcn.  The entire SETATREF formula would reside in the Prop.data cell.

As a consequence, changes to prop data are 1st pushed into screen tip, and then echoed back to the data.  Formula unchanged in doing so.  Similarly, the formula ought to grab manual changes the tip, and pull those back to that shape data.
Visio 2019 Pro

wapperdude

SETATREF() fcn will work.

The target cell is "COMMENT" in the Miscellaneous Section of the shapesheet.  In the Shape Data section, in the row that has useful information, say prop.row_1, in the Value cell, enter:  SETATREF(Comment,SETATREFEVAL(SETATREFEXPR("Default")))  Default is just a placeholder.  You may edit shape data, change this to something, say, "Specific nonsense".  The Screen Tip will show the new text.  In addition, you could open GUI>Insert>ScreenTip.  The new text should showup here too.  Enter new text, "Some jibberish".  This will now be displayed in the ScreenTip.  Also, recalling the ShapeData window, it will likewise show this text.  Two, non-destructive ways to enter ScreenTip info.
Visio 2019 Pro

Visisthebest

Thank you Wapperdude this should work well and solves a user experience issue: now the user has this text field in their Shape Data overview AND they can edit it multi line as well, very handy!
Visio 2021 Professional

Visisthebest

Works perfectly Wapperdude thank you!

It still remains a bit of a mystery to me how this single formula creates 2-way communication between the Comment cell and the Shape Data cell.
Visio 2021 Professional

wapperdude

Smoke and mirrors.

If I tell you, then I'd have to eliminate you.


Yeah.  Bit confusing.  Consequently, SETATREF() kinda gets ignored.  That's why I did this topic:  What's with SETATREF. The initial entries deal with the basics.  Then, gradually shows more application examples.  Fundamentally, it's the supporting background code that governs the behavior. 
Visio 2019 Pro

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 262 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1111KB.
Tokens: post-login.
Cache hits: 13: 0.00218s for 26,766 bytes (show)
Cache misses: 2: (show)
Queries used: 15.

[Show Queries]