Hi
I was able to disable the hide functionality entirely in all forms by placing
code in the SysSetupFormRun class. If you add the line of code below into the
class' init() method before the super call you'll find that the Hide option is
not available on the context menu in any form.
this.form().design().allowUserSetup(false);
When I did this I felt it a little too restrictive so used a new security key
to determine whether the code should be executed (so that only some users were
denied the right to change their form setup) and I included the option to
override this entirely on some forms using an optional method placed on forms
that still need to have form setup and accessed through reflection. So, my bit
of code looks like this...
if ( new DictSecurityKey(SecurityKeyNum(GhsHideShow)).rights() <
AccessType::Delete )
{
// User doesn't normally have rights to use Hide/Show - check if there
is form level override
if ( formHasMethod(this, IdentifierStr(GhsAlwaysEnableHideShow)) )
{
// Form has override - check how it should be applied
formRunObj = this;
if ( ! formRunObj.GhsAlwaysEnableHideShow() )
{
// Override not enabled - so disable Show/Hide (& form setup!)
this.form().design().allowUserSetup(false);
}
}
else
{
// Nor form override so just disable Show/Hide (& form setup!)
this.form().design().allowUserSetup(false);
}
}
Regards
Malcolm Burtt
Touchstone Group
People - Partnership - Solutions
From: [email protected]
[mailto:[email protected]] On Behalf Of christian.myrvold
Sent: 10 February 2009 07:59
To: [email protected]
Subject: Re: SV: [development-axapta] How to show field hidden by user in X++
Thanks for the responses.
I tried what somanna suggested, but it didn't work. I talked with our
client, and they said that it's good enough that the whole form cannot
be altered (which can be done with parameters in the form). At least
it solves the problem, although it's a little like beating a fly with
a sledgehammer.
But it would be nice to know if it's even possible to do such a thing
at runtime, denying the ability to alter a form field instead of the
whole form.
--- In
[email protected]<mailto:development-axapta%40yahoogroups.com>,
"Dahlsgaard Jan" <j...@...>
wrote:
>
> very bad idea.
> You are changing code in aot on runtime, and unless you change it
back, it will be like that next time you open the form, and also all
other places this field is used.
> There might even be a problem with missing X++ license, or if the
user doesn't have access to SysDevelopment.
>
> ________________________________
>
> Fra:
> [email protected]<mailto:development-axapta%40yahoogroups.com>
[mailto:[email protected]<mailto:development-axapta%40yahoogroups.com>]
På vegne af somanna gl
> Sendt: 5. februar 2009 04:45
> Til:
> [email protected]<mailto:development-axapta%40yahoogroups.com>
> Emne: Re: [development-axapta] How to show field hidden by user in X++
>
>
>
>
> str Property;
> TreeNode TreeNode;
> str Name;
> ;
>
> Name = "CustTable";
> TreeNode = TreeNode::findNode("Data Dictionary\\Tables\\" /*+ Table*/);
> if (TreeNode)
> {
> ttsbegin;
> Property = TreeNode.AOTgetProperties();
> Property = SetProperty(Property, "visible", "Yes");
> TreeNode.AOTsetProperties(Property);
> TreeNode.AOTcompile();
> TreeNode.AOTsave();
> }
>
> ________________________________
> From: christian.myrvold <christian.a.myrv...@...
<mailto:christian.a.myrvold%40gmail.com> >
> To:
> [email protected]<mailto:development-axapta%40yahoogroups.com>
<mailto:development-axapta%40yahoogroups.com>
> Sent: Monday, February 2, 2009 6:45:33 PM
> Subject: [development-axapta] How to show field hidden by user in X++
>
> Hey everyone,
>
> I've searched both the group postings and google for this, and haven't
> found anything yet. I need to either:
>
> 1. Show a field in a form immediately after a user hides it (so it
> looks like the "hide functionality" doesn't work), or
> 2. Disable the hide functionality when a user right clicks on the field.
>
> I would say the the first is preferrable, if it's at all possible.
>
> Sincerely,
> Chris
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
[Non-text portions of this message have been removed]