Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Philosophical question
Message
 
 
To
30/04/1998 12:39:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00095802
Message ID:
00096084
Views:
26
Sylvia,

>If I had done it before it might not be hard, but right now everything is still, er..a challenge:). Can I ask for some hints on your suggestion (i.e. can I look at your 'class' notes)?

Here's a start I just whipped up, It's the container Init():

if ( this.Height > this.Width )
   * they want us to rearrange to vertical orientation
   * just do a simple transpose of the XY coordinates (works best with "square" controls)
   local oControl, lnWidth, lnHeight, x
   
   lnWidth = 0
   lnHeight = 0
   for each oControl in this.Controls
      x = oControl.Top
      oControl.Top = oControl.Left
      oControl.Left = x
      lnWidth = max( lnWidth, oControl.Left + oControl.Width )
      lnHeight = max( lnHeight, oControl.Top + oControl.Height )
   endfor
   this.Height = lnHeight
   this.Width = lnWidth
endif

But this would be kind of disconcerting to work with inside the designers, because you can't "see" the whole object at design time. So I'd probably really just move that code into a builder and run it against the object inside the designer so that it looked like it would at runtime while you are designing. Builders are basically just code that can manipulate design time objects. There are some examples over on my website.

> On a related matter, you did get me to thinking about the fact that the properties reference other buttons that aren't part of the class, and I realized when building a class, that's probably not a good idea, and really does break the concept of encapsulation.

Yes it does break the encapsulazation, and inhibits the reuse of the component because it depends on things outside of itself. Sometimes breaking encapsulation though it ok, as long as you know why you are doing it and you can live with the consequences. But I wouldn't go so far as to make a component rely on the existence of other specific named objects, that's just too unmanagable. But say for instance your container might delegate the actual Save() operation to thisform.Save() because it really can't know all the rules you might want to enforce for a given form. So you've restricted the use of this component to forms with a Save() method, but if that's something you've designed into your lowest level Form subclass it's not really a big problem, because all of your forms will support that interface because they inherited it.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform