PowerPoint - shape.select method

Add-in Express™ Support Service
That's what is more important than anything else

PowerPoint - shape.select method
PowerPoint - shape.select method fails to produce a visible selection perimeter around the shape.  
James Turner




Posts: 2
Joined: 2006-04-05
Currently working with:
Add-in express VCL (current)
Delphi 2010
PowerPoint 2010 - 32

I have a PowerPoint add-in that on a ribbon button click I want to cycle through, identify and question each shape in a slide with a user.

Problem #1 - Within the OnButtonClick event PowerPoint does not respond visually to a shape's shape.select(msoTrue) method. PowerPoint fails to produce a visible selection perimeter around a shape within a controlled event.


Upon trying some work around I stumbled into Problem #2.
Related Problem #2 - To go further PowerPoint does not redraw/refresh any of it's windows while processing within the OnButtonClick event. It will however redraw/refresh when the DocumentWindow .ViewType changes or a currently unselected slide has it's slide.selected called.

I currently change the DocumentWindow .ViewType to ppViewSlideMaster and back to ppViewNormal to overcome Problem #2. This does not however fix Problem #1 as a selection perimeter for any shape fails to show. It does allow me to change the background color temporarily for text withing a shape. This does not help me with Images.

Any help would be appreciated.

Thanks,
James
Posted 24 Oct, 2012 14:59:03 Top
Andrei Smolin


Add-in Express team


Posts: 15211
Joined: 2006-05-11
Hello James,

James Turner writes:
Problem #1 - Within the OnButtonClick event PowerPoint does not respond visually to a shape's shape.select(msoTrue) method. PowerPoint fails to produce a visible selection perimeter around a shape within a controlled event.


You cannot achieve this in the event. When the window procedure behind the main PowerPoint window detects that you press the left mouse button, it finds the window to handle that click and pass the correspoding Windows message to that window. Then the window procedure behind that window gets the message and raises the event; this invokes your code. Until your code returns, the window procedures above aren't able to handle other messages; one of the messages that wait for your code to return is the message which instructs PowerPoint to draw the selection.

I think this should be organized in this way. You need to manage a list of processed shapes to know what shape to process next. The button click initiates walking through shapes - it starts a timer in the event of which you handle another shape; after you handle the shape, you start the timer anew. There should be a way for the user to stop the process. The timer allows you to cut the process into pieces so that the windows procedures above have time to handle messages.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Oct, 2012 01:32:55 Top