selection using the enumvalue (integer) within the record level. you
can look at the table browser and look at the saved record. what you
have info-ed is just the text selection of the enum. not the
enumvalue. try infoing this.selection() and see the difference.
cheers. i am also currently playing with hidding enum list. but have
not found a good way. will experiment with the below suggested options
by lenard as well.
--- In development-axapta@yahoogroups.com, daniel lim
<[EMAIL PROTECTED]> wrote:
>
> hi Lennart,
>
> i use something like this:
>
> in combox:enter:
>
> public void enter()
> {
> super();
> //EnumABC has element A, B,C
> this.delete(enum2str(EnumABC::B));
> }
>
> in combobox:modified:
>
> public boolean modified()
> {
> EnumABC _EnumABC;
> boolean ret;
>
> ret = super();
>
> _EnumABC = str2enum(_EnumABC, this.getEditText());
>
> info(strfmt('%1',str2enum(_EnumABC,this.getEditText())));
> info(strfmt('this is %1',_EnumABC));
> return ret;
> }
>
> in this example, i remove element B, at clicked method, it return
correct value for A and C as well.
>
> any problem with this code?is this recommended? pls advice and thx.
>
>
> 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: development-axapta@yahoogroups.com
> [mailto:[EMAIL PROTECTED] On Behalf Of Vikas Garg
> Sent: 13. februar 2006 11:06
> To: development-axapta@yahoogroups.com
> 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: development-axapta@yahoogroups.com
> [mailto:[EMAIL PROTECTED] On Behalf Of daniellim_yh
> Sent: Saturday, February 11, 2006 6:29 AM
> To: development-axapta@yahoogroups.com
> 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! Autos. Looking for a sweet ride? Get pricing, reviews, &
more on new and used cars.
>
> [Non-text portions of this message have been removed]
>
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.