Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: red on October 22, 2008, 03:50:42 PM

Title: Using EventDblClick to Change Shape's NoFill Cell
Post by: red on October 22, 2008, 03:50:42 PM
I'm trying to do what I think should be simple, but I'm having problems. I want to toggle the GeometryNoFill statusĀ  on a shape between TRUE and FALSE based on a Double Click on the shape. I'm really new to this, so I hope this isn't a poor question.

What I tried is

GeometryNoFill=EventDblClick in the geometry section

and then in the events section

EventDblClick=IF(GeometryNoFill=0,1,0)

My logic was that the DblClick would only execute when clicked so it would read the current valve (0 or 1) of GeometryNoFill and then toggle GeometryNoFill to the new value

Any suggestions on what I'm doing wrong?
Title: Re: Using EventDblClick to Change Shape's NoFill Cell
Post by: Visio Guy on October 23, 2008, 06:02:04 AM
Hi red,

EventDblClick is an "event cell", and events in the ShapeSheet go hand in hand with pushing formulas into other cells.

Try this:

EventDblClick = SETF( GETREF(Geometry1.NoFill), NOT(Geometry1.NoFill) )

That will toggle your cell's value. The SETF function actually writes information into the target cell. I like to use it as sparingly as possible, because a spreadsheet is supposed to be a collection of dependencies. But in event cells like EventDblClick or Action cells, where the user explicitly wants to change the shape, SETF makes sense.
Title: Re: Using EventDblClick to Change Shape's NoFill Cell
Post by: red on October 23, 2008, 08:17:53 AM
Thanks. That did the trick.
Title: Re: Using EventDblClick to Change Shape's NoFill Cell
Post by: vojo on October 23, 2008, 09:51:32 AM
BTW...you can extend this for richer function

user.mode_index=1

Eventdblclick = setf(getref(user.mode_index), if(user.mode_index < 10, user.mode_index=user.mode_index+1, 1)

some geometry cell = if(user.mode_index = 1, <do this>, if(user.mode_index = 2, <do that>, <do something other>))

etc etc....