Question Unable To Scroll Frame Up

jamie_moore

New Member
Hi,

I'm struggling to get my frame which is being displayed to the terminal to scroll up/down. At the moment I can only navigate by pressing space bar/carriage return in which case it moves downwards but then won't let you scroll back up or move around using the arrow keys. Any help would be appreciated.

FOR EACH order.stkadj WHERE
company = iCompany AND
loc-cd = iDepot AND
adj-date >= daStartDate AND
adj-date <= daEndDate,
EACH main.product OF order.stkadj,
EACH main.stock OF main.product:
deCostAdj = cost-price * adj-qty.
iNewStk = old-stk + adj-qty.
DISPLAY /*stkadj.adj-date*/
fwd-loc LABEL "Bin Loc"
catalog-no
prod-name
product.pack
stkadj.prod-code LABEL "Code"
/*stkadj.reason*/
old-stk
adj-qty
iNewStk
/*stkadj.user-id*/
deCostAdj
(TOTAL)
reference WITH SCROLL 5 WIDTH 145 ROW 7 COLUMN 1.
END.
 
Hi,

I'm struggling to get my frame which is being displayed to the terminal to scroll up/down. At the moment I can only navigate by pressing space bar/carriage return in which case it moves downwards but then won't let you scroll back up or move around using the arrow keys. Any help would be appreciated.

....
deCostAdj
(TOTAL)
reference WITH SCROLL 5 WIDTH 145 ROW 7 COLUMN 1.
END.
You need to use BROWSE. It can be static or dynamic. Here a dynamix example Progress KB - Sample Code to Create Dynamic Browser
 

jamie_moore

New Member
Thank you, I've taken a look at making my own browse widget but keep on getting the error:BROWSE widget does not fit in parent FRAME terminal-frame. (4041)

I've changed the X/Y figures for the BROWSE Widget and Frame but had no luck.



DEFINE FRAME terminal-frame WITH SIZE 25 BY 15 ROW 7 COLUMN 1.

DEFINE QUERY terminal-display FOR order.stkadj SCROLLING.
OPEN QUERY terminal-display FOR EACH order.stkadj NO-LOCK.

CREATE BROWSE browse-terminal
ASSIGN
FRAME = FRAME terminal-frame:HANDLE
QUERY = QUERY terminal-display:HANDLE
X = 1
Y = 1
WIDTH = 25
DOWN = 5
VISIBLE = YES.
 

Osborne

Active Member
Depending on certain settings - either for the browse or the frame, cannot remember exactly - it results in the frame requiring a larger width than the browse.

If you make the frame width 27 or the browse width 23 there is no error.
 

Osborne

Active Member
Have you made the browse sensitive? Either in CREATE BROWSE ASSIGN:
Code:
SENSITIVE = TRUE
or somewhere relevant in later code:
Code:
browse-terminal:SENSITIVE = TRUE.
 

Osborne

Active Member
Does applying entry to the browse after opening the query and making it sensitive work?:
Code:
APPLY "ENTRY" TO browse-terminal.
If not, can you post the part of the code that views the frame and browse.
 

jamie_moore

New Member
Still nothing I'm afraid, here's the code.

DISPLAY " STOCK ADJUSTMENT REPORT"
WITH 1 COLUMNS FRAME HEADER-1 NO-BOX ROW 1 COLUMN 1.

DISPLAY daStartDate
daEndDate SKIP(1)
"Adjust Report Date"
TODAY WITH SIDE-LABELS ROW 2 COLUMN 1.

IF outputSelection = "terminalOption" THEN DO:

DEFINE FRAME terminal-frame WITH SIZE 27 BY 15 ROW 7 COLUMN 1.

DEFINE QUERY terminal-display FOR order.stkadj SCROLLING.
OPEN QUERY terminal-display FOR EACH order.stkadj NO-LOCK.

CREATE BROWSE browse-terminal
ASSIGN
FRAME = FRAME terminal-frame:HANDLE
QUERY = QUERY terminal-display:HANDLE
X = 1
Y = 1
WIDTH = 23
DOWN = 5
VISIBLE = YES
SENSITIVE = TRUE.
APPLY "ENTRY" TO browse-terminal.

FOR EACH order.stkadj WHERE
company = iCompany AND
loc-cd = iDepot AND
adj-date >= daStartDate AND
adj-date <= daEndDate,
EACH main.product OF order.stkadj,
EACH main.stock OF main.product:
deCostAdj = cost-price * adj-qty.
iNewStk = old-stk + adj-qty.
browse-terminal:SENSITIVE = TRUE.
DISPLAY /*stkadj.adj-date*/
fwd-loc LABEL "Bin Loc"
catalog-no
prod-name
product.pack
stkadj.prod-code LABEL "Code"
/*stkadj.reason*/
old-stk
adj-qty
iNewStk
/*stkadj.user-id*/
deCostAdj
(TOTAL)
reference.
END.

