Can't find event

Posted by Aliaksandr Tarasevich on 08-Mar-2010 06:50

Hello guys,

I try to use "ISelectionService Interface", somethig like this:

define variable rSel as ISelectionService no-undo.

...
if valid-object (rSel) then
rSel:SelectionChanged:Subscribe (OnSelectionChanged).
...
method void OnSelectionChanged ...


in VisualStudio I can see that the interface ISelectionService has 'SelectionChanged' event, the same is in MSDN, and I don't get compiler error. But at run-time I get an error, "can't find SelectionChanged in ISelectionService", why do I get this error?

MSDN C#:

private ISelectionService selectionService; 
if (selectionService != null)  {
     selectionService.SelectionChanged += new EventHandler(OnSelectionChanged);
...

Progress 10.2B

All Replies

Posted by jquerijero on 08-Mar-2010 09:13

Can you paste the definition of OnSelectionChanged? This works fine on my end.

Posted by Aliaksandr Tarasevich on 08-Mar-2010 11:40

define variable rSel as ISelectionService no-undo.

rSel = CAST (THIS-OBJECT:ServiceContainer:GetService( Progress.Util.TypeHelper:GetType ("System.ComponentModel.Design.ISelectionService") ), ISelectionService).
if valid-object (rSel) then
rSel:SelectionChanged:Subscribe( OnSelectionChanged ).

METHOD VOID OnSelectionChanged ( rObj AS System.Object, rArgs AS System.EventArgs ):
    MESSAGE "SelectionChanged! :)" VIEW-AS ALERT-BOX.
END METHOD.

---------------------------
Error (Press HELP to view stack trace)
---------------------------
System.MissingMemberException: Member 'System.ComponentModel.Design.SelectionService.SelectionChanged' not found.
---------------------------
OK   Help  
---------------------------

Posted by jquerijero on 08-Mar-2010 13:43

I'm using the same code as what you've got. I'm not seeing anything unusual. What Progress version you are on?

Posted by Aliaksandr Tarasevich on 08-Mar-2010 13:49

10.2B

Posted by whenshaw on 08-Mar-2010 16:01

Hello Aliaksandr,

I can get the same exception that you get, though I don't know how my test code compares with what you are doing. As a test, I created a UserControl, overrode its InitLayout() method, and put some code like yours into that method. I dropped the UserControl onto a Form in the Visual Designer and, when InitLayout() executes, I get the exception.

Are you trying to use ISelectionService at design time, like I did? (I know you mentioned "run time", but am not sure whether that  just means "when the code executes", which in this case could be while designing a form.)

At any rate, I don't know why this exception is being raised, so please submit a bug to Tech Support.

Regards,

--Wayne Henshaw

Posted by Aliaksandr Tarasevich on 10-Mar-2010 14:00

Done - bug# OE00196061.

This thread is closed