Back in Visual dBase days we used regular spinners for dates but here in Fox the spinners do not seem to like dealing with anything but numeric values. I placed three day/time picker controls on two different containers that are supposed to become visible or invisible depending on some buttons being pressed. I am certain the pickers' parents are the containers however when I make the containers invisible (setting .visible to .F.) the pickers stay on like they belong to underlying form or in this case a page on pageframe.
Moreover, if I make another container visible and this container appears on the same page I end up seeing 3 pickers in one container instead of 2 or 1 depending on the container. Pickers from previous container transpire through the second container.
The pickers are initially invisible since the containers are invisible at startup. On top of that they are so invisible that I have to click on them first time when the containers appears to make them visible. However they do not disappear from view together with containers and other controls like buttons and comboboxes on them when the visible property for the container is set to .F.
It is somewhat regretful that I will have to tackle it with some code. Is there any simple fix for this
Thank you.

Day Time Picker little trouble.
John Sudds - MSFT
SetAll makes invisible everything on the container with the exception of the container itself.
Yes. The syntax that I used does. If you read the topic in the on-line help for the SetAll method, you will see that it takes a third (optional) parameter that allows you to apply this only to specific a specific class of objects in the container.
hhhguten
Can I use ResetToDefault() method for this
The reason I am so preoccupied with saving lines of code must be explained. I have to put those statements into many methods because of logical interplay between controls. When I press one of many buttons some containers must disappear and others show up. Saving code lines really pays in making the whole thing more readable.
OrfWare
This question has been anticipated. The thing is they are complicated containers with about 16 controls or more on each and it is a complicated page already with 2 containers on it and a treeview. They are supposed to overlap each other and be visible at different times. Now I have 4 containers and one treeview.
I could not easily design a page like this. What I did: I took a "test form," set up two containers on it, designed every control the way I wanted and COPIED container # 1 and then pasted it onto my page. The same thing was done with container # 2. I had only two operations of copying. All my date/time pickers came with the containers and they are playing the same game at the second form as on the previous one. Isn't it enough to say that they belong to the containers
On top of that I tried to verify the parentage with the properties browser. They are visibly indented on the treeview as belonging to the containers. They are on the same hierarchical level as other controls on this container.
Do I have enough evidence that the pickers belong to the containers
sved
I am certain the pickers' parents are the containers however when I make the containers invisible (setting .visible to .F.) the pickers stay on like they belong to underlying form or in this case a page on pageframe
How do you know that the date and time pickers belong to the container If you click on the data and time picker, can you select it If so, it does not belong to the container. If the control belongs to the container, you need to drill down into the container to select the control by right-clicking and selecting edit from the context sesitive menu.
It is somewhat regretful that I will have to tackle it with some code. Is there any simple fix for this
Yes. Fix whatever is wrong with your form
Hyro
bbeasley
Jason Elliott
As I explained in one of my posts I downloaded 1001 from Amazon.com but soon it became corrupted when I inadventently wiped out most of the settings in my machine. It does not recognize the password anymore. I should contact Amazon for this--just have no time.
Therefore I will remain in the dark with all the painful consequences to follow.
Heather_Hope
AdkMan
Thus my containers are two instances of that class. How can I create "container classes" on top of that
There are couple of ways to do this:
1. In the command window type the following:
CREATE CLASS
MyContainer AS ContainerYou will be prompted for the name of a class library to store the class. Enter it. You can then start visually designing your class in the class designer.
2. Visually create your class using a form as your container and drop the appropriate objects on to it. When you have everything the way you want it, select all the object that you want in the container and select "Save as Class" from the file menu.
raymuirhead
Thank you. It makes sense. I do have a question however. This offer to create container classes rings a bell. I think you suggested something similar to me in the past--it was related to using two forms in coordination but I am not sure. Eventually a simple solution was found but it is beyond the point.
Container is a class. I means there is a class: Container. What I do is to instantiate this class and create an object. Thus my containers are two instances of that class. How can I create "container classes" on top of that
I would appreciate if you explained it to me more explicitly preferably with a code sample or a reference to a web page or your books perhaps. I feel there is something here I do not understand and if it is a powerful technique I will definitely adapt it and use it. It is difficult for me to do a deduction from a generality in FoxPro to a practical method I can write as a code. As I've said before, I am not in the theory.
Your post is an eyeopener for me in another way besides the fact that it solves my problem efficiently and thoroughly. I've been wondering what the meaning of this method SetAll was and could not figure out. Now I do understand how I can use it.
Thanks.
Rhodry
Here is the major part. What to do next
I am doing a session at WhilFest next month on "Best Practices for Class Design" which just begins to answer the quesiton you have asked
When should you define a class
One thing that I have noticed over the years is that much of programming is governed by ‘Rules of Three’. Class design is no exception and so here is the first ‘rule of three’ which defines the criteria for deciding that a new (or a new subclass of an existing class) is required:
· Is the object going to be re-used
· Will it ease the management of complexity
· Is it worth the effort
You have a copy of "1001 Things...". If you read Chapter 3, it should give you your answer in more detail.
BattleCattle
SQLHelp
Thank you.
It is enlightening. I followed your instructions as to the method # 1 and ended up creating a container mycontainer which was saved among other classes of the class library _base.
Here is the major part. What to do next How can I benefit from it given the fact that I already have plenty of containers in my form including the two that were the subject of this post Do you want me to redesign all my containers from scratch What would be the benefit of it
My guess is that creating such custom container class makes sense only if I planned to set up a number of containers in the future with many similar controls like date/time pickers or combos. Then I could design a prototype custom container, save it and subsequently use it on different pages perhaps with some local modifications, adding a few controls here and there. Is it why such custom classes are available
I cannot do this for the reason that my design ideas change constantly and there is no overlapping common pattern (intersection) between my containers.
Thanks.
stuartdunkeld
Do I have enough evidence that the pickers belong to the containers Do I have enough evidence that the pickers belong to the containers
OK, I understand now. What the problem here is, is that the date and time picker is an activeX control - that is, it is a true Windows control. Because of that, when you make the VFP container that it is in invisible, it has no effect on the visibility of the activeX control. You need to handle it explicitly like so, whenever you make a container visible, using code like this:
thisform
.MyContainer.SetAll( [Visible], .T. )And code like this whenever you make it invisible:
thisform.MyContainer.SetAll( [Visible], .F. )
The easiest way to do this would have been to create container classes and add an assign method on the container's visible property. Then this code could go in the assign method to set the contained date and time picker's visible property to whatever the container's visible property is. Then, none of your other code would have to change.