Simplicty and flexibility!


Function::Internal

SetState
SetState("ObjectName",State)
SetState("MyButton",0) -- Hide
SetState(ObjectNameField,StateField)
retval := SetState("MyButtn",4) -- Click Event called. Same as button being clicked by mouse
SetState("MyObjectname","Hide")
SetState("ServiceWindow1","Show") -- will show ServiceWindow1 there is 4 service windows.


SetState is a function that will make it possible to manipulate objects from a derivation/DQL without having to use OML properties. SetState will hide/show, enable and disable.

ClickObject which will remotely call the click event on a button or any other object. Very useful for controlling execution.

System Variables added in 1790.

We will use Setstate to set system variables in DataEase. First addition is Default Printer.

Parameters


ObjectName (String) : 

This is not the same as Column(Field) name. Object name is the name for the object in the GUI model and always need to be "quoted". "MyField", "MyButton" etc.

State (Number, "Number", "State"): This is the function you need to trigger:

"Hide", "0",0 

hide the object.

"Show","1",1 

show the object if it is hidden.

"Disable", "2", 2 

disable the object. A field will be write protected and a button will not be clickable etc. Will not affect OML.

"Enable" , "3", 3

enable the object. Remove write protect and will enable buttons, tab controls etc to be clickable again. Will not affect OML.

"Click", "4", 4 

ClickObject (Call Click Event on any object). If called for a button it will do the action and OML. WIll trigger OML on any object.

"MoveToFront"

Move the Object to front in the view i.e. it will be on top of all other objects. Ex. SetState("MyObject","MoveToFront")

"SendToBack"

Move the Object to Back in the view i.e. it will be behind all other objects. Ex. SetState("MyObject","MoveToBack")

System Version:

We also use SetState() to show ServiceWindows which is the new "toolbars" in DE8.6 onwards. These are 4 browser windows that can be utilised as part of your application as well.

SetState("ServiceWindow1","Show")
SetState("ServiceWindow4","Hide")
SetState("ServiceWIndow3","Refresh") -- refresh/reload content of service window.

Also see MoveObject()

Ex.
MoveObject("ServiceWindow1","L150","") 

Returns/Result


Nothing.

Examples


Reference

SetState() will manipulate ScreenObjects like fields, buttons etc (in practice everything).

format SetState("Object",State) returns empty string so it can be included in any function without interfering with result of formula.

SetState("Field",0) will hide.
SetState("Field",1) will show.

SetState("Field",2) will disable
SetStage("Field",3) will enable.

See Also


SetFocus(), SetValue(), SetStyle(), GetStyle(), GetValue(), SetLabelText()

On the forum about SetState

setstate example

Hi I had a look at the setstate example, and can't make it work? error message (error executing expression:  .............etc)any advice?...

Product: Dataease [{8}]FIVE. Written by Gregor Popp 01/05/13 at 23:15:57

Re:setstate example

Hi again Ion.Absolutely.... Out versioned ;-)Happens to me all the time. DataEase 8 is still in full development and we add new functions and new functionality all the time. In the SetState() sample we use SetLabelText() which was impl...

Product: Dataease [{8}]FIVE. Written by DataEase 8 Development 02/05/13 at 06:59:46

Re:Re:setstate example

works fine with the latest version thank you...

Product: Dataease [{8}]FIVE. Written by Gregor Popp 05/05/13 at 23:43:20

Re:Re:Re:setstate example

Great!We try to use the latest functions in the samples to show them off...but it is not without its "risks".This is one of the main reasons that 8 is on Pre-Release and not release, that it is still being added to.Today we add...

Product: Dataease [{8}]FIVE. Written by DataEase Development 06/05/13 at 07:33:58

SetState Problems working with choice field

Using SetState works perfectly using the following where the field test is a Yes/No fieldif (test = Yes, SetState("Field",3),SetState("Field",0))I can make all the 0,1,2,3 options all work in the above formular.<...

Product: Dataease [{8}]FIVE. Written by Graham Brown 17/07/13 at 17:48:28

Re:SetState Problems working with choice field

