|
1
|
|
|
2
|
- OLE - Object Linking &
Embedding
- Primarily about Documents
- Introduction of scripting of objects
- Linking vs. Embedding
- Linking – References to Files
- Embedding – Files live with the program
- Servers activate inside the client
- COM – Component Object Model
|
|
3
|
- Re-branding of OLE
- Introduction of Windowing Controls
- Graphs
- Grids
- Date Controls
- Recognition of the importance of scripting
- Far more third-party controls than previously
|
|
4
|
- Using an object written by someone else as if it were part of my own
application
- Reading properties
- dim Title as C
- Title = someobject.Title
- Writing Properties
- someobject.Title = “Hello World!”
|
|
5
|
- Calling functions
- Responding to events
- Objects “trigger” events by calling functions
- You implement those functions only if you care
- Example
- function Click as V (x as B, y as N)
- msg = “User clicked at x = “
+ x + “ and y = “ + y
- ui_msg_box(Just Testing, msg)
- end function
|
|
6
|
- Objects are registered at install time
- Listed in the Windows Registry
- Entries describe
- Properties, Events & Methods (functions)
- How to create/load and use the object
- Identifies how the object should be used
- Control
- Programmable
- Insertable
|
|
7
|
- Creating a new object requires a short name
- Programmatic Identifier (ProgId)
- Call ole.create() to create a new instance
- Access the object using dot (”.”) syntax
- Example
- dim someobject as p
- someobject =
ole.create(“owc.spreadsheet”)
- someobject.Range("A1").Select()
- someobject.ActiveCell = "Name"
|
|
8
|
- Select ActiveX (the big X) from the ToolBox and place a rectangle on the
workspace.
|
|
9
|
- A dialog will open listing available controls.
- Select your control from the list and click Insert.
|
|
10
|
- Access control properties, and methods in form scripts with the syntax:
- dim object as p
- object = my_control_name.activex.this
- if object.title = “” then
- object.Title = “Hello World!”
- object.Refresh()
- end if
|
|
11
|
- Select ActiveX Event from the menu or right-mouse button to script
events published by the control.
|
|
12
|
|
|
13
|
- Declare variables to identify the control
- dim img as p
- dim img.object as p
- dim img.class as c
- img.class = "imaging.editctrl.1"
|
|
14
|
- Add the control to the dialog definition
- {activex=80,25img}
|
|
15
|
- Access control properties, and methods in dialog event handlers with the
syntax:
- dim object as p
- object = img.object
- if object.title = “” then
- object.Title = “Hello World!”
- object.Refresh()
- end if
|
|
16
|
- Script event handlers for the control
- img.events = <<%code%
- function Click as v ()
- self.zoom = iif(self.Zoom + 10 < 6554, self.zoom + 10, 2)
- self.Display()
- end function
- function DblClick as v ()
- ‘ To Do
- end function
- %code%
|
|
17
|
|
|
18
|
|