Approach User Support homepage Approach User Support
Answers to Frequently Asked Questions about Lotus Approach
Examples LotusScripts
Example databases
Links to other Lotus Approach support services

[Return to contents]

Conditionally display a pushbutton

Last updated: before December, 1998

'The purpose of this script is to allow a pushbutton to be visible when data
'changes in certain fields. In my form the pushbutton is invisible when the
'form is switched to. When data in fields with script attached changes, the
'push button unhides. The pushbutton is clicked and both script and macro run.
'The script attached to the pushbutton, hides the push button again. The macro
'does its actions at the same time.  The idea for this came from the manual
'Approach96, Using LotusScript in Approach page 5-7.
'The purpose of this script is to allow a pushbutton to be visible when data
'changes in certain fields. In my form the pushbutton is invisible when the
'form is switched to. When data in fields with script attached changes, the
'push button unhides. The pushbutton is clicked and both script and macro run.
'The script attached to the pushbutton, hides the push button again. The macro
'does its actions at the same time.  The idea for this came from the manual
'Approach96, Using LotusScript in Approach page 5-7.
'
'Open the script editor and choose Menu...New Sub (F3). Type, MakeInvisible,
'click, Make global sub and OK. In the Script Editor, finish this entry.
Sub MakeInvisible (dis As Display)
        dis.Visible = False
End Sub
'Repeat the process for the next global sub, MakeVisible
Sub MakeVisible(dis As Display)
        dis.Visible=True
End Sub
'These two are your global subs you will call from another script.
'
'Next, on any form you have that has a pushbutton, go to design, properties,
'click on the button and note its object name. Return to the script editor and
'using the object dropdown box, toggle to the correct form, then object. Use
'the Script dropdown box and choose click. The complete the following
Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)
        Dim dis As Display
        Set dis=Source.ObjButton
        MakeInvisible  dis
End Sub
'All thats left is choosing which field(s) you want to monitor. Again in the
'object dropdown, find the object(typically your fieldname), choose change and
'complete the following. Do this for as many fields as you want to cover.
Sub Change(Source As Fieldbox)
        Dim dis As Display
        Set dis=Source.ObjButton
        MakeVisible dis
End Sub
'The lines with Source.ObjButton should read Source.YourButtonName where
'YourButtonName is the objectname you noted earlier for your pushbutton.
'
'What happens? You are passing the argument dis to the sub MakeVisible or
'MakeInvisible and the sub processes the request. Try substituting a fieldbox
'object or any other display class object instaed of the pushbutton and let me
'know how it works.
'
'Written by Jerry Sikes <Unisource Converting>, 1996
'(C) Copyright 1996 by Jerry Sikes
'
'Permission is granted to freely copy this script in electronic form,
'or to print for personal use. It may be use in any Approach database,
'but may not be distributed for profit either by itself or as part of
'a collection or database.
'
'Disclaimer: This script is provided as is without any express or
'implied warranties. The author assumes no responsibility for errors or
'omissions, or for damages resulting from the use of the information contained
'herein, or your own version containing your desires for the usage of the
'script.'
'Open the script editor and choose Menu...New Sub (F3). Type, MakeInvisible,
'click, Make global sub and OK. In the Script Editor, finish this entry.
Sub MakeInvisible (dis As Display)
        dis.Visible = False
End Sub
'Repeat the process for the next global sub, MakeVisible
Sub MakeVisible(dis As Display)
        dis.Visible=True
End Sub
'These two are your global subs you will call from another script.
'
'Next, on any form you have that has a pushbutton, go to design, properties,
'click on the button and note its object name. Return to the script editor and
'using the object dropdown box, toggle to the correct form, then object. Use
'the Script dropdown box and choose click. The complete the following
Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)
        Dim dis As Display
        Set dis=Source.ObjButton
        MakeInvisible  dis
End Sub
'All thats left is choosing which field(s) you want to monitor. Again in the
'object dropdown, find the object(typically your fieldname), choose change and
'complete the following. Do this for as many fields as you want to cover.
Sub Change(Source As Fieldbox)
        Dim dis As Display
        Set dis=Source.ObjButton
        MakeVisible dis
End Sub
'The lines with Source.ObjButton should read Source.YourButtonName where
'YourButtonName is the objectname you noted earlier for your pushbutton.
'
'What happens? You are passing the argument dis to the sub MakeVisible or
'MakeInvisible and the sub processes the request. Try substituting a fieldbox
'object or any other display class object instaed of the pushbutton and let me
'know how it works.
'
'Written by Jerry Sikes <Unisource Converting>, 1996
'(C) Copyright 1996 by Jerry Sikes
'
'Permission is granted to freely copy this script in electronic form,
'or to print for personal use. It may be use in any Approach database,
'but may not be distributed for profit either by itself or as part of
'a collection or database.
'
'Disclaimer: This script is provided as is without any express or
'implied warranties. The author assumes no responsibility for errors or
'omissions, or for damages resulting from the use of the information contained
'herein, or your own version containing your desires for the usage of the
'script.

[Return to contents]

© Copyright, JohnBrown, Trademarks, Disclaimer, Acknowledgements.