Download SampleHi again.1. SetState switch 3 and 0 is not a pair. 0=will hide the field and 3 will enable it, but 3 will not show it.The m...

Product: Dataease [{8}]FIVE. Written by DataEase Tech Support 18/07/13 at 08:21:39

Re:Re:SetState Problems working with choice field

Thank you.In an if statement what is the order for combining:&nbsp;If (setstate("field",0) &amp; Set(colour( ) &nbsp;...

Product: Dataease [{8}]FIVE. Written by Graham Brown 18/07/13 at 14:14:45

Re:Re:Re:SetState Problems working with choice field

The brilliance of functions is that you can call them in any way you like as long as they get triggered ;-)Of new functions in DE8 we try to give no return (empty string) if they are made to "do a job" rather than the normal function stuff of...

Product: Dataease [{8}]FIVE. Written by DataEase Tech Support 18/07/13 at 16:01:49

Re:Re:Re:SetState Problems working with choice field

Hi again Graham.We have problems replying to your emails. We only get the following message after days of retries:This message was created automatically by mail delivery software. A message that you sent could not be deli...

Product: Dataease [{8}]FIVE. Written by DataEase Tech Support 22/07/13 at 13:20:59

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

[@EOF@]...

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

SetState for Text Box

[@EOF@]...

Product: Dataease [{8}]FIVE. Written by Graham Brown 25/11/13 at 19:44:01

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 somethi...

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

SetState() not working for subform and record1

Hi there,I am running the latest version (8.2.0.1700) of dataease and playing around a little with the subform as a dialogue example. The example works as expected, but I have problems making it work on my application. When I use the SetState()...

Product: Dataease [{8}]FIVE. Written by George Washington 15/01/15 at 10:06:33

Re:SetState() not working for subform and record1

It is annoying that you can't name/rename a lot of objects in the DE GUi model.The most annoying is Record or Record1 as it will become.All Records will end up being called Record1 (before first same and reload of an FRM it is called R...

Product: Dataease [{8}]FIVE. Written by DataEase 15/01/15 at 11:06:55

Re:Re:SetState() not working for subform and record1

Thank you DataEase, you saved me again :) . For the records, it was the case thing. Oh, there is still a problem: if I create a derivation with some wrong cases (e.g. record1) and then change the case only, dataease will not actually change the deriva...

Product: Dataease [{8}]FIVE. Written by George Washington 15/01/15 at 12:00:31

Re:Re:Re:SetState() not working for subform and record1

You are of course right. This is the problem with moving from old to new ;-)One of the deep entrenched principles in DataEase was case-insensitivity to such an extent that it permeates both data and programming. With the introduction of Object...

Product: Dataease [{8}]FIVE. Written by DataEase 15/01/15 at 12:33:57

How to make SetState permanent when you get out of form.

SetState("Hide",0)&nbsp;&nbsp;How to make it permanent while getting out of the form, until I change it to&nbsp;Show. ...

Product: Dataease [{8}]FIVE. Written by Ken Roth 24/09/15 at 18:11:48

Re:How to make SetState permanent when you get out of form.

Hallo KEN, what about global variable ? Maybe a solution......Kind regards markus...

Product: Dataease [{8}]FIVE. Written by Markus 24/09/15 at 19:25:42

Re:Re:How to make SetState permanent when you get out of form.

Not really a programmer, can you give me an example of how to hide a cell and how to hide a button even after you leave the form. I'm trying to hide pin#'s without using security as that complicates matters for those without clearance. Also, in the ol...

Product: Dataease [{8}]FIVE. Written by Ken Roth 25/09/15 at 02:45:30

Re:Re:Re:How to make SetState permanent when you get out of form.

Download Sample! Hi, have a little problem with the formulation of your q...

Product: Dataease [{8}]FIVE. Written by DataEase 25/09/15 at 08:42:39

Setstate + CheckBox Field

Hi again,I'm trying to control a CheckBox field ( Yes/No ) named 'Field10',&nbsp;&nbsp;which &nbsp;I want Enable / disable depending &nbsp;of&nbsp;another &nbsp;field ( named 'field1' )&nbsp;in the same form.Below find a copy of statemen...

