[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

Removing values from Enum at runtime.

T-AIM

12/7/2005 3:12:00 PM

How can i delete some values from a BaseEnum at runtime. I don't always want
to display all the values on certain forms. I have tried the following but
the delete option is not available on the class.

ABC.delete("None");

I got this code from an ealier post. Maybe it worked in the older version of
axapta.

I have also looked at the DictEnum .. but remove option is not available,
only to add new values.

Please advice.
4 Answers

JimChw

12/7/2005 9:48:00 PM

0

I'm not aware of a way to eliminate at runtime the values displayed from a
BaseEnum. We were able to keep users from selecting certain values in the
dropdown by modifying the selectionChange method of the combobox control.

Mike Frank

12/8/2005 9:35:00 AM

0

> I'm not aware of a way to eliminate at runtime the values displayed from a
> BaseEnum. We were able to keep users from selecting certain values in the
> dropdown by modifying the selectionChange method of the combobox control.

Another possibility would be to add the selection values manually to the combo box.
(Iterate trough enum values with DictEnum and skip unwanted values).

Mike

Luegisdorf

12/9/2005 12:33:00 PM

0

Hi T-AIM

You can build and use an edit method handling a selfmade base enum which
doesn't provide an element called 'none' instead the data field itself.

Best regards
Patrick

"T-AIM" wrote:

> How can i delete some values from a BaseEnum at runtime. I don't always want
> to display all the values on certain forms. I have tried the following but
> the delete option is not available on the class.
>
> ABC.delete("None");
>
> I got this code from an ealier post. Maybe it worked in the older version of
> axapta.
>
> I have also looked at the DictEnum .. but remove option is not available,
> only to add new values.
>
> Please advice.

Anish Abslom

12/13/2005 4:53:00 AM

0

If you donâ??t want to display all the values of a specific base enum in
certain forms, is it necessary to delete some values from a BaseEnum at
runtime? Instead of deleting we can hide the values from the user.

1 Hiding the value from the user on a specific form

Control which present the enumtype should have AutoDeclaration (yes)

Try this piece of code

Control_name.delete(â??Name of the elementâ?);

If we really want to delete the values of a baseenum on run time Use the
class SysDictEnum

2 Deleting the enum value on Run time (dynamically)

SysDictEnum = new SysDictEnum(enum_Id); //initialization

Sysdictenum.treeNode().AOTfindChild("Name of the
element").AOTdelete(); //deleting the element from the Enum
SysDictEnum.treeNode().AOTcompile(1); //compile
SysDictEnum.treeNode().AOTsave(); //Saving the baseenum