END.
 

Osborne

Active Member
Two noticeable points:

1) No fields are being added to the browse.
2) After the browse is created records are being read and displayed in a FOR EACH block. You should not have this section as the browse should be displaying the records.

Try the following adjustments:

1) Change the DEFINE QUERY statement to be:
Code:
DEFINE QUERY terminal-display FOR order.stkadj, main.product, main.stock SCROLLING.
2) Add all the relevant fields as per the FOR EACH block to the browse.
Code:
browse-terminal:ADD-LIKE-COLUMN("order.stkadj.fwd-loc").
browse-terminal:ADD-LIKE-COLUMN("order.stkadj.catalog-no").
etc.
You also require some calculated fields. You may find it easier to do these using a static browse first until used to a dynamic browse.

3) Change the OPEN QUERY statement to match the FOR EACH block.
Code:
OPEN QUERY terminal-display FOR EACH order.stkadj WHERE company = iCompany AND
   order.stkadj.loc-cd = iDepot AND
   order.stkadj.adj-date >= daStartDate AND
   order.stkadj.adj-date <= daEndDate NO-LOCK,
   EACH main.product OF order.stkadj NO-LOCK,
   EACH main.stock OF main.product NO-LOCK.
4) Remove the FOR EACH block.

5) Put in a WAIT-FOR when everything is viewed and enabled.
Code:
WAIT-FOR CLOSE OF THIS-PROCEDURE.
 

jamie_moore

New Member
Thank you for all your help so far, I'm getting this error for the variables I'm creating in the ADD-LIKE-COLUMN statements:

iNewStk in ADD-LIKE-COLUMN must have a table qualifier. (9158)

Code:
IF outputSelection = "terminalOption" THEN DO:

DEFINE FRAME terminal-frame WITH SIZE 27 BY 15 ROW 7 COLUMN 1.

DEFINE QUERY terminal-display FOR order.stkadj, main.product, main.stock SCROLLING.

OPEN QUERY terminal-display FOR EACH order.stkadj WHERE
   order.stkadj.company = iCompany AND 
   order.stkadj.loc-cd = iDepot AND
   order.stkadj.adj-date >= daStartDate AND
   order.stkadj.adj-date <= daEndDate AND
   iNewStk = old-stk + adj-qty NO-LOCK,
   EACH main.product OF order.stkadj WHERE
   deCostAdj = main.product.cost-pr * order.stkadj.adj-qty NO-LOCK,
   EACH main.stock OF main.product NO-LOCK.
         

    CREATE BROWSE browse-terminal
              ASSIGN
                FRAME = FRAME terminal-frame:HANDLE
                QUERY = QUERY terminal-display:HANDLE
                X = 1
                Y = 1
                WIDTH = 23
                DOWN = 5
                VISIBLE = YES
                SENSITIVE = TRUE.
                APPLY "ENTRY" TO browse-terminal.
               
  browse-terminal:ADD-LIKE-COLUMN("main.stock.fwd-loc").
  browse-terminal:ADD-LIKE-COLUMN("main.product.catalog-no").
  browse-terminal:ADD-LIKE-COLUMN("main.product.prod-name").
  browse-terminal:ADD-LIKE-COLUMN("main.product.pack").
  browse-terminal:ADD-LIKE-COLUMN("main.product.prod-code").
  browse-terminal:ADD-LIKE-COLUMN("order.stkadj.old-stk").
  browse-terminal:ADD-LIKE-COLUMN("order.stkadj.adj-qty").
  browse-terminal:ADD-LIKE-COLUMN("iNewStk").
  browse-terminal:ADD-LIKE-COLUMN("deCostAdj").
  browse-terminal:ADD-LIKE-COLUMN("order.stkadj.reference").


WAIT-FOR CLOSE OF THIS-PROCEDURE.
         
END.
 

Osborne

Active Member
Always a good policy to include the table name when working with fields. So I am guessing iNewStk - and deCostAdj - needs to be:
Code:
browse-terminal:ADD-LIKE-COLUMN("order.stkadj.iNewStk").
browse-terminal:ADD-LIKE-COLUMN("order.stkadj.deCostAdj").
 

jamie_moore

New Member
the iNewStk and deCostAdj are variables that I created for this program so they don't lie within any database/table.
Code:
DEFINE VARIABLE deCostAdj AS DECIMAL NO-UNDO FORMAT "->>>9.99" LABEL "Cost Value"
  INIT "0.00".
DEFINE VARIABLE iNewStk AS INTEGER NO-UNDO FORMAT "->>>>9" LABEL "New Stk"
  INIT "0".
Code:
OPEN QUERY terminal-display FOR EACH order.stkadj WHERE 
   order.stkadj.company = iCompany AND  
   order.stkadj.loc-cd = iDepot AND
   order.stkadj.adj-date >= daStartDate AND
   order.stkadj.adj-date <= daEndDate AND 
   iNewStk = old-stk + adj-qty NO-LOCK,
   EACH main.product OF order.stkadj WHERE
   deCostAdj = main.product.cost-pr * order.stkadj.adj-qty NO-LOCK,
   EACH main.stock OF main.product NO-LOCK.
 

