Commodore
Commodore
677 views

Is there a way to 'clear' a selection box?

Jump to solution

I have an entry box, which I use to create a search and put the results in a selection box.  For instance, user may type in 'EX' and get all of the listings that have that combo.

I want the users to be able to search for more than one combo, if they like, but I cannot get the selection box to clear.  I have tried initializing the table in cobol,  using delete-list-item, initializing in the dialog etc,  but the earlier entries won't go away. Below is an example with delete-occurrence.  There must be something simple I am overlooking.  Thx.

CLEAR-LOOP
  DELETE-OCCURRENCE ACCOUNT-GROUP $REGISTER
  DECREMENT ACCOUNT-COUNT
  DECREMENT $REGISTER
  REFRESH-OBJECT SB-ACCOUNT
  IF= $REGISTER 0 EXIT-CLEAR-LOOP
  BRANCH-TO-PROCEDURE CLEAR-LOOP
EXIT-CLEAR-LOOP

 

Labels (3)
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Sorry I misunderstood. I thought you simply wanted to clear the entry field portion of the selection box. If you wish to actually delete the entries within the listbox itself you need to use DELETE-LIST-BOX.

My updated example looks like this:

BUTTON-SELECTED
    CLEAR-OBJECT SB1
    MOVE " " DATA-FIELD
    DELETE-LIST-ITEM SB1 1 3
    RETC
    INSERT-MANY-LIST-ITEMS SB1 DATA-FIELD NUM-BYTES
    REFRESH-OBJECT SB1

View solution in original post

0 Likes
6 Replies
Micro Focus Expert
Micro Focus Expert

Did you try CLEAR-OBJECT instead of REFRESH-OBJECT?

0 Likes
Commodore
Commodore

Hi Chris,

Yes I did. I used the name of the field, not the master name.  It did nothing.

0 Likes
Micro Focus Expert
Micro Focus Expert

I wrote a little sample here that just populates a selection-box with 3 items and after I select an item it appears in the entry field of the selection box.

I execute the following dialog from a button which clears the entry field portion pf the selection box. This is working for me...

BUTTON-SELECTED
    CLEAR-OBJECT SB1
    MOVE " " DATA-FIELD

0 Likes
Commodore
Commodore
Hi,

I did the following in the dialog:

BUTTON-SELECTED

IFNOT= S-ACCOUNT " " CONT-LOOKUP-PROC

*

CONT-LOOKUP-PROC

MOVE ACCOUNT-COUNT $REGISTER

CLEAR-OBJECT SB-ACCOUNT

MOVE " " W-ACCOUNT

SET-MOUSE-SHAPE $WINDOW "SYS-Wait"

SET-FLAG SEARCH-ACCT-FLAG

RETC

INSERT-MANY-LIST-ITEMS SB-ACCOUNT ACCOUNT-GROUP ACCOUNT-COUNT

REFRESH-OBJECT $WINDOW

SET-MOUSE-SHAPE $WINDOW "SYS-Arrow"

[cid:image001.png@01D6AC4D.BB7E3C80]



I first enter 29, press the search button and get this result in the selection box.



22-2900000

22-2950000

22-2970000

22-2980000



Then I enter 27 and press the search button - and get the following in the selection box - the 29 lines are still there...

22-2900000

22-2950000

22-2970000

22-2980000



22-2700000

22-2760000


0 Likes
Micro Focus Expert
Micro Focus Expert

Sorry I misunderstood. I thought you simply wanted to clear the entry field portion of the selection box. If you wish to actually delete the entries within the listbox itself you need to use DELETE-LIST-BOX.

My updated example looks like this:

BUTTON-SELECTED
    CLEAR-OBJECT SB1
    MOVE " " DATA-FIELD
    DELETE-LIST-ITEM SB1 1 3
    RETC
    INSERT-MANY-LIST-ITEMS SB1 DATA-FIELD NUM-BYTES
    REFRESH-OBJECT SB1

View solution in original post

0 Likes
Commodore
Commodore

Thanks, sorry for the confusion.  That works great!  I had tried it before but was missing a parm!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.