Consultor Eletrônico



Kbase 16260: How to get SmartNavBrowser/SmartNavPanel to work correctly
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
How to get SmartNavBrowser/SmartNavPanel to work correctly

This Knowledge Base entry describes the necessary changes to
make to the Combined SmartObject, described in the User
Interface Builder Developer's Guide from pages 13-15 through
13-23, work correctly in combination with a SmartNavigation-
Panel. The references to code lines are based on ADM version
1.0 (Progress version 8.0A02) and might require different
changes when applied to future releases of the ADM code.

The target setup for the procedure is as follows:

A SmartWindow containing the new SmartNavigationBrowser with
basic information on a table, a SmartNavigationPanel and a
SmartViewer with more detailed information on the table involved.
The links between the SmartObjects are: Record link between
the SmartNavigationBrowser and the SmartViewer, Navigation link
between the SmartNavigationPanel and the SmartNavigationBrowser.

When you run this procedure the buttons on the SmartNavigation-
Panel will reflect the right state (first, last or not-first-or-
last) in the SmartNavigationBrowser. In addition, both the Smart-
Viewer and SmartBrowser reflect the same record, when you use
only the navigation buttons.

Below is a description in four steps to accomplish this.


First
=====

Make a new Structured Include file from the existing file
"browser.i" from directory "%DLC%/src/adm/method". Press the
Procedure button on the UIB Main Window and press the Method
Libraries button. Change the list of included Method Libraries
to read:

{src/adm/method/smart.i}
{src/adm/method/tableio.i}
{src/adm/method/query.i}
{src/adm/method/record.i}

Save this off with the name "navbrows.i" in your local
"src/adm/method" directory.


Second
======

In the template for the SmartNavigationBrowser ("navbrows.w") that
you have built from the description in the User Interface Builder
Developer's Guide change the following:

- Remove every original entry and replace them by a reference to the
"navbrows.i" you have created in the previous step.


Third
=====

Copy the original "query.i" from the "%DLC%/src/adm/method"
directory to your local "src/adm/method" directory.

Change and add the following:

In the ADM event procedure "adm-get-last":
-----------------------------------------

Between the lines "q-stat = browser-handle:SELECT-FOCUSED-ROW()."
and "RUN new-state ('last-record')"
add:

IF NUM-ENTRIES("{&TABLES-IN-QUERY-{&BROWSE-NAME}}":U," ":U) = 1 THEN
ASSIGN adm-last-rowid =
ROWID ({&FIRST-TABLE-IN-QUERY-{&BROWSE-NAME}}).
IF adm-last-rowid NE ? AND adm-first-rowid = adm-last-rowid THEN
RUN new-state ('only-record':U). /* Just one rec in dataset */
ELSE


In the ADM event procedure "adm-get-next":
-----------------------------------------
Between the lines "q-stat = browser-handle:SELECT-NEXT-ROW()."
and "END."
add:

IF q-stat THEN DO:
RUN dispatch IN THIS-PROCEDURE ('row-changed':U).
IF adm-last-rowid = ROWID({&FIRST-TABLE-IN-QUERY-{&BROWSE-NAME}})
THEN RUN new-state ('last-record':U).
ELSE
RUN new-state ('not-first-or-last').
END.
ELSE
RUN new-state ('last-record').


In the ADM event procedure "adm-get-prev":
-----------------------------------------

Between the lines "q-stat = browser-handle:SELECT-PREV-ROW()."
and "END."
add:

IF q-stat THEN DO:
RUN dispatch IN THIS-PROCEDURE ('row-changed':U) .
IF adm-first-rowid = ROWID({&FIRST-TABLE-IN-QUERY-{&BROWSE-NAME}})
THEN RUN new-state ('first-record':U).
ELSE
RUN new-state ('not-first-or-last').
END.
ELSE
RUN new-state ('first-record').


Fourth:
======

Copy the original "record.i" from the "%DLC%/src/adm/method"
directory to your local "src/adm/method" directory.

In the ADM event procedure "adm-open-query":
-------------------------------------------

In the "&ELSEIF DEFINED(adm-browser) NE 0 AND
DEFINED(TABLES-IN-QUERY-{&BROWSE-NAME}) <> 0 &THEN"
section
between the lines "RUN new-state ('no-record-available':U)."
and "&IF "{&EXTERNAL-TABLES}":U NE "":U &THEN"
add:

ELSE
DO:
ASSIGN adm-first-rowid =
IF NUM-ENTRIES("{&TABLES-IN-QUERY-{&BROWSE-NAME}}":U," ":U) = 1
THEN ROWID({&FIRST-TABLE-IN-QUERY-{&BROWSE-NAME}})
ELSE ?. /* can't save rowid for a join */
END.

Now compose a new SmartNavigationBrowser Master file from the
template. Also recompile your existing SmartViewer that is connected
to your SmartNavigationBrowser.

Progress Software Technical Support Note # 16260