This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Drop-down list box with constant content

General questions regarding the development with JVx.

Drop-down list box with constant content

Postby ANH » Tue Aug 21, 2018 9:53 am

Hello,

I want to put a drop-down list box into a workscreen, with no link to a databook. The values of the list box are a fix set of string literals. I cannot figure out how to do that properly. Could you please help me with this?

Thank you!

Best regards,
Andreas
ANH
 
Posts: 11
Joined: Fri Jun 29, 2018 11:42 am

Re: Drop-down list box with constant content

Postby Support@SIB » Tue Aug 21, 2018 10:50 am

The doc system has an article for your problem: Custom linked cell editors
User avatar
Support@SIB
 
Posts: 257
Joined: Mon Sep 28, 2009 1:56 pm

Re: Drop-down list box with constant content

Postby ANH » Tue Aug 21, 2018 12:45 pm

Thank you for your reply.
I still have difficulties to understand how to add the UIEnumCellEditor to a panel or a workscreen. The add-functions require an IComponent as argument, but UIEnumCellEditor is not an implementation of ICompoment.
ANH
 
Posts: 11
Joined: Fri Jun 29, 2018 11:42 am

Re: Drop-down list box with constant content

Postby rzenz » Tue Aug 21, 2018 1:20 pm

Yes, that is because it isn't a component, it is a cell editor. Cell editors are set on the DataType of the column and then picked up and used automatically by the UIEditors.

See this explanation on what cell editors are for further details.
User avatar
rzenz
 
Posts: 36
Joined: Mon Dec 12, 2016 1:40 pm
Location: Vienna, Austria

Re: Drop-down list box with constant content

Postby Support@SIB » Wed Aug 22, 2018 10:44 am

You could use a DataBook or a Row for the editor, e.g.:

Syntax: [ Download ] [ Hide ]
UIEnumCellEditor cellEditor = new UIEnumCellEditor();
cellEditor.setAllowedValues(new String[] { "A", "B", "C", "D" });
cellEditor.setDisplayValues(new String[] { "Alpha", "Bravo", "Charlie", "Delta" });
               
DataRow row = new DataRow();
row.getRowDefinition().addColumnDefinition(new ColumnDefinition("BASE",
                                           new StringDataType(cellEditor)));

IEditor editor = new UIEditor(row, "BASE");

panel.add(editor);

... and with a DataBook, e.g.:

Syntax: [ Download ] [ Hide ]
IDataBook dataBook = new MemDataBook(rowDef);
dataBook.getRowDefinition().addColumnDefinition(new ColumnDefinition("BASE",
                                                new StringDataType(cellEditor))));
dataBook.setName("BASE");
dataBook.open();

IEditor editor = new UIEditor(dataBook, "BASE");

panel.add(editor);
User avatar
Support@SIB
 
Posts: 257
Joined: Mon Sep 28, 2009 1:56 pm

Re: Drop-down list box with constant content

Postby ANH » Wed Aug 22, 2018 11:34 am

Thank you. The code examples together with "...and then picked up and used automatically by the UIEditors" made it clear to me.

Best regards
Andreas
ANH
 
Posts: 11
Joined: Fri Jun 29, 2018 11:42 am


Return to Development