Simplicty and flexibility!


SetState What is the syntax to make a text box show or hide following a Yes/No field


Started by
Search
You will need to Sign In to be able to add or comment on the forum!

SetState What is the syntax to make a text box show or hide following a Yes/No field

Written by 25/11/13 at 19:38:12 Dataease [{8}]FIVE

Re:SetState What is the syntax to make a text box show or hide following a Yes/No field

Download Sample

SetState() like all other set functions are manipulation functions. As all manipulation functions, it doesn`t return anything "meaningful" it does something meaningful.

This is a new way of thinking in DataEase so bear with us when the concept sink in ;-)

One of the strengths of DataEase is the virtual fields, which are derrived upon change in dependent fields and this is what we use to trigger actions.

We use and recommend the use of virtual fields as programming "aid" strongly and is one of the things we will promote a lot in educating people in using DE8.

It might be a little "messy", but is very "DataEasy" where the aim is to get a flexible and quick result rather than a beautiful code from a programmers viewpoint.

In the attached example we show how you can resolve your question.

In the virtual field manipulator we have the following derivation:

if (Do you want to show the other fields? not=yes, SetState("Name",0)+SetState("Address",0),SetState("Name",1)+SetState("Address",1))+SetState("Manipulator",0)


What we do here is simply using the manipulator function SetState in a boolean way.

Since the Yes/no field will be no in a new form we automatically hide the fields when opening it (you wont see them at all), when the check box is triggered to yes the virtual field is automatically triggered as a dependent field and the fields are automatically shown.

You see that we can trigger several SetStates by simply adding them together (that is the beauty of functions) and you allso see that we have added a SetState to hide the manipulator field itself to the end of the if function. Since this SetState is not conditional it will always be triggered i.e. the Manipulator field will always be hidden.

The next question is then Focus. When showing fields they won`t automatically get focus, so if we want that we can simply add SetFocus("Name") to the if statement

if (Do you want to show the other fields? not=yes, SetState("Name",0)+SetState("Address",0),SetState("Name",1)+SetState("Address",1)+SetFocus("Name"))+SetState("Manipulator",0)

And we will get focus in the right field.

You also see that we use placeholders in the fields here to avoid having to use Lablels (We could have used labels and hidden them too, but lazyness prevails...).

Placeholders in DE8 is a new feature and is a hack in the Help on fields.


It is very "nifty" when you have variable and smart layout.

We will soon start online "classes" in DE8 functionality where we will discuss the new functionality in detail with examples and ideas.

Follow this space ;-)


Written by DataEase Tech Sup 26/11/13 at 07:30:28 Dataease [{8}]FIVE
DG3_ForumList