How do I hide fields?
How do I hide fields?
I use a lot of virtual fields in my applications. I normally just make them very small and set the background colour and font colour etc to the same as the background color of the form.
I have seen in the samples that your fields simply vanish. How do you do that?
Re:How do I hide fields?
There is now plenty of ways to hide a field and also show, disable it, give it focus or even move it (soon).
The new function that do this (8.0) is SetState().
A derivation in a field that simply say SetState("Objectname",0) will hide the object and SetState("ObjectName",1) will show it again.
The easiest way to do it is simply to add a virtual field to your form (at the beginning) and use it for hiding and showing fields in your form. You can use If() etc .
Let say we have two fields Field1 and Field2 that we want to hide when Field3 is yes.
In the virtual field Manip we write the following derivation:
if (Field3=yes, SetState("Field1",0)+SetState("Field2",0), SetState("Field1",1)+SetState("Field2",1))+SetState("Manip",0)
See how we simply add the functions together and then we add the SetState to hide the manipulator field at the end. Since IF is a function what happens here is that IF statement will be executed and then each added function will be executed.
Another way if you simply always want to hide a field in your form is simply to set hide() on the ValueLoaded event.