![]() |
|
#1
|
|||
|
|||
|
Hi,
I have got some circles on my page and I want to toggle fill color between red and black when I click on one of the circles. I have written color-changing code and it works well, but I am not sure which event to use to trigger the code. I have tried SelectionChange but it put it into an infinite loop. I don't want to do any more actions for each circle other than click on the circle. I have all circles in a shape array, so I can test if a selected shape is one of the circles, if that would be helpful. Thank you. |
|
#2
|
||||
|
||||
|
Try setting your PreserveSelection = False. Here is my little example. To make it work created two shapes and name one 'Red' and the other 'Black' When you click on the shape 'Red' it finds all the shapes filled with black and fills them red. When you click on the shape 'Black' it finds all the red shapes and fills them black.
Code:
Private Sub GlobalMacroStorage_SelectionChange()
If Not ActiveShape Is Nothing Then
If (ActiveShape.Name = "Black") Or (ActiveShape.Name = "Red") Then
Dim sr As ShapeRange
ActiveDocument.PreserveSelection = False
If ActiveShape.Name = "Black" Then
Set sr = ActivePage.Shapes.FindShapes(Query:="@fill.color.name = 'Red' and @name <> 'Black' and @name <> 'Red'")
sr.ApplyUniformFill CreateCMYKColor(0, 0, 0, 100)
End If
If ActiveShape.Name = "Red" Then
Set sr = ActivePage.Shapes.FindShapes(Query:="@fill.color.name = 'Black' and @name <> 'Red' and @name <> 'Black'")
sr.ApplyUniformFill CreateCMYKColor(0, 100, 100, 0)
End If
Set sr = Nothing
End If
End If
End Sub
-Shelby Last edited by shelbym; 17-10-2008 at 17:43. |
|
#3
|
|||
|
|||
|
Shelby.... could this apply to marquee-multi-selected objects?
I have not tried the code above yet. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help me please....needed HPGL export macros color selection.. | soydan | CorelDRAW/Corel DESIGNER VBA | 14 | 25-11-2012 14:59 |
| Use event in C# application! | TheFez | CorelDRAW/Corel DESIGNER VBA | 0 | 05-06-2008 04:07 |
| Corel Color Managment Macro Needed! | bagman74 | Macros/Add-ons | 1 | 24-01-2008 16:58 |
| Event Categories | Vegas | Calendar Wizard | 4 | 08-07-2005 14:08 |
| Draw Event GlobalDocument_Start | schubmar | CorelDRAW/Corel DESIGNER VBA | 5 | 21-02-2003 08:21 |