On Jun 3, 2006, at 11:22 AM, Norman Palardy wrote:

Note that this is an excellent example of a situation where a Class Interface will let you treat either the canvas, or the container it is in, as the same kind of thing. This means: define a class interface with your GetText and SetText operations, and assign the class interface to both the container and canvas class. Now, you can declare a variable to be of the type of the class interface, and use it to access either.

That's a thought...

But how would that apply? The container control isn't really getting any variables set - it is just passing the variables through to the canvas, so I really don't want to treat them the same. Or do I?

I could see where for example, you had a list of items (array) that you wanted to be able to populate either a listbox or popuplist with. You define the class interface with governing functions to populate the control depending on its type -> if control isA Listbox then.... etc

I am a total newb as far a class interfaces go - I have rarely used them, except in the above example.

You really probably want the container control to act like it is the one and only thing you deal with ad not necessarily expose it's guts to you. Or you could have a method in your container that returned a reference to any the embedded controls so you could deal with them directly.

Personally I'd make the container act like it is the whole control that I deal with and add appropriate methods to it.

I've got an entire RTF editor as a container control I'm working on using Alfred's WordGuise plugin and it's literally drag and drop it into a project and add it to a window and you're 99% done. add implementations for the actions to load and save a document and that's it

I should have been clearer: there's a good chance you won't need to use a class interface. But, for example, if you have low-level generic code, which sometimes you're using inside the container control, and sometimes outside, it will greatly simplify your code to use a class interface. So I just wanted to point out the possibility.

Guyren G Howe
guyren-at-relevantlogic.com
http://relevantlogic.com

REALbasic, PHP, Python programming
PostgreSQL, MySQL database design and consulting
Technical writing and training


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to