method pushButton(var eventInfo Event)
var
astrNames Array[] String
pmFilter,
pmFields PopupMenu
siCounter SmallInt
strChoice String
uiMaster UIObject
endVar
const
DROPFILTER = "&Drop Filter"
endConst
;// Attach uiMaster to object bound to
;// form's master table.
uiMaster.attach( "Customer" )
uiMaster.enumFieldNames( astrNames )
;// create popup menu for field names
for siCounter from 1 to astrNames.size()
pmFields.addText( astrNames[ siCounter ] )
endFor
;// create and display popup menu for button
pmFilter.addPopup( "&Filter On", pmFields )
pmFilter.addSeparator()
pmFilter.addText( DROPFILTER )
strChoice = ""
strChoice = pmFilter.show()
;// evaluate user's choice
switch
case strChoice = "" :
;// do nothing, as user cancelled menu.
case strChoice = DROPFILTER :
uiMaster.dropGenFilter()
uiMaster.setRange()
otherwise : ; check for valid fieldname to filter on
if astrNames.contains( strChoice ) then
uiMaster.attach( uiMaster.FirstRow )
uiMaster.enumObjectNames( astrNames )
for siCounter from 2 to astrNames.size()
uiMaster.attach( astrNames[ siCounter ] )
if uiMaster.FieldName = strChoice then
strChoice = astrNames[ siCounter ]
uiMaster.MoveTo()
uiMaster.menuAction( menuFieldFilter )
quitLoop
endIf
endFor
else
msgStop( "Unhandled Menu Command",
"I don't know how to handle the \"" +
strChoice + "\" command. Please " +
"contact support." )
endIf
endSwitch
endMethod