Joseph,
Thanks very much for all the input! Not only do I not mind, I very
much appreciate it.
If you have this in two different windows, it'd be better to move
it into a module as a global or public method. But better still
would probably be to make a Listbox subclass that just does this in
its CellBackgroundPaint event.
Once I learned a bit more, that's exactly what I ended up doing. My
software now has an MLListBox and I've edited its CellBackgroundPaint
event to handle the alternate background.
A couple of things here. First, there's no point in using a
computed property here because you're not computing anything, nor
is there any setter. You could just use an ordinary method for
things like that (remember, methods and read-only properties are
exactly equivalent in REALbasic). But even better would be to use
a color constant; that's what they're for.
Even though I've been to the constants screen a number of times, I
had never noticed that a constant could be a color, and I had had so
many problems trying to get an array property, I used the computed
property instead. I'll use a constant color now.
Don't forget to return True or False here, depending on whether you
want this to override any normal background drawing.
I saw that in the documentation that it's supposed to return a
Boolean, but I don't know what that return value means. The
documentation says:
True means the user has handled the background paint and no other
processing is to be done with the background. In this case the user
is responsible for all highlighting. False means the user wants
REALbasic to help paint the background. REALbasic will overwrite
your drawing on the row that needs to be highlighted. REALbasic
will attempt to highlight the row or column as appropriate
(according to the platform and the hierarchical style).
I don't know what this means, and not returning anything seemed to
work, so since I didn't know what to return, I assumed that some
default value was being used that was correct and I didn't want to
change it. I'll say this: Once I've set the background color, nothing
else needs to be done with the background. Does that mean I should
return True? I've considered a different instance, where I would want
a push button to appear within a row. In that case, would I then
return False because something else needs to draw the button perhaps?
Probably because you were trying to implement it in two places at
once -- you can't do that. You'd have to delete the
CellBackgroundPaint implementation in each of the listboxes on the
various windows, when you change them to your listbox subclass
that's already implemented this event.
I figured this one out.
EditField already has a SelectAll method, so I don't think you need
this method.
It does? I can't find this in the documentation, which is why I
created my own. I checked the methods for EditField as well as all of
its superclasses. Typing editfield.selectall in the location field of
the documentation window brings up nothing, but I did create a quick
project with two edit fields and entered me.SelectAll in the GotFocus
event for both of them and it worked, but I missed this because of
the lack of documentation. Or am I looking in the wrong place?
Joe, you have no idea how much I appreciate your comments. Thanks again.
Chuck
_______________________________________________
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>
|