LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Passing an event up the chain.

I am creating a specialised form or chart (an XY plot with the
underside of the curve forming a colour map of Z values, with
contours)
The chart is embedded in a class module which handles the extra
features (a whole lot of coloured polygons and lines added to the
chart's shapes collection)
When the axis limits are changed by the user, then the colour map
needs to be replotted. I can trap the chart events but none of them
seem to trigger when the user changes the axis limits. (unless one of
you knows better).
Plan B is an "Update Plot" context menu on the shapes collection. That
is actually pretty easy:

Private Sub ch_BeforeRightClick(Cancel As Boolean)
CommandBars("Shapes").Reset
With CommandBars("Shapes").Controls.Add
..Caption = "Update Plot"
..OnAction = ????????????????
End With
End Sub

However, getting the OnAction to call the correct subroutine in the
correct instance of the class is baffling me.
The event handler code is running in the correct instance, so I can
just update the plot on every right-click, but it is fairly time-
consuming so would prefer to do it only if the user selects the option
in the menu.

I think I want to set OnAction to be a sub in a standard module,
passed a link to the correct instance of the class module to run an
update method by the event handler. But I am getting in a terrible
muddle, and can't figure it out.

I suspect I might be trying to do the impossible, as you can only pass
a string in an OnAction parameter, and that probably isn't enough to
allow a standard module subroutine call a method of a specific
instance of a class.

Is it possible to iterate through all instances of a class looking for
one that contains ActiveChart? sort of like

For Each MyClass in <The current Scope
if MyClass.EmbededChart.Name = ActiveChart.Name then
MyClass.UpDatePlot
Endif
Next

Perhaps I need to cancel the standard context menu, drop down my own,
and act on it internally to the instance of the class module?

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing a variable to UserForm_activate() event Beertje Excel Programming 3 September 20th 07 11:34 PM
Sub() calling Sub()'s in the "worksheet event code€ť passing toggle CRayF Excel Programming 2 September 25th 05 03:48 AM
Passing CheckBox Value from Click Event to Main Macro ExcelMonkey[_190_] Excel Programming 2 February 1st 05 05:47 PM
Passing Public Module Vairable to a Worksheet Event SMS - John Howard Excel Programming 1 November 4th 04 08:33 AM
Passing ARGUMENTS between event procedures of a USERFORM jason Excel Programming 8 November 10th 03 07:36 PM


All times are GMT +1. The time now is 01:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"