realbasic-nug
[Top] [All Lists]

Method Overloading Best Practices (StaticText and '&' followup)

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Method Overloading Best Practices (StaticText and '&' followup)
From: David Glass <dglass at graymattercomputing dot com>
Date: Fri, 30 Sep 2005 21:02:55 -0700
Delivered-to: realbasic-nug at lists dot realsoftware dot com
OK, I now have two methods that handle my ampersands, one for statictexts and one for popupmenus. I've overloaded them like so:

sub EscapeText(Extend stStaticText as StaticText, strInboundText as String) sub EscapeText(Extend pmPopupMenu as PopupMenu , strInboundText as String)

both of these do a 'replaceall(strInboundText, "&", "&&")'

Now, since the popupmenu's text is actually going to be double-amped, I need a way to clean the text before putting it an editfield for later use (some display, but mostly saving to a DB) after a menu item has been selected.

My initial thought is to overload EscapeText one more time like this:

sub EscapeText(Extend efEditField as EditField, strInboundText as String)
  efEditField.Text = replaceAll(strInboundText, "&&", "&")
end sub

But I am concerned that I would then have a method called EscapeText that does the exact opposite of what the other EscapeText methods do. That seems wrong to me, even though both versions are escaping text.

Of course, maybe I should just call the EditField version 'CleanText' and be done with it?

--
David Glass - Gray Matter Computing
graymattercomputing.com - corepos.com
559-303-4915

Apple Certified Help Desk Specialist

_______________________________________________
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>
  • Method Overloading Best Practices (StaticText and '&' followup), David Glass <=