Background:
I have a subclass of Serial that connects to a particular serial device. I parse the data from the device in the subclass’ DataAvailable event.
I have 3 windows, each has a TextArea. In this application, only one window is possible to run at a any one time, selected by a mode meaningful to the application. Each window has a Property mSerial of the Serial subclass’ type.
Goal:
When the subclass’ DataAvailable has parsed a ‘packet’ of information from the device, I want to append this data to the currently active window’s TextArea. I’d prefer to have one Serial subclass that can make use of a method in the window, rather than tailor 3 subclasses each specific to a window but otherwise identical.
Request:
Please advise on how I might accomplish this.
Water under the bridge:
I’m suspecting I need something along the lines of a Delegate function, or maybe an interface. But I cannot wrap my head around the Delegate behavior. I have read the Xojo documentation, the User Guides, Howe’s OOP Programming, reviewed old NUG articles. I’m stumbling badly on this search. Rather than describe all the things I tried that didn’t work, I thought I’d back up and ask how you smart people might approach this issue.
Daniel