Author Topic: EventDblClick = OPENTEXTWIN() but then for the text of a subshape  (Read 218 times)

0 Members and 1 Guest are viewing this topic.

Visisthebest

  • Jr. Member
  • **
  • Posts: 58
Can the EventDblClick for a group shape be set so that the users edits the text of a specific subshape we specify in the shapesheet?

Kind of like EventDblClick = OPENTEXTWIN() but then for the text of a subshape.

Thank you for your help!

Yacine

  • Hero Member
  • *****
  • Posts: 2664
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #1 on: February 11, 2020, 12:54:20 PM »
Not as specific as you want, but if you protect the group against text editing, then the first shape in the depth order of the group gets its text edited when pressing F2 (text edit). Not sure if the double click works as well.
Yacine

Visisthebest

  • Jr. Member
  • **
  • Posts: 58
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #2 on: February 11, 2020, 01:05:47 PM »
Thank you Yacine that is already better than how it currently works!

Is it possible to open user editing of text on a (sub)shape with a macro? Then I could activate the macro when the group is double-clicked!

Visisthebest

  • Jr. Member
  • **
  • Posts: 58
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #3 on: February 11, 2020, 01:12:17 PM »
Turned on protection of the group text then getting this message when clicking the group and then F2:
Shape protection, container and/or layer properties prevent complete execution of this command.

Selecting the specific subshape and pressing F2 does still work properly.

Using Visio 2019.


Visisthebest

  • Jr. Member
  • **
  • Posts: 58
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #4 on: February 11, 2020, 01:16:30 PM »
Just making the subshape the frontmost shape seems to have done the trick though, no text protection on the group needed!

vojo

  • Hero Member
  • *****
  • Posts: 1354
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #5 on: February 11, 2020, 01:28:26 PM »
since shapes grouped (shape relationship predefined), you can do something different

overview
- at group level, add controls to manage group shape properties
    - props.A for <for child shape A>
    - props.B fpr <for child shape B>
- use this to set text for each child  (group doubleclk = docmd(1312) or standard shape props window)
- then have each child shape pick the right value from group
    - use the fields function in each child shape to show its respective text.

Perhaps a simpler approach would be to go to behavior and set "show child shapes first" on the lower right of the menu
This would allow you to double click the child shape of interest.   From there you can use props  (docmd(1312) in eventdblclk)
or child shape data window to get user data into the shape....then either show the shape data on its screen or use fields to show in shape

The key problem with what you are trying to do is that the child shape has to be selected and double click to execute
Unless you want to write some VBA to achieve your results.

Visisthebest

  • Jr. Member
  • **
  • Posts: 58
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #6 on: February 11, 2020, 01:47:48 PM »
Thank you Vojo! Unfortunately it will typically be multi-line text for which the shape data editor window isn’t great being single line. How do you think I could solve it in VBA?

What you propose above is a great solution for another shape I’m working on though!

vojo

  • Hero Member
  • *****
  • Posts: 1354
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #7 on: February 11, 2020, 02:56:18 PM »
I don't do much with VBA because the user has to set up his system to support

That said
- need to find the group on the page then find the shape in the group
- need to build a GUI or forms to get data
- need to place data in the shape

I think VBA will be over kill and be a security issue roadblock

May be could look at containers in visio….maybe a container of shapes where you can edit each shape directly

Visisthebest

  • Jr. Member
  • **
  • Posts: 58
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #8 on: February 11, 2020, 07:55:25 PM »
Yes that becomes too complicated as well, maybe I should be using the group text and then align this text with the subshape I want this text to be shown on (disabling the text on the subshape itself). Bit of a workaround too though, but good to know there is some compromise necessary for this to work.

For the security issues putting a code signing certificate on the vba helps to mitigate that issue.

Thank you for your help and advice Vojo!

vojo

  • Hero Member
  • *****
  • Posts: 1354
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #9 on: February 11, 2020, 09:01:02 PM »
RE certificate, sure...but only half the problem
Need to enable the VBA engine as well as VBA projects.  On excel projects I have done, those were beyond certificate stuff

Also, you cant guarantee all users have certificates....can you? 
They would have to change their security settings to allow VBA as well...at least had to do that for Excel

RE multiline:  You may want to play around to see if truly a problem (wrapping a long string, multiple prop fields, etc)

Croc

  • Full Member
  • ***
  • Posts: 215
    • Visioport
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #10 on: February 12, 2020, 02:43:14 AM »
You can try a construction similar to this.
Code: [Select]
EventDblClick=SETF(GetRef(Sheet.4!Scratch.B1),"OPENTEXTWIN()")Let Doubleclick pass Opentextwin() function to the subshape.

Or you can use the backlink from the subshape inside the Dependson() function
Code: [Select]
[Group].EventDblClick=Now()
[SubShape].Scratch.A1=OPENTEXTWIN()+DEPENDSON([Group]!EventDblClick)
« Last Edit: February 12, 2020, 02:58:55 AM by Croc »

Visisthebest

  • Jr. Member
  • **
  • Posts: 58
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #11 on: February 12, 2020, 06:06:30 AM »
Thank you Croc will try these options for sure and let you know if I get them to work properly!

Visisthebest

  • Jr. Member
  • **
  • Posts: 58
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #12 on: February 12, 2020, 07:12:05 AM »
Croc this works really well!

EventDblClick=SETF(GetRef(Sheet.4!Scratch.B1),"OPENTEXTWIN()")

So writing to the Scratch section (I added it) is a trick to get in to text editing the subshape I assume?

Croc

  • Full Member
  • ***
  • Posts: 215
    • Visioport
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #13 on: February 12, 2020, 07:42:24 AM »
Yes. Visio performs the function at the time of recording. In this case, the function works in the context of the desired shape.

Visisthebest

  • Jr. Member
  • **
  • Posts: 58
Re: EventDblClick = OPENTEXTWIN() but then for the text of a subshape
« Reply #14 on: February 16, 2020, 01:02:08 PM »
Thank you all for your input and help!