Hi Terry,
On Aug 29, 2006, at 4:00 PM, Terry Ford wrote:
Perhaps you could describe, both in general and in detail, what you
are trying to accomplish. You have many misconceptions of what you
can or cannot do in REALbasic.
My apologies if I have not been effective in describing what I am
trying to accomplish. And I also apologize for my ignorance of what
REALbasic can and cannot do.
As I stated earlier, I am attempting to make a sub-class of Rectangle
Control (RC) that can be resized and relocated. This I have achieved,
thanks to some inital guidance from Charles Yeomans.
As this project has a window with three such ResizeRelocRect (RRR)
items in it, I thought it a good idea to have a StaticText (ST) label
in each of them so that if the end-user relocated these objects in
the window, they could readily tell which object was which, without
having to place the cursor over them, one at a time, in order to see
the helptag.
Initially, I had set an ST object in each of the RRR objects. This
looked good, but when the RRR was resized down, the ST disappeared,
as in it was truncated pixel-by-pixel until it was no longer visible.
I made a mention of this on the listserv but no one replied on how to
overcome the problem. So I figured there was no solution along those
lines.
Therefore I went after it from another perspective. I decided to try
it by making the ST label for each RRR something built into the RRR.
In order to accomplish that I made a property in the RRR sub-class of
an ST. I figured I could create the ST and set its properties on-the-
fly. However, after doing all of the set-up and such the ST items do
not appear in the RRR when the window is displayed.
You present problems without a valid code base to work on. This
make it difficult for anyone to answer your questions accurately.
Where do you want me to send the project?
We can fix up faulty code, provide direction as to other options or
suggest other courses of action. What we cannot do is to decipher
snippets of code that really do not make sense without a concept of
what you are trying to accomplish.
Your answers below really don't help much.
I really don't mean to sound negative but you haven't provided much
to work with so far. Believe it or not, there really are solutions
to your current problem and all of us would like to help if we
could understand a few more things. :)
I'm certain there are solutions. And my vast ignorance will
eventually be overcome with knowledge. With time and patience.
It may be that I'll have to go back to trying it the previous way.
PS. You can only close existing controls and you cannot create one
from a property of another control.
This seems to me like a thing that the next major release of RB
should permit, if it doesn't already. It seems to me that it would be
a highly desirable capability.
Regards,
Chuck Pelto
On Aug 29, 2006, at 7:16 AM, Chuck Pelto wrote:
Hi Jack,
On Aug 29, 2006, at 4:43 AM, CV wrote:
On Aug 29, 2006, at 2:36 AM, Chuck Pelto wrote:
Greetings All,
Managed to get the static text (ST) addressing sorted out. A
faux pas on my part.
Got an interesting thing going on now with the embedding.
As mentioned earlier, the ST is embedded in a rectangle control
(RC), which is a modified version of a regular rectangle
control, i.e., a sub-class of Rectangle Control.
Maybe I'm going about the embedding wrong. I've set the ST up as
a property of the RC.
I've got three such RCs appearing in a window.
During the OPEN process each RC has the ST associated with it is
declared and properties thereof set, including the text that is
to be displayed.
However, when I look at the window, only the first of the three
RCs is showing an ST and THAT ST has the text of the last of the
three RCs in it.
So, if I'm fouled up in my understanding of how to embed an ST
object in another control object, e.g., an RC, where can I find
information on how to do that properly?
The term 'embedding' is not appropriate. Based on your posts, you
either want the rectangle to be the parent of the statictext or
you want the rectangle subclass to have a statictext control in
the sense of composition or perhaps both.
Thanks for correcting my improper terminology.
If you want a rectangle control to be the parent of a statictext
control: In this relationship, both controls belong to the
window. To achieve the parent-child relationship, drag your
rectangle control onto the window, then drag the static text
control within the rectangle control. When properly done, when
you select the statictext the border of the rectangle will
highlight in red. This means that the rectangle is the container,
ie., the parent of the statictext. This relationship sets certain
links between the controls as described in the User's Guide
relating to disabling and movement.
I was trying it this way, but had problems with the text being
truncated into non-existence when the rectangle control (RC) was
sized down-ward.
On the other hand, the approach that you describe suggests
something else. You may want a composition structure in which the
rectangle subclass "has a" statictext control as a property. In
this case, give your rectangle subclass a property, say
MyStaticText as statictext. You can now write code in the
subclass which references MyStaticText. To make it work, drag
your subclass onto a window and drag a StaticText1 onto the
window. In the open event of the rectangle control put:
If StaticText1 <> nil then
MyStaticText = self.StaticText1
End
I'm trying it this way, in the hope that I can better control the
StaticText (ST) to prevent it disappearing.
I figured out why the only ST showing up placed the verbiage of
the last RC in the first RC. An arbitrary ST I had put into the
box to gauge how large it was going to be was still in the system.
I eliminated it and now NO ST is showing up in any RC upon opening.
I take it, from your explanation, that I STILL need to put an ST
object into each of the RCs in the window's layout view of the RB
IDE? I thought I could create such things on the fly.
Here's the code I was using.....
// create new static text for label in rectangle
stID = new StaticText // where stID is a StaticText property of
the RC sub-class titled ResizeRelocRect
// set properties
stID.Text = labelText // where labelText is arbitrarily set for
each of the three RCs
stID.Height = 20
stID.Width = 220
stID.TextAlign = 1 // center alignment
Later after a calculation to determine proper placement of the ST
in the RC for centering, there is....
stID.Top = topY
stID.Left = leftX
stID.Enabled = true
stID.Visible = true
But nothing is showing up.
_______________________________________________
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>
_______________________________________________
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>