Combo Box Value does not refresh

Jimmy

New Member
Hi,

I am developing an application using PROGRESS version 8.3B UIB. I have a window that consists of a SmartBrowser and a SmartViewer that are linked together. The SmartBrowser is connected to a IBM's DB2 table(say it is 'order'). In the SmartViewer, I have placed a Combo-Box that is connected to a character field of order table (say it is 'order_group'). The list-items of the combo-box are then '','domestic', and 'international'.

The problem that I am having is that whenever I select a record that has no order_group defined (having a value of '') in a browser, the combo box does not refresh itself. Instead it is keeping the order_group value of the previously selected record.
I have tried using ' ' instead of '' and to manually assign the combo-box:screen-value in any of the local ADM event, but no use.

Could someone please advise me how to solve this issue ? Thank you.

Jimmy
 
U

Unregistered

Guest
I have the same problem also. Please tell me if you have solutions
 
The progress combo-box object will only display values that are in it's list-items. You can add the blank value to the list-items and use validation to ensure the blank value isn't selected when updating the record.

What we do is create a fill-in object the same size and position as the combo and display the db record in that. Then if the code is invalid we can make the fill-in red and put "Invalid code" or something in the fill-in. When the user selects update we hide the fill-in and enable the combo.

You will find that the same problem occurs with radio-set objects. Most of the time I avoid using combos and radio-sets to display db values unless the users really insist. They don't look real good when their disabled anyway.
 
Any better way to deal with this after all these years?

Can't just do a "DISP ? @ <dbfield-name>" because @ is only allowed for fill-ins and text-widgets.

Is there any way to clear the data, refresh the widget, or do some other thing to get a blank when a database value is blank and not just leave whatever was in there from the last record??
 
As previously identified,
A combo box widget can only display values that are in the item list.
This IS still a pain, it is still here in OpenEdge - though there are work arounds.
By having a blank value as a list item to select from works, though additional validation could be required. It is a pain, but it is how the Progress tool works.
A widget can only have the value of the list.
ABL makes perfect sense.
If it`s not in the list then I can`t display it, simple
 
I have gotten used to the flavour of this BUG over the years, so It rankles me to be told to suck it up and just put some salt on it. Displaying the value from another record is wrong. Not having a choice in this behavior is wrong. Simple!

So, to steer things back to useful discussion, let's talk work-arounds.

I don't want to put a blank value in the list. I don't want to play around with overlaying fill-ins. I don't want to "avoid using combos".

The behavior I'm looking for is the same as when I first load a single record. No data in field - nothing in combo box. This behavior shouldn't be any different just because I am browsing to another record. So I can this behavior be replicated? Is there a down and dirty way to delete and re-instantiate a single widget or all widgets on the screen? Delete the pointer?!? How do I get that ? back into the screen value when I want it to be there?
 

Stefan

Well-Known Member
You can play around with the combo-box's list. Add the dummy entry, set the screen-value to the dummy entry, then remove the dummy entry - the value of the combo box is now back to unknown, which is the same as it initially was.

Code:
DEF VAR cb AS INTEGER  NO-UNDO INITIAL 1.

DEFINE FRAME fr
   cb VIEW-AS COMBO-BOX LIST-ITEM-PAIRS "one",1,"two",2.

ENABLE ALL WITH FRAME fr.

ON 'F5' ANYWHERE DO:

   DEFINE VARIABLE cpairs  AS CHARACTER   NO-UNDO.
   
   DO WITH FRAME fr:
   
      cpairs = cb:HANDLE:LIST-ITEM-PAIRS.
      cb:HANDLE:LIST-ITEM-PAIRS = ",0," + cpairs.
      cb:SCREEN-VALUE = "0".
      cb:HANDLE:LIST-ITEM-PAIRS = cpairs.

   END.

END.

ON 'F4' ANYWHERE DO:

   DO WITH FRAME fr:
   
      MESSAGE cb:SCREEN-VALUE VIEW-AS ALERT-BOX.

   END.

END.

WAIT-FOR CLOSE OF THIS-PROCEDURE.
 
Greetings,

Yes this is a problem with the 4GL/ABL that has been around like 4 ever.
The only solution is to use work arounds.
You have identified that you do not wish the overhead of having a special <blank> entity in the list items. Another workaround is having an additional widget on the screen for initialization. When the screen is first initialized, you have a dummy widget with the attribute of :HIDDEN = TRUE. You can then load your screen as normal, with the required list of items. At this point bring the dummy widget to the front - :HIDDEN = FALSE. Alternate as appropriate enabling you to have a widget with a blank list item, because it is a different widget !!! Passing the screen-value to the appropriate SDO for assigning and validation.
Good luck.
 
Stefan - Thanks for jogging my memory! Your solution was on the tip of my brain, but I was stuck on other approaches.

Here's my take (with comment overkill):
Code:
PROCEDURE p-Display-Fields :
    DO WITH FRAME {&FRAME-NAME}:
        /* Clear Combo Box Choices */
        ASSIGN ShippingClass.User-1:LIST-ITEMS = ?.
 
        /* Rebuild Combo Box Choices */
        DO v-cnt = 1 TO NUM-ENTRIES(v-order-types):
            ShippingClass.User-1:ADD-LAST(ENTRY(v-cnt,v-order-types)).
        END.
 
        /* Optional - Resize Combo Box Size */
        ASSIGN ShippingClass.User-1:INNER-LINES = NUM-ENTRIES(v-order-types).
 
        /* Now, if the DB Field is not in the list, the SCREEN-VALUE has been   */
        /* set to ?, so a blank will display without a blank option in the list */
        /* (and no ghost data showing from the last record).                    */
        DISPLAY
            /* ... other fields plus ... */
            ShippingClass.User-1.
 
        /* If user is adding a record, default to first choice to avoid validation. */
        /* Having no blank choice in the combo box makes things easy here. */
        IF v-mode = "add" THEN
            ASSIGN ShippingClass.User-1:SCREEN-VALUE = ShippingClass.User-1:ENTRY(1).
 
    END.  /* DO WITH FRAME {&FRAME-NAME} */
END PROCEDURE. /* p-Display-Fields */

I was populating the choices of the combo box anyway (with v-order-types), so I just moved my code here. The Display procedure always fires, so no need to do anything else besides make sure the List-Items are cleared with a ? first.
 
Top