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.

Regards,

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>

Reply via email to