Osborne

Active Member
Ah, right. For them you require the following extras/differences:
Code:
DEFINE VARIABLE hCalcdeCostAdj AS HANDLE NO-UNDO.
DEFINE VARIABLE hCalciNewStk AS HANDLE NO-UNDO.

...

hCalcdeCostAdj = browse-terminal:ADD-CALC-COLUMN("DECIMAL","->>>9.99",0,"Cost Value").
hCalciNewStk = browse-terminal:ADD-CALC-COLUMN("INTEGER","->>>>9",0,"New Stk").

...

ON ROW-DISPLAY OF browse-terminal DO:
   IF VALID-HANDLE(hCalcdeCostAdj) THEN
      hCalcdeCostAdj:SCREEN-VALUE = STRING(deCostAdj).
   IF VALID-HANDLE(hCalciNewStk) THEN
      hCalciNewStk:SCREEN-VALUE = STRING(iNewStk).
END.
Also, before the WAIT-FOR view the frame:
Code:
VIEW FRAME terminal-frame.
 

jamie_moore

New Member
Almost there! Not showing any data now, so the browse part appears to be working and it outputs the label names at the top but no data.

Code:
IF outputSelection = "terminalOption" THEN DO:

DEFINE FRAME terminal-frame WITH SIZE 80 BY 15 ROW 7 COLUMN 1.

DEFINE QUERY terminal-display FOR order.stkadj, main.product, main.stock SCROLLING.

OPEN QUERY terminal-display FOR EACH order.stkadj WHERE
   order.stkadj.company = iCompany AND 
   order.stkadj.loc-cd = iDepot AND
   order.stkadj.adj-date >= daStartDate AND
   order.stkadj.adj-date <= daEndDate AND
   iNewStk = old-stk + adj-qty NO-LOCK,
   EACH main.product OF order.stkadj WHERE
   deCostAdj = main.product.cost-pr * order.stkadj.adj-qty NO-LOCK,
   EACH main.stock OF main.product NO-LOCK.
         
    CREATE BROWSE browse-terminal
              ASSIGN
                FRAME = FRAME terminal-frame:HANDLE
                QUERY = QUERY terminal-display:HANDLE
                X = 1
                Y = 1
                WIDTH = 77
                DOWN = 11
                VISIBLE = YES
                SENSITIVE = TRUE.
                APPLY "ENTRY" TO browse-terminal.
               
  hCalcdeCostAdj = browse-terminal:ADD-CALC-COLUMN("DECIMAL","->>>9.99",0,"Cost Value").
  hCalciNewStk = browse-terminal:ADD-CALC-COLUMN("INTEGER","->>>>9",0,"New Stk").
               
  browse-terminal:ADD-LIKE-COLUMN("main.stock.fwd-loc").
  browse-terminal:ADD-LIKE-COLUMN("main.product.catalog-no").
  browse-terminal:ADD-LIKE-COLUMN("main.product.prod-name").
  browse-terminal:ADD-LIKE-COLUMN("main.product.pack").
  browse-terminal:ADD-LIKE-COLUMN("main.product.prod-code").
  browse-terminal:ADD-LIKE-COLUMN("order.stkadj.old-stk").
  browse-terminal:ADD-LIKE-COLUMN("order.stkadj.adj-qty").
  ON ROW-DISPLAY OF browse-terminal DO:
    IF VALID-HANDLE (hCalcdeCostAdj) THEN
      hCalcdeCostAdj:SCREEN-VALUE = STRING(deCostAdj).
    IF VALID-HANDLE(hCalciNewStk) THEN
      hCalciNewStk:SCREEN-VALUE = STRING(iNewStk).
  END.
  /*browse-terminal:ADD-LIKE-COLUMN("iNewStk").
  browse-terminal:ADD-LIKE-COLUMN("deCostAdj").*/
  browse-terminal:ADD-LIKE-COLUMN("order.stkadj.reference").
 

VIEW FRAME terminal-frame.
WAIT-FOR CLOSE OF THIS-PROCEDURE.
         
END.
 

Osborne

Active Member
The workings seem to look okay, so the first guess would be that there are no actual records available for the query criteria. Before the WAIT-FOR put this in:
Code:
MESSAGE "Is Query Opened?" browse-terminal:QUERY:IS-OPEN VIEW-AS ALERT-BOX.
IF browse-terminal:QUERY:IS-OPEN THEN DO:
   browse-terminal:QUERY:GET-FIRST().
   MESSAGE "order.stkadj Record Available?" AVAILABLE order.stkadj VIEW-AS ALERT-BOX.
END.
If it is "No" for the second message then it suggests no records are available.
 
Top