Development system with methods for type-safe delegation of object events to event handlers of other objects
DCFirst Claim
1. In an object-oriented development system for creating a computer program, said computer program comprising objects which respond to events, a method for delegating control for handling an event from a first object to a method of a second object, the method comprising:
- creating a method pointer at the first object, said method pointer for storing an address of a particular method of another object together with an address for the other object, said address for the object serving as a “
this”
pointer through which local data of the object can be accessed;
receiving user input for delegating control for handling said event from said first object to a particular method of said second object;
in response to said user input, storing in said method pointer of said first object an address for said particular method of said second object together with said “
this”
pointer for said second object; and
upon occurrence of said event at said first object during execution of said computer program, invoking said particular method of said second object through said method pointer, said particular method accessing local data of said second object through a “
this”
pointer comprising the address of said second object which is stored by said method pointer.
10 Assignments
Litigations
0 Petitions
Accused Products
Abstract
A visual development system is described which provide “method pointers” allowing a developer/user to achieve delegation between objects programmatically as well as visually. Delegation “binds” an event source with an event handler. This binding is directly supported within the programming language of the system. Using a simple assignment statement, the user can assign a handler of one object (i.e., delegated-to object) to the method pointer of another object (i.e., delegated-from object). A delegation through assignment leads to not only the address of the method being copied but also the address of the delegated-to object (i.e., “this” pointer) being copied into the method pointer. The method pointer, when called, can invoke the pointed-to method on that (delegated-to) object, complete with the context (e.g., local data) of the object. The object knows about itself and, thus, can provide the appropriate context. In this fashion, the system allows the user to easily control object behavior through delegation, whether the user is working in a visual environment or a programming environment (or switching back and forth between each).
67 Citations
35 Claims
-
1. In an object-oriented development system for creating a computer program, said computer program comprising objects which respond to events, a method for delegating control for handling an event from a first object to a method of a second object, the method comprising:
-
creating a method pointer at the first object, said method pointer for storing an address of a particular method of another object together with an address for the other object, said address for the object serving as a “
this”
pointer through which local data of the object can be accessed;
receiving user input for delegating control for handling said event from said first object to a particular method of said second object;
in response to said user input, storing in said method pointer of said first object an address for said particular method of said second object together with said “
this”
pointer for said second object; and
upon occurrence of said event at said first object during execution of said computer program, invoking said particular method of said second object through said method pointer, said particular method accessing local data of said second object through a “
this”
pointer comprising the address of said second object which is stored by said method pointer.- View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
providing said object-oriented development system with a language syntax for programmatically creating method pointers in source code format.
-
-
5. The method of claim 4, wherein each method pointer declared in source code format is declared in a form comprising a name of the method pointer followed by a type for the method pointer.
-
6. The method of claim 5, wherein each method pointer for a method taking no parameters and returning no value is declared in a format comprising:
name of method pointer equals procedure of object.
-
7. The method of claim 5, wherein each method pointer for a method which takes parameters and returns no value is declared in a format comprising:
name of the method pointer equals procedure, with parameter list, of object.
-
8. The method of claim 5, wherein each method pointer for a method returning a value but taking no parameters is declared in a format comprising:
name of method equals return value type followed by function of object.
-
9. The method of claim 5, wherein each method pointer for a method returning a value but taking no parameters is declared in a format comprising:
name of method equals return value type followed by function, with parameter list, of object.
-
10. The method of claim 1, wherein said method pointer comprises two 32-bit double words, one double word storing the address of said particular method as a 32-bit function pointer, the other double word storing the address of said second object as a 32-bit “
- this”
pointer.
- this”
-
11. The method of claim 1, wherein said user input comprises:
a programming construct set forth in source code.
-
12. The method of claim 11, wherein said programming construct comprises an assignment expression.
-
13. The method of claim 12, wherein said assignment expression takes a form comprising a name of the method pointer, followed by an equal sign, followed by a name of said particular method.
-
14. The method of claim 13, wherein said assignment expression takes a form comprising:
name of method pointer equals name of object followed by dot operator followed by name of method.
-
15. The method of claim 14, wherein the name of the object is implied if said assignment expression occurs within another method of said object.
-
16. The method of claim 1, wherein said user input comprises:
user input received at a graphical user interface, for assigning said particular method in said second object to handle the event which occurs at said first object.
-
17. The method of claim 16, wherein said graphical user interface includes a property manager dialog listing properties for each object, said properties including event handlers which are assigned for handling events which occur at each object.
-
18. The method of claim 17, wherein said user input comprises selecting said particular method of said second object from a pull down list of methods.
-
19. The method of claim 1, wherein said storing step further comprises:
first checking whether said method of said second object is type compatible for receiving information about said event.
-
20. The method of claim 1, wherein said second object is type compatible if it takes parameters which are the same type as information provided by said system about said event.
-
21. In a computer system, a method for binding first and second objects together, the method comprising:
-
storing in the first object a method pointer for delegating handling of events occurring at the first object to a particular method of the second object, said method pointer comprising;
(i) first information stored in the first object providing access to the particular method of the second object, which is to handle a particular type of event which occurs at the first object;
(ii) second information stored at the first object serving as a “
this”
points providing access to local data members of the second object, so that said particular method of the second object can be invoked within a particular context of said second object; and
upon occurrence of the event at said first object, using said first stored information for invoking said particular method of said second object, the particular method using said second stored information to access the local data members of the second object. - View Dependent Claims (22, 23, 24, 25, 26, 27, 28, 29)
copying a double word pointer comprising a function pointer for said particular method into memory allocated for said first object.
-
-
28. The method of claim 21, wherein said storing second information comprises:
copying a double word pointer comprising a “
this”
pointer for said second object into memory allocated for said first object.
-
29. The method of claim 21, wherein said using said first information step comprises:
executing a machine instruction for calling into a memory address indicated by said first stored information, said memory address storing machine instructions for processing said particular event.
-
30. A visual development system comprising:
-
a computer having a processor and a memory;
a visual interface for positioning objects on a form displayed on screen, each object responding to events with a certain behavior; and
means for changing behavior of a first object by delegating the object'"'"'s responsibility for responding to a particular event to a handler of a second object, said means including means for storing in the first object a pointer storing an address for the handler of the second object together with a “
this”
pointer storing an address for said second object for providing a particular context of said second object, so that occurrence of the particular event at the first object results in invocation of the handler with the context of said second object.- View Dependent Claims (31, 32, 33, 34, 35)
a property manager providing a list of handlers suitable for handling said particular event.
-
-
32. The system of claim 31, wherein handlers which are suitable for handling said particular event take parameters compatible with information provided by the system upon occurrence of the particular event.
-
33. The system of claim 32, wherein said information provided by the system includes a description of which object the event occurred at.
-
34. The system of claim 30, wherein said information describing a particular context of the second object includes a “
- this”
pointer allowing access to local data stored by the second object.
- this”
-
35. The system of claim 30, wherein said first object is a button object displayed on screen, and wherein said second object is a form object displayed on screen.
Specification