setting the invisiblemode for a button

I would like to be able to dynamically set the invisiblemode for a button within a Natural program or subprogram. I can’t seem to find a way of performing this task.

Thanks.

Norm Thornton

In the Button Control (Binding) you can specify a VisibleProp. This you can set to true or false, rendering the button visible or invisible.

Hi Norm, hi Werner,

some hint regarding the invisiblemode property in a field:
This property only defines how the field is rendered in case it’s status is invisible.
But if the control’s status is invisible or not is set via the statusprop property.

This means you can dynamically set a field visible/invisible at runtime via setting the statusprop value of the field.

Best Regards,
Christine

Hi Christine,

I don’t see the property statusprop available for a button in Application Designer. Is there a way of setting this property in my natural application even thought it is not available through Application Designer?

Or are you suggesting that there is a method of making a field, which has a statusprop, appear as a button and set a on-click method?

Thanks for your help.

Norm

Hi Norm,

Sorry, if my answer was confusing.
Werner’s answer was perfectly correct for buttons. I was thinking, once you dynamically make your buttons visible/invisible you might want to do the same for field controls.

For buttons:

  1. set for instance invisibleprop=mydata. In your Natural program set mydata=true/false for visible/invisible
  2. Via the invisiblemode property you can define how an invisible button is rendered.

For fields:

  1. set for instance statusprop=mydata2. In yur Natural program set
    for instance mydata=“INVISIBLE”. For the other values, please check the documentation.
  2. invisiblemode property: same as for buttons.

Best Regards,
Christine

Christine,

According to documentation:
[i]Hiding and Disabling Buttons

Buttons (like many other controls) can be dynamically hidden by using the visibleprop property - and referencing to a server side property that decides whether to hide a button or not.

There are two modes of hiding that can be controlled by using the property invisiblemode:

*  If set to "disabled", the button is grayed and is not selectable anymore.
*  If set to "invisible", the button is hidden.

[/i]

However, I don’t see how to reference the property invisiblemode. I have been able to use the visible property on buttons with limited success in the past. I would just like to be able to disable a button until a user has entered certain information for example and the documentation leads me to believe that this is possible using the invisiblemode property.

Thanks!

Norm

Hi Norm,

Yes, sure, what you want to do is supported.

In the Layout-Painter Editor set the properties for your button:

visibleprop="thevisibleprop"
invisiblemode="invisible"

or, if you just would like your button to be rendered “disabled”:

visibleprop="thevisibleprop"
invisiblemode="disabled"

In your Natural Code initially hide your button. Initialize it before the DECIDE-loop.


THEVISIBLEPROP:=FALSE

DECIDE ON FIRST *PAGE-EVENT
...

Dynamically show/hide your button based on events in your application:


DECIDE ON FIRST *PAGE-EVENT
...
  VALUE U'myEvent1'
  THEVISIBLEPROP:=FALSE
  PROCESS PAGE UPDATE FULL

  VALUE U'myEvent2'
  THEVISIBLEPROP:=TRUE
  PROCESS PAGE UPDATE FULL
...

This works perfectly.

Best Regards,
Christine

Hi Christine,

Sorry for being so dense, but I’m missing something here. In the layout painter, I seem to be able to only set the invisiblemode to a value not a variable. If this is the case, I don’t see how in my natural code that I can change the value of this button property.

If I place this code in my natural program:
invisiblemode=“invisible”

I get the following error when I attempt to stow the program.
NAT0285 Field reference error; reference invalid or missing.
VVVVVVVVVVVVV
0370 invisiblemode=“invisible”

What am I missing?

Again thanks for the help. I really appreciate it.

Norm

Hi Norm,

invisiblemode

is a design-time property. You simply set the value in Layout Painter. Not in your Natural program. No Natural data is generated for this.

You only set the visibleprop from within your Natural program to “TRUE” or “FALSE” as shown in the example above. That’s all you have to do.

Best Regards,
Christine