4GL - Combobox in Frame

cekoiz

New Member
Hello,

i am trying read the value from a combobox but somehow i cant seem to get it to work.

Whenever i run this code and choose my status from the combobox, i cant proceed with the procedure.
Code:
DEF VAR belegStat as CHAR VIEW-AS COMBO-BOX INNER-LINES 5 LIST-ITEMS "offen", "arch"
    LABEL 'BelegStatus' NO-UNDO.
    
DEFINE FRAME test
    belegStat
    WITH WIDTH 80 1 COLUMN ROW 3 COLUMN 1 TITLE 'TEST FILL-IN'.   
ENABLE belegStat WITH FRAME test.

belegStat:SCREEN-VALUE      = belegStat.
UPDATE belegStat    WITH FRAME test.

When i run it, it looks like this:
1670328078406.png

Normally, when i use "view-as fill-in" instead of combobox then i can just type in something and proceed with pressing ENTER but that does not work with combobox.
I have to press ESC and then the procedure just ends there. How do i proceed from here? I want to work with the chosen value further in the code.
 
Hello,

Like this:
Code:
DEF VAR belegStat as CHAR VIEW-AS COMBO-BOX INNER-LINES 5 LIST-ITEMS "offen", "arch" DROP-DOWN-LIST
    LABEL 'BelegStatus' NO-UNDO
    TRIGGERS:
        ON VALUE-CHANGED
        DO:
            MESSAGE SELF:SCREEN-VALUE
                VIEW-AS ALERT-BOX INFO BUTTONS OK.
        END.
    END TRIGGERS.
    
DEFINE FRAME test
    belegStat
    WITH WIDTH 80 1 COLUMN ROW 3 COLUMN 1 TITLE 'TEST FILL-IN'.   
ENABLE belegStat WITH FRAME test.

belegStat:SCREEN-VALUE      = belegStat.
UPDATE belegStat    WITH FRAME test.

Also the documentation that explain it:
 

cekoiz

New Member
Thanks for the reply!

I am not sure if i understand how to go on from here. I added the trigger but still, i am not sure how i can now use the chosen value from the combobox. I want to use the chosen value as a parameter to query a database table. With the trigger i still have to press ESC and it cancels the whole procedure.
Any help is appreciated!
 
You need to had more object to your frame like a button to do stuff after the user choosed a value in your combo box.
But a question, why are you using a procedure file and not a window file (.w) It would be more easier for you
 

cekoiz

New Member
Okay, i see. I will add more handling after the user chose a value. I might be asking more tomorrow..

I am new to progress and just using it to generate reports from our ERP. I did not even know about window files. Not sure what that is but i will take a look at it.
 

cekoiz

New Member
Its actually just a editor from the ERP. I do have the app builder but never really used it so far.
 

Stefan

Well-Known Member
The update statement stems from the previous century and does not really belong in any "modern" event-driven UI.
I think the update statement was never updated to handle the combo box widget.

With some extra attention you can coax it into doing something:

Code:
DEF VAR belegStat as INT
    VIEW-AS COMBO-BOX
    INNER-LINES 5
    LIST-ITEM-PAIRS 'offen', 1, 'arch', 2
    LABEL 'BelegStatus'
    NO-UNDO
    INITIAL 1
    .   

DEFINE FRAME test
    belegStat
    WITH
        WIDTH 80
        1 COLUMN
        ROW 3
        COLUMN 1
        TITLE 'TEST FILL-IN'
    .

DO WITH FRAME test:

    ON 'enter' OF belegstat
        APPLY 'go'.

    UPDATE belegStat.

END.

MESSAGE belegStat VIEW-AS ALERT-BOX.
 

cekoiz

New Member
After trying your version Stefan, it seems to do what i want. I will try it out more and add more logic into my code.

Btw you wrote that the update statement is kinda old.. what else could i take a look at to achieve the wanted behaviour? Any documentation i can read?
 
Top