Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 0.9
-
Fix Version/s: 0.9.5
-
Component/s: Boo.Lang.Useful
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
The Handles attribute replicates Visual Basic's declarative event handlers syntax. The same Visual Basic restrictions apply. They are documented at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconWithEventsHandlesClause.asp
- It cannot be used in structs.
- It cannot be used in with shared events.
- The field must be PRIVATE, (Boo fields are PROTECTED by default).
- Since the field is private, it cannot be used by derived classes.
- Note that there is no [WithEvents]. It's not needed.
- Dynamically attaching/detaching handlers in addition to HandlesAttribute on an object is not recommended.
If you need dynamic handles functionality, register you handlers manually. - I suggest you google <Visual Basic WithEvents Handles> for more information.
class Foo:
private bar as Bar = Bar() <-- works
private zap as Zap
def constructor():
zap = Zap() <--- works
def SomeOtherMethod():
bar = Bar() <--- works
[Handles(bar.Click, zap.Click, ...)]
def SomethingClicked(sender, e as ClickEventArgs):
pass
A nice screenshot can be found at http://img23.imagevenue.com/img.php?loc=loc77&image=d9c_CleanBoo.JPG
TODO:
Put exception messages in strings.txt for globalization purposes.
Find a better way to display errors.
Create everything after type check.
Write comments.