hi Lennart,
  
  thx for ur help and details explanation.
  
  although it is little bit troublesome (not as easy as what i think), but let me try first then feedback to u.
  
  daniel

Lennart Conrad <[EMAIL PROTECTED]> wrote:
  If you use this approach (override enter), you will remove the enum
value, but the remaining values in the enum will have their values
shifted:
E.g
You have the enum (Quarter 1 = 1, Quarter 2 = 2, Quarter 3 = 3 Quarter
4=4)
If you remove, Quarter 3, you will get 3 returned if you select Quarter
4. This is most likely NOT what you wan't.

I know of two approaches to this problem that works:

Option 1.
-Create a new enum, that contains the elements you want to display and
have the same values as the original enum elements
e.g Quarter 1 = 1, Quarter 2 = 2, Quarter 4=4), if you wan't to hide
quarter 3.
-create an edit method on the appropriate table that returns the new
enum. It could look something like this:
edit QuarterTypeNoQuarter3 QuarterTypeNoQuarter3boolean _set,
QuarterTypeNoQuarter3 _QuarterTypeNoQuarter3)
{
    QuarterTypeNoQuarter3 QuarterTypeNoQuarter3;
    ;

    if (_set)
    {
        this.QuarterType = any2int(_QuarterTypeNoQuarter3);

        if (!this.validateField(fieldnum(YourTable, QuarterType)))
        {
            this.QuarterType = this.orig().QuarterType;
        }
    }

    QuarterTypeNoQuarter3= any2int(this.QuarterType);

    return QuarterTypeNoQuarter3;
}
- drag the edit method to your form, instead of the table field
- You might want to exclude any records that have the hidden enum value
so the dont appear to have a blank value

Option 2: This is more complex, but can be used if you want to disable
different enums, e.g based on a caller.
- create an edit method that returns the enum
In pseudo code, this is what you have to do:
- Loop through all the values in the dictenum
      - if the value is to be excluded you must map all the remaining
enumvalues to the right value so they do not shift value, e.g Using a
Map
      - else if the value is not excluded, but have been adjusted in
the       step       above, you must also adjust the forthcoming values
      - else the mapping is ok
     
- based on the input to the method, you can lookup the correct value in
your map and return it.

I have some none-production code, that I can provide, if you need it for
option 2, but I recommend option 1, if possible

/Lennart Conrad

-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Vikas Garg
Sent: 13. februar 2006 11:06
To: [email protected]
Subject: RE: [development-axapta] making enum element invisible

Hi Daniel,
Override "enter method" of the control that is mapped with enum type
object... write code after super method as follows:

this.delete(enum2str(enum::element));
here element is the one that u don't want user to see while selection of
enum type...
I hope this will solve your problem..

Regards

Vikas Garg
(Technical Consultant)
EuroInfo Systems Pvt. Ltd.
Sector 2, Noida.
Direct No - +91-9911213322
Office No - +91-120-2520414 ext. 213


-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of daniellim_yh
Sent: Saturday, February 11, 2006 6:29 AM
To: [email protected]
Subject: [development-axapta] making enum element invisible

hi all,

how we can make enum element invisible?for example for usage in form?

if i have an enum of element A,B and C, but in form i only would like
to display A and B for user selection, can i make C invisible inside
the form?

thx in advance.

daniel








Yahoo! Groups Links












Yahoo! Groups Links











  SPONSORED LINKS
        Computer part   Programming languages   Microsoft axapta     Support exchange
   
---------------------------------
  YAHOO! GROUPS LINKS

   
    Visit your group "development-axapta" on the web.
   
    To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
   
    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

   
---------------------------------
 



                 
---------------------------------
Yahoo! Mail
Use Photomail to share photos without annoying attachments.

[Non-text portions of this message have been removed]





SPONSORED LINKS
Computer part Programming languages Microsoft axapta
Support exchange


YAHOO! GROUPS LINKS




Reply via email to