Product: Dataease [{8}]FIVE. Written by afonso santos 28/01/16 at 00:12:16

Re:Setstate CheckBox Field

Hi Afonso.No it is not you, it is us ;-)Enable/Disable only enable/disable if a field is editable or not at the moment. Buttons does not work and Checkboxes and dropdownds work as a combination of Buttons and Editfields and hence get a mix...

Product: Dataease [{8}]FIVE. Written by DataEase 28/01/16 at 07:01:51

DQL - Setcurrent & Setstate

Dear allCan we use a "manip" field with the set of instructions as follows :setstate ("manip", 0 )+ SetCurrent("WindowBorder","NoEdge")+SetCurrent("WindowClass","Modal")+ SetCurrent("WindowPos","10","80"),in a body of a DQL proced...

Product: Dataease [{8}]FIVE. Written by afonso santos 13/06/16 at 22:44:45

On the blog about SetState

New Function 8 - SetState() - Change the state of a field/button Hide,Show,Enabled,Disabled (Ver. 8.0.0.1152)

In 8 we have decided to put the Easy back into DataEase. It is no secret that things have been a little awkward in DFW, and even though the "old dogs" seem to be able to find their way around, new users are left as question marks. We are not making it a...

Product: Dataease [{8}]FIVE. Written by DataEase 07/11/12 at 12:52:17

DataEase 8 - Small Sample to show off SetState(),SetFocus(),SetColor(),SetLabelText() (Ver. 8.0.0.1281)

This is just a small sample to show off SetState() - &nbsp;Hiding/showing/disabling/enabling of fields/buttons and other GUI objects, SetFocus() - set focus on any field or button etc that you want to have the...

Product: Dataease [{8}]FIVE. Written by DataEase 27/04/13 at 09:17:21

Update Functionality DataEase 8 - SetValue(), SetState(), SetColor(), SetFocus() ObjectNumber Added (Ver 8.0.0.1306)

One challenge that has been present since OML was introduced and one could start to manipulate GUI object directly is to manipulate different Rows/Records in a Subform etc.Record objects in Subforms are clones, and hence don't have their own u...

Product: Dataease [{8}]FIVE. Written by DataEase 18/06/13 at 22:08:56

DataEase 8.2 - Expanded Functionality SetState() - ClickObject added (Ver. 8.2.0.1604)

Download Sample SetState() has been one of the most useful additions to DataEase 8 and we have expanded the scope of it yet again. It already show and hide obje...

Product: Dataease [{8}]FIVE. Written by DataEase 20/08/14 at 16:59:56

DataEase 8.5 - Function Update GetCurrent("@PrinterN") & SetState("@DefaultPrinter","PrinterName") Ver. 8.5.0.1790

Dedicated printing has always been a problem in Windows and particularly in DataEase for Windows.It was simple to direct output to a specified printer for a given report/procedure in DFD but in Windows "user interaction" has been the way, whic...

Product: Dataease [{8}]FIVE. Written by DataEase 05/06/15 at 10:35:09

DataEase 8.5 - New functionality SetState("@PrinterN") added. Set Workstation/Application Printers from app.

Download Sample!To be able to properly control/manage where your output is sent is crucial...

Product: Dataease [{8}]FIVE. Written by DataEase 22/06/15 at 15:31:39

Enable/Disable based on Global variable using SetStyle(),SetState(),SetVar(),GetVar(),MoveObject()

Download Sample! We got a request from a user on how to control the users...

Product: . Written by DataEase 25/09/15 at 08:54:32

DataEase 8.5 - SetState(), SetStyle(), SetColor(), MoveObject() all now support wildcard (Ver. 8.5.0.2001)

New Features create New Demands....SetState(), SetStyle(), SetColor() and MoveObject() are between the most popular and besides ExecDQLClass the most used new features in DataEase 8.We very quickly realised that you needed to be able t...

Product: Dataease [{8}]FIVE. Written by DataEase 01/12/15 at 15:06:26


dg3_HelpView