<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="https://www.schweda.net/style_feed.css" ?>
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:atom="http://www.w3.org/2005/Atom"	
	xmlns:dc="http://purl.org/dc/elements/1.1/" > 
<channel>
    <title>schweda.net - Blog</title>
    <link>https://www.schweda.net/</link>
    <description>schweda.net - Blog - Blog-Beitraege</description>
    <language>de-at</language>
    <copyright>Copyright 2006-2026</copyright>
    <generator>schweda.net</generator>
    <managingEditor>heinz.schweda@schweda.net (Heinz Schweda)</managingEditor>
    <webMaster>heinz.schweda@schweda.net (Heinz Schweda)</webMaster>
    <category>Blog</category>
	<atom:link href="https://schweda.net/blog_rss.php?bid=621" rel="self" type="application/rss+xml" />
<item>
<title><![CDATA[SysOperation-Framework: Eigenschaften eines Dialogfeldes abhängig von anderen Dialogfeldern ändern]]></title>
<description><![CDATA[
<p>Stellt euch folgendes Szenario vor:&nbsp;Im Dialog eines SysOperation-Konstruktes muss ein Feld abh&auml;ngig von anderen Feldern manipuliert werden, beispielsweise soll die Eigenschaft <em>AllowEdit </em>ver&auml;ndert werden.
</p>


<p><img alt="Dialog" height="219" src="http://www.schweda.net/pictures/blogpics/ax2012_sysop_uiallowedit.jpg" title="Dialog" width="366" />
</p>


<p>Im folgenden findet ihr den Code f&uuml;r einen DataContract und den dazugeh&ouml;rigen UIBuilder, in welchem letztlich die entsprechende Programmlogik einzubauen ist.
</p>


<p>Hier wir abh&auml;ngig von der Auswahl im Feld <em>Module </em>entweder das Feld<em> Customer account </em>oder das Feld <em>Vendor account</em> freigeschalten.
</p>


<p>&nbsp;
</p>


<h2>DataContract
</h2>


<pre class="pre_blog_axcode">
[DataContractAttribute, SysOperationContractProcessingAttribute(classStr(TutorialSysOperationUIBuilder))]
public class TutorialSysOperationDataContract
{
    ModuleCustVend moduleCustVend;
    CustAccount custAccount;
    VendAccount vendAccount;
}
</pre>


<p>&nbsp;
</p>


<pre class="pre_blog_axcode">
[DataMemberAttribute, SysOperationControlVisibilityAttribute(true), SysOperationDisplayOrderAttribute(&#39;1&#39;)]
public ModuleCustVend parmModuleCustVend(ModuleCustVend _moduleCustVend = moduleCustVend)
{
    moduleCustVend = _moduleCustVend;

    return moduleCustVend;
}
</pre>


<p>&nbsp;
</p>


<pre class="pre_blog_axcode">
[DataMemberAttribute, SysOperationControlVisibilityAttribute(true), SysOperationDisplayOrderAttribute(&#39;2&#39;)]
public CustAccount parmCustAccount(CustAccount _custAccount = custAccount)
{
    custAccount = _custAccount;

    return custAccount;
}
</pre>


<p>&nbsp;
</p>


<pre class="pre_blog_axcode">
[DataMemberAttribute, SysOperationControlVisibilityAttribute(true), SysOperationDisplayOrderAttribute(&#39;3&#39;)]
public VendAccount parmVendAccount(VendAccount _vendAccount = vendAccount)
{
    vendAccount = _vendAccount;

    return vendAccount;
}
</pre>


<p>&nbsp;
</p>


<h2>UIBuilder
</h2>


<pre class="pre_blog_axcode">
public class TutorialSysOperationUIBuilder extends SysOperationAutomaticUIBuilder
{
    DialogField df_ModuleCustVend;
    DialogField df_CustAccount;
    DialogField df_VendAccount;
}
</pre>


<p>In der methode <em>build()</em> werden die vom Framework generierten Dialogfelder zug&auml;nglich gemacht.
</p>


<p>Hier wird bereits erstmalig die Methode <em>modifyDialogFields()</em> aufgerufen, damit gleich beim &Ouml;ffnen des Dialogs das jeweils gew&uuml;nschte Feld freigeschalten wird.
</p>


<pre class="pre_blog_axcode">
public void build()
{
    super();

    df_ModuleCustVend = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(TutorialSysOperationDataContract, parmModuleCustVend));
    df_CustAccount = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(TutorialSysOperationDataContract, parmCustAccount));
    df_VendAccount = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(TutorialSysOperationDataContract, parmVendAccount));

    this.modifyDialogFields();
}
</pre>


<p>In der Methode <em>postRun() </em>wird die <em>modify()</em>-Methode des Feldes Module &uuml;berschrieben.
</p>


<pre class="pre_blog_axcode">
public void postRun()
{
    super();

    // Override modified method
    df_ModuleCustVend.registerOverrideMethod(methodStr(FormComboBoxControl, modified),
                                             methodStr(TutorialSysOperationUIBuilder, moduleCustVend_modified),
                                             this);
}
</pre>


<p>In dieser &uuml;berschriebenen Methode rufen wir die Methode <em>modifyDialogFields()</em> auf. Hier ist wichtig, da&szlig; die Methode das richtige Parameterprofil erh&auml;lt und den von AX&nbsp;erwarteten Datentyp retourniert.
</p>


<pre class="pre_blog_axcode">
private boolean moduleCustVend_modified(FormComboBoxControl _control)
{
    this.modifyDialogFields();

    return _control.modified();
}
</pre>


<p>Die &quot;Zauberei&quot; passiert in der Methode <em>modifyDialogFields()</em>. Hier werden die Felder ent- oder gesperrt, je nach Auswahl des Wertes im Feld <em>Module</em>.
</p>


<pre class="pre_blog_axcode">
private void modifyDialogFields()
{
    df_CustAccount.allowEdit(df_ModuleCustVend.value() == ModuleCustVend::Cust);
    df_VendAccount.allowEdit(df_ModuleCustVend.value() == ModuleCustVend::Vend);
}
</pre>


<p>Nat&uuml;rlich k&ouml;nnen auf die selbe Art &amp;&nbsp;Weise zahlreiche andere Eigenschaften von Dialogfeldern dynamisch ver&auml;ndert werden.
</p>]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Sun, 26 Mar 2017 13:59:00 +0200</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=621</link>
<comments>https://www.schweda.net/blog_ax.php?bid=621</comments>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=621</guid>
<author>heinz.schweda@schweda.net (Heinz Schweda)</author>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=621</wfw:commentRss>
</item>
<item>
<title>Kommentar von jackey</title>
<description><![CDATA[The formRun() object doesnt have modifyDialogFields() method when trying it out]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Thu, 04 Jul 2024 12:54:00 +0200</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=621</link>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=621</guid>
<author>jackey</author>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Heinz Schweda</dc:creator>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=621</wfw:commentRss>
</item>
</channel>
</rss>	
