I am a newbie in ax programmer. I want to find exactly the method will
disable/enable menuiem or another control in ax for example : when I click
purchase order with status Invoice, I can not select Posting ->Invoice or
Packing slip, and when I click purchase order with status purchase order I
can select Posting ->invoice, packing slip.. How can I find exactly method in
system will use for disable/enable menuitembutton or another controls ?
Thanks and best regard
Trieu nguyen
Thanks you so much for your reply. I am very confuse with your answer. I
aleady click in PurchTable form and I click in purchase order after that I
click in Posint-> Invoice or Packing slip.. I want to find exactly the
system method will use for disable/enable menuitem in this form ? I already
find method (Click) of menuitem group but I do not see the method will
disable/enable the menuitembutton .
Thanks and best regard
Trieu nguyen
I assume the 'enabled(true/false)' property on the menuItemButton Object is
used for that ... if this was your question (which I don't be sure about ..).
Regards
Patrick
More detailed steps if you're having trouble:
Step 1:
Go to your button in the AOT, and set the Autodeclaration property of the
button to Yes. This will make sure you can modify the properties of this
button from code.
Step 2:
Go to the form datasource and overwrite the method 'active'.
In this method you can enable/disable the button depending on values of the
selected record, eg:
if(purchTable.purchStatus == PurchStatus::invoiced)
{
yourbutton.enabled(true);
}
else
{
yourbutton.enabled(false);
}
- yourbutton == the name of the button control you set the autodeclaration
property to yes of.
- enabled() == the method that lets you enable and disable controls on a form.
Hope this helps,
Best regards,
Klaas.
----------------
http://www.artofcreation.be
Thanks you so much for your reply. I want to find exactly the system method
will use disable/enable menuitembutton(Posting) in PurchTable form.
Thanks and best regard
Trieu nguyen
Thanks you so much for your reply. I find in active method but I do not see
ButtonHeaderUpdateNow(Posting) in here and I want to find exactly the method
will disable/enable menuitembutton (Purchase order,Invoice,Packing slip etc).
I find in document I see I must override
PurchTableType.CanInvoiceBeUpdated().. for enable/disable for menuitembutton
invoice .. but I can not find method in purchTable will call this method ?
Thanks and best regard
Trieu nguyen
Oh, in this case, I believe the method you're looking for is in the class
PurchTableForm, method enableUpdateJournalButtons().
It says:
/// <summary>
/// Sets the enabled property on buttons used for posting purchase orders.
/// </summary>
This method is called when you click the posting button on the form:
\Forms\PurchTable\Designs\Design\[Group:Table]\[ButtonGroup:ButtonHeader]\[MenuButton:ButtonHeaderUpdateNow]\Methods\clicked
The values (enable or disable) come from the method purchtable.checkIfUpdate
(it returns a container).
This in turn call the method PurchTableType.checkIfUpdate(), which calls the
method purchTableType.canInvoiceBeUpdated().
Hope this helps.
Best regards,
Klaas.
----------------
http://www.artofcreation.be
Thanks you so much for your reply. It is exactly but when i debug this
method the system do not run when I click the button posting(My machine
already installl the Microsoft dynamics ax 2009 debugger and I can debug some
method) so i am not sure when i click button posting the first method system
use is enableUpdateButtonJournal().
Thanks you so much for your reply. It is great for me. I will check it . I
thinks it will helpfull for me.
Thanks and best regard