Creating Dynamic Combo Box on Button Press

Posted by soumakdutta on 24-Feb-2009 09:19

Hello all. I'm trying to create a combo-box on the press of a button dynamically. I would eventually like to put it in a loop that will change the label of the combo-box as it is created. For example..if the users puts in 2..i would like to display 2 combo-boxes with different labels such as: C-B1 and C-B2. I was wondering if someone can help me with the coding for a dynamic combo-box. this is what i have thus far:

ON 'choose':U OF bcreate IN FRAME fcreate

DO:

CREATE FILL-IN vcombohandle

ASSIGN

DATA-TYPE = "Character"

FORMAT = "x(30)"

LABEL = "Test1"

ROW = 2

COLUMN = 2

VISIBLE = TRUE

LIST-ITEMS = "test1, test2, test3".

END.

..on press of create it doesn't' display it. Thanks in advance for any that can help.

All Replies

Posted by Admin on 24-Feb-2009 09:39

I'm a bit confused. You are writing about creating a COMBO-BOX but you are creating a FILL-IN in your code...

To make the combo visible, you probably need to assign a FRAME to it.

You can't assign the label directly. You need to create a TEXT first and use that as the side label handle.

{&FRAME-NAME}{&FRAME-NAME}

Posted by soumakdutta on 24-Feb-2009 10:05

thanks you very much appreciate it. got it now. it was suppose to be combo-box. i was looking at the programming handbook where it had a fill-in tutorial so i probably put that in there to test it out.

anyhoo the full code for anyone that needs it: (i'm still new to progress so i'm sure its not "optimized".

DEFINE VARIABLE vcombohandle AS HANDLE NO-UNDO.

DEFINE VARIABLE vlablehandle AS HANDLE NO-UNDO.

DEFINE BUTTON bcreate LABEL "Create".

DEFINE FRAME fcreate

SKIP(3)

SPACE(1) bcreate

WITH SIZE 60 BY 5 SIDE-LABELS.

ON 'choose':U OF bcreate IN FRAME fcreate

DO:

CREATE TEXT vlablehandle

ASSIGN

FRAME = FRAME fcreate:HANDLE

DATA-TYPE = "Character"

SCREEN-VALUE = "Test1:"

FORMAT = "x(5)"

ROW = 2.25

COLUMN = 2.

CREATE COMBO-BOX vcombohandle

ASSIGN FRAME = FRAME fcreate:HANDLE

DATA-TYPE = "Character"

SIDE-LABEL-HANDLE = vlablehandle

FORMAT = "x(30)"

INNER-LINES = 10

LABEL = "Test1"

ROW = 2

COLUMN = 10

SENSITIVE = TRUE

VISIBLE = TRUE

LIST-ITEMS = "test1,test2,test3".

END.

ENABLE ALL WITH FRAME fcreate.

WAIT-FOR GO OF FRAME fcreate.

This thread is closed