Developing Reusable Browses




This document explains a generic way to run a reusable browse and return a value.

This can be used both:

For this example, we’ll call: If both frames are in the same app, they should both have "Visible at startup" set to false. This way, the ‘fMain’ frame does not appear when another app runs the browse in this app.

When the app is run from a menu, the menu program should use "invokeTaskList(‘Caller’, ‘TLInit’)", where the "TLInit" task list sets the fMain frame visible. If the menu invokes this tasklist, then Caller.TLInit would NOT be in the "Startup tasklist" field on Caller’s root properties screen, since ‘fMain’ would be made visible explicitly when invoked by the menu.

Tasklists in ‘Caller’ app:

a. ‘TLRunBrowse’: to run the browse (when user clicks ‘Browse’ button):
1. Browse.hCallingApp.displayText(‘Caller’) [use the app’s own name]

2. Browse.hCallingTL.displayText(‘TLPullBrowseSelection’)

3. (optional) Caller.fMain.setVisible(‘false’), if you want to hide the calling frame while browsing.

4. Browse.fMain.setVisible(‘true’) to just display the browse frame or Caller.invokeTaskList(‘Browse’, ‘TLFreshBrowse’) to display the browse frame and run a host task to populate the browse table.
 

b. ‘TLPullBrowseSelection’: invoked from Browse when a value is selected:
  1. Caller.<textfield>.displayText(Browse.tblBrowse.getColumnDataFromSelectedRow(column#) ) For example, get a customer number from column 1 of the selected row in the browse table and display it in a text field in the calling app.

2. Nest ‘TLMainVisible’ to make sure the calling app frame is visible.

3. Optionally, do a host task (like ‘TLGet’) that uses this retrieved browse value to get and display related DB values.
 

c. ‘TLMainVisible’: invoked from Browse when ‘Cancel’ is clicked:
  1. Caller.fMain.setVisible(‘true’) d. ‘TLInit’: initializes the app.
  1. Caller.fMain.setVisible(‘true’)

2. any other stuff the init needs to do (like status msg ‘welcome’)
 
 

Tasklists in ‘Browse’ app, linked to user select/cancel actions:
 
a. <none>:
If user closes the browse by clicking the "X" box in the upper right corner of the frame, we cannot currently trap this, so the browse is made nonvisible and nothing else happens.


b. ‘TLBrowseCancel’: User clicks "Cancel" on browse list or specs tabs.
 

This changes the tasklist invoked back in the calling app, to just make its frame visible, without retrieving a value from the browse.

1. Browse.hCallingTL.displayText(‘TLMainVisible’)

2. Nest ‘TLBrowseSelect’
 

c. ‘TLBrowseSelect’: User double-clicks a row in the browse or selects a row by single-clicking it, then clicking "Select" button.  
1. Browse.fBrowse.setVisible(‘false’)

2. Browse.invokeTaskList( Browse.hCallingApp.getCurrentValue, Browse.hCallingTL.getCurrentValue )
 

d. ‘TLFreshBrowse’: Resets and clears all browse components, makes frame visible and runs ‘TLBrowseGet’. Useful for browses invoked by other apps, to get a fresh browse each time.  
1. Browse.tblBrowse.removeAllItems

2. Browse.tblBrowse.removeRowSelectionInterval(0, Browse.tblBrowse.getRowCount().

3. Browse.hRowid.displayText(‘ ‘)

4. Browse.hBrowseTopRowid.displayText(‘ ‘)

5. Browse.hBrowseBottomRowid.displayText(‘ ‘)

6. Browse.hBrowseIndexNum.displayText(‘1’)

7. Browse.tabBrowseSpec.setComponentDefaultValues

8. Browse.fBrowse.setVisible(‘true’)

9. nest ‘TLBrowseGet’
 
 

e. ‘TLBrowseGet’: normal host task to get browse data based on specs.



 Up to Top      Return to Help Index

(TLD 1/6/99)