gettingstarted
[Top] [All Lists]

Re: Sublcassing Interface Classes?

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Sublcassing Interface Classes?
From: Charles Ross <chivalry at mac dot com>
Date: Sun, 27 Nov 2005 13:16:10 -0800
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <BB85D010-3BDB-4DE4-8DC2-5D953986FB7D at mac dot com> <90088af9524ed6dc27172f9da53532cf at declareSub dot com>
Charles,

On Nov 27, 2005, at 8:50 AM, Charles Yeomans wrote:

Define a subclass of EditField that implements the GotFocus event handler as follows.

Sub GotFocus()
  me.SelStart = 0
  me.SelLength = Len(me.Text)
  GotFocus
End Sub

You'll need to declare a new event GotFocus in the subclass to call it in the code above, thus exposing a GotFocus event in subclasses (like when you drop your EditField subclass on a window).

I understand how to subclass EditField and use my subclass to change the behavior of edit fields that I add directly to a window, but what about edit fields that are included as part of another class, like the ListBox? I want the edit fields within a ListBox object to have this behavior also. Is it possible to do this while by subclassing EditField and yet also not duplicate code (once for the subclass, once for edit fields that are included as part of other classes)?

For instance, if I create a subclass of EditField called MLEditField, can I then create a subclass of ListBox called MLListBox and somehow define that any edit fields within an MLListBox should use MLEditField and not EditField?

Thanks,
Chuck Ross
_______________________________________________
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>

<Prev in Thread] Current Thread [Next in Thread>