RE: Enable/Disable Field in 4gl code

"David Snyder" <[email protected]>
Newsgroups gmane.comp.lang.4gl.fourjs.user
Message-ID <[email protected]>
Savvas, I believe this is what you are trying to do...

Naturally, you can call the changeIt() function whenever you want,
including within an AFTER FIELD clause of an INPUT statement.

First the form...
---------------------------------------------------------
DATABASE FORMONLY
 
LAYOUT(TEXT="ZZTMP Sample")
 GROUP(TEXT="ZZTMP")
  VBOX
   GRID
{
 
[x001  ]
[x002  ]
[x003  ]
 
}
   END --Grid
  END --Vbox
 END --Group
END --Layout
 
ATTRIBUTES
x001 = FORMONLY.fieldOne;
x002 = FORMONLY.fieldTwo;
x003 = FORMONLY.fieldThree;
END
---------------------------------------------------------

Now the 4GL...
---------------------------------------------------------
DEFINE  fieldOne   INTEGER
DEFINE  fieldTwo   INTEGER
DEFINE  fieldThree INTEGER
DEFINE  myNoEntry  CHAR(1)
 
 
MAIN
    DEFER INTERRUPT
    OPTIONS INPUT WRAP
 
    LET myNoEntry = "0"
 
    OPEN FORM zztmp FROM "zztmp"
    DISPLAY FORM zztmp
 
    MENU "OPTIONS"
        COMMAND "Change It" ""
            CALL changeField()
        COMMAND "Input" ""
            CALL inputData()
        COMMAND KEY (INTERRUPT)
            EXIT MENU
    END MENU
    CLOSE FORM zztmp
END MAIN
 
 
FUNCTION changeField()
    DEFINE  myRootNode om.DomNode
    DEFINE  myItemNode om.DomNode
    DEFINE  myNodeList om.NodeList
    DEFINE  i INTEGER
 
    CASE myNoEntry
      WHEN "0"
        LET myNoEntry = "1"
      WHEN "1"
        LET myNoEntry = "0"
    END CASE
 
    LET myRootNode = ui.Interface.getRootNode()
 
    LET myNodeList = myRootNode.selectByTagName("FormField")
    FOR i = 1 TO myNodeList.getLength()
        LET myItemNode = myNodeList.item(i)
        IF myItemNode.getAttribute("name") = "formonly.fieldone" THEN
            CALL myItemNode.setAttribute("noEntry", myNoEntry)
        END IF
    END FOR
END FUNCTION
 
 
FUNCTION inputData()
    INPUT BY NAME fieldOne, fieldTwo, fieldThree
      ON KEY (INTERRUPT)
         EXIT INPUT
    END INPUT
END FUNCTION
---------------------------------------------------------

David A. Snyder
Senior Programmer Analyst
CTM - Currency Technics & Metrics
Office: 302.762.5454 x106
Fax: 302.762.7890
[email protected]


-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Savvas Petrou
Sent: Monday, January 10, 2005 2:20 AM
To: [email protected]
Subject: Re: [fourjs-users] Enable/Disable Field in 4gl code

Everett,

Thanks for your reply!

I believe i have stated my question wrongly.

Firstly is there a built in function that allows a certain field to be
disabled or enabled?
I am guessing setfgl_field_attribute(..,..,..,ENABLE OR DISABLE).

Secondly, the field i want to disable firstly the user is allowed to
input
data.
After the user inputs data some validation checkes are performed and if
valid then the cursor moves to the next field. And now i want to disable
the
field
so the user is not allowed to change the value of the field.

Thanks
Savvas Petrou




----- Original Message ----- 
From: "Everett Mills" <[email protected]>
To: <[email protected]>
Sent: Friday, January 07, 2005 5:06 PM
Subject: RE: [fourjs-users] Enable/Disable Field in 4gl code


Savvas,

When you want the field to be disabled, try this:

    LET field_flag = -1 --this will disable the field, leave it null and
the
field will be useable

    INPUT foo FROM bar.*
        BEFORE FIELD myfield
            IF ( field_flag = -1 ) THEN
                DISPLAY myvariable TO myfield
                NEXT FIELD myotherfield
            END IF

    END INPUT


    --EEM





-----Original Message-----
From: Savvas Petrou [mailto:[email protected]]
Sent: Friday, January 07, 2005 6:03 AM
To: [email protected]
Subject: [fourjs-users] Enable/Disable Field in 4gl code

Dear Sirs,

I would like to know how to disable or enable a certain field
exclusively in
my 4gl code.

I have tried the following in my AFTER FIELD clause

DISPLAY myvariable TO myformvariable
Then i have tried to set ATTRIBUTE(NOENTRY) to myformvariable
but with no success.


Thanks
Savvas Petrou
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.