How to Control the Update Buttons of the Browse Box template

Top  Previous  Next

Using the Application Generator, applications frequently use the Browse Box template. Another control template, the BrowseUpdateButtons control template, is used to call an appropriate update procedure from the Browse Box.

In the ABC template set, these templates use the BrowseClass to manage the state of these buttons. For example, you would only want the Insert button to be enabled if there were no records displayed in the list box.

There may be other situations where you need to manually control the state of these buttons and override the Class behavior. The solution to this is to add the following three lines of embedded code in the Init procedure of the target Browse object:

BrwX.InsertControl = 0

BrwX.ChangeControl = 0

BrwX.DeleteControl = 0

Where BrwX is the name of the browse class instance that you are trying to affect. You probably will use this to conditionally grant access to a particular update operation, like the following example:

 

IF User:Access < Rights:Delete !If the user does not have delete clearance

Brw1.DeleteControl = 0 !Override class control

DISABLE(?DeleteButton)

END