Re: Shape Selection



<cybatech@xxxxxxxxxxxxx> wrote in message
news:lh1gf15a7tbhfcpkccnuthai8pbnjeifsd@xxxxxxxxxx

> Hi Guts, Tiz me again.
> I have managed to create shapes at runtime and move them Ala drag,
> also I can now change there colors, but when I create more then one I
> can only change the color of the last one created. I cannot change the
> color of Previously created shapes.

<snip code>

That's because you are trampling all over the global variable Selection
in your Create_ShapeClick handler. Any shape created ends up pointed to
from Selection, effectively making it the selection. That's not at all
bad in itself, although I would have updated the display to reflect the
change of selection. You can reread ReleaseShape to see what's involved
in that.

It appears that ReleaseShape is no longer in use; you have a new method
MouseUpOnShape, which doesn't concern itself with the selection. That
would prevent you from changing the colour of previously created shapes
alright. The Selection field was introduced to save state from one
event handler to another one. It is in effect a global variable and you've
just discovered why people don't like them: forgetting to treat them
correctly in one location will break code in another location.

If you'd like to, you can chain event handlers. Just call one from the
other like a regular method. You could also have added your own code to
the existing event handler. Is there any reason why you thought you
needed to ditch existing, working, code and start from scratch?

Groetjes,
Maarten Wiltink


.



Relevant Pages

  • Re: transparent text or group names
    ... event handler (that handles the selection event, ... slide all called "steve" in 2003 ... Then I changed some shapes so that eg the circle called "steve" became a ...
    (microsoft.public.powerpoint)
  • Re: PZ Myers sued for libel
    ... This is hardly an endorsement of magical self-organization. ... Is the spherical shape of many cells an example of self-organization, ... because natural selection has resulted in such a shape, ... If shapes of cells and simple organisms have no adaptive significance, ...
    (talk.origins)
  • Re: Instanzen eines Mastershape selektieren
    ... man kann auch selections auf einer Page erzeugen - technisch bleibt es das Gleiche man müsste in der Selection diese pro Seite machen. ... Dim iShapeCount As Integer ... Debug.Print "No Shapes On Page" ...
    (microsoft.public.de.german.visio)
  • Re: PZ Myers sued for libel
    ... of self-organization? ... because natural selection has resulted in such a shape, ... If shapes of cells and simple organisms have no adaptive significance, ...
    (talk.origins)
  • Re: directional selection
    ... than the menu selection. ... I know this is partly a suggestion, but have you spotted 'Select shapes ... Good idea with the Shift key as it seems to be unused at the moment. ...
    (microsoft.public.visio.general)