naumit
27th April 2011, 18:49
Hi everybody,

I have created a maintain session and now user want me to add a confirm button to it which i will do through the form command set. But i dont how to call it from the script. Can anybody please help me on this.

Thanks in advance.

bdittmar
28th April 2011, 00:35
Hi everybody,

I have created a maintain session and now user want me to add a confirm button to it which i will do through the form command set. But i dont how to call it from the script. Can anybody please help me on this.

Thanks in advance.

Hello,

form.command.is.allowed()
Syntax:

function boolean form.command.is.allowed ()

Description


You can use this hook to define the conditions under which the form command should become enabled in the UI. The 4GL engine will use this hooks to determine whether the form command must be enabled or disabled.


Return values

The hook should return TRUE in case the form command is allowed. In that case the 4GL engine will enable the form command on the UI. In any other case the hook should return FALSE.

Context

This function can be used in all script types.

When called

Form commands are handled based on the Command Availability setting in the Form Commands session (ttadv3118s000):

Command Availability Always
The disabling of these form commands may depend on the values of the view fields. Therefore, these form commands are handled only when the session has view fields (form type 3). This applies to both overview and details sessions. The 4GL engine handles these commands just before the read.view sub-event of the main.table.io event section is executed.
Command Availability One Record Selected and Records Selected
In overview sessions these form commands are handled when one or more records are marked. The 4GL engine handles these commands just before the after.choice sub-event of the choice.mark.occur event section is executed.In details sessions these commands are handled when the occurrence is being displayed again. This is just before the before.display.object event section is executed.
Command Availability Never
These commands are never handled.
See standard.command.is.allowed() for more information regarding the event sections, and the type of commands that are handled when these events are executed.

Notes
The 4GL engine will also use the DAL business.method.is.allowed() hook to determine whether the form commands must be enabled or disabled.
First, the UI hook will be called. If this returns FALSE, the command will be disabled, if it returns TRUE (or if it does not exist), the DAL business.method.is.allowed() hook will be called. If this returns FALSE, the command will be disabled, else it will be enabled.
Example

function extern boolean address.fmfoc200.sfad.is.allowed()
{
if isspace(fmfoc200.sfad) then
return(false)
endif

return(true)
}


Regards