Discussion:
Method disable/ Enable menuItembutton
(too old to reply)
Trieu nguyen
2010-02-15 02:31:01 UTC
Permalink
Hi All,

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
sams
2010-02-15 03:26:01 UTC
Permalink
Hi Trieu,
Have a look at Forms\LedgerJournalTransVendPaym\enableButtonsActive
and http://msdn.microsoft.com/en-us/library/aa882795.aspx.
Hope this helps.
Post by Trieu nguyen
Hi All,
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
Trieu nguyen
2010-02-15 03:43:01 UTC
Permalink
Hi Sams,

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
Post by sams
Hi Trieu,
Have a look at Forms\LedgerJournalTransVendPaym\enableButtonsActive
and http://msdn.microsoft.com/en-us/library/aa882795.aspx.
Hope this helps.
Post by Trieu nguyen
Hi All,
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
Luegisdorf
2010-02-15 09:24:01 UTC
Permalink
Hi Trieu

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
Post by Trieu nguyen
Hi Sams,
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
Post by sams
Hi Trieu,
Have a look at Forms\LedgerJournalTransVendPaym\enableButtonsActive
and http://msdn.microsoft.com/en-us/library/aa882795.aspx.
Hope this helps.
Post by Trieu nguyen
Hi All,
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
Klaas Deforche
2010-02-15 13:21:01 UTC
Permalink
Hi Trieu,

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
Post by sams
Hi Trieu
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
Post by Trieu nguyen
Hi Sams,
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
Post by sams
Hi Trieu,
Have a look at Forms\LedgerJournalTransVendPaym\enableButtonsActive
and http://msdn.microsoft.com/en-us/library/aa882795.aspx.
Hope this helps.
Post by Trieu nguyen
Hi All,
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
Trieu nguyen
2010-02-16 01:48:01 UTC
Permalink
Hi Klaas,

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
Post by sams
Hi Trieu,
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.
Go to the form datasource and overwrite the method 'active'.
In this method you can enable/disable the button depending on values of the
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
Post by sams
Hi Trieu
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
Post by Trieu nguyen
Hi Sams,
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
Post by sams
Hi Trieu,
Have a look at Forms\LedgerJournalTransVendPaym\enableButtonsActive
and http://msdn.microsoft.com/en-us/library/aa882795.aspx.
Hope this helps.
Post by Trieu nguyen
Hi All,
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
Klaas Deforche
2010-02-16 08:45:01 UTC
Permalink
Hi Trieu,

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
Post by Trieu nguyen
Hi Klaas,
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
Post by sams
Hi Trieu,
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.
Go to the form datasource and overwrite the method 'active'.
In this method you can enable/disable the button depending on values of the
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
Post by sams
Hi Trieu
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
Post by Trieu nguyen
Hi Sams,
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
Post by sams
Hi Trieu,
Have a look at Forms\LedgerJournalTransVendPaym\enableButtonsActive
and http://msdn.microsoft.com/en-us/library/aa882795.aspx.
Hope this helps.
Post by Trieu nguyen
Hi All,
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
Trieu nguyen
2010-02-17 00:13:02 UTC
Permalink
Hi Klaas,

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 and best regard

Trieu nguyen
Post by sams
Hi Trieu,
Oh, in this case, I believe the method you're looking for is in the class
PurchTableForm, method enableUpdateJournalButtons().
/// <summary>
/// Sets the enabled property on buttons used for posting purchase orders.
/// </summary>
\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
Post by Trieu nguyen
Hi Klaas,
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
Post by sams
Hi Trieu,
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.
Go to the form datasource and overwrite the method 'active'.
In this method you can enable/disable the button depending on values of the
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
Post by sams
Hi Trieu
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
Post by Trieu nguyen
Hi Sams,
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
Post by sams
Hi Trieu,
Have a look at Forms\LedgerJournalTransVendPaym\enableButtonsActive
and http://msdn.microsoft.com/en-us/library/aa882795.aspx.
Hope this helps.
Post by Trieu nguyen
Hi All,
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
sams
2010-02-17 06:50:04 UTC
Permalink
Hi Trieu,
If I understand it correcly you need to use the "breakpoint" keyword.
Have a look here but be mindful of this: "Please note that using breakpoint
has a serious side effect:The breakpoint will be hit by all user sessions!
This is definitely something you don't want to do in a live environment.
http://blogs.msdn.com/emeadaxsupport/archive/2009/07/13/tips-tricks-around-debugging-x-code-in-dynamics-ax.aspx.
Trieu nguyen
2010-02-17 08:23:01 UTC
Permalink
Hi Sams,

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
Post by sams
Hi Trieu,
If I understand it correcly you need to use the "breakpoint" keyword.
Have a look here but be mindful of this: "Please note that using breakpoint
has a serious side effect:The breakpoint will be hit by all user sessions!
This is definitely something you don't want to do in a live environment."
http://blogs.msdn.com/emeadaxsupport/archive/2009/07/13/tips-tricks-around-debugging-x-code-in-dynamics-ax.aspx.
Karin
2011-10-07 10:34:35 UTC
Permalink
Hei,
sorry for bad English :(
In payroll calculation worksheet is field "sessionId" (if someone has opened a worksheet then this field > 0, else =0). Hw to get the button to be disabled as soon as this field is> 0?

________________________
void checkBlocked()
{
xSession session;
;
if (pclCalcJourTable.SessionId && pclCalcJourTable.RecId)


{

session = new xSession(pclCalcJourTable.SessionId, true);

if (!session || !session.userId())
{
pclCalcJourTable.SessionId = 0;
pclCalcJourTable.SessionLoginDateTime = utcDateTimeNull();
pclCalcJourTable.doUpdate();
}

btnJournalLines.enabled(false);
}
}
Post by Trieu nguyen
Hi All,
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
Post by sams
Hi Trieu,
Have a look at Forms\LedgerJournalTransVendPaym\enableButtonsActive
and http://msdn.microsoft.com/en-us/library/aa882795.aspx.
Hope this helps.
Post by Trieu nguyen
Hi Sams,
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
Post by sams
Hi Trieu
I assume the 'enabled(true/false)' property on the menuItemButton Object is
used for that ... if this was your question (which I do not be sure about ..).
Regards
Patrick
Post by sams
Hi Trieu,
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.
Go to the form datasource and overwrite the method 'active'.
In this method you can enable/disable the button depending on values of the
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
Post by Trieu nguyen
Hi Luegisdorf,
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
Post by Trieu nguyen
Hi Klaas,
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
Post by sams
Hi Trieu,
Oh, in this case, I believe the method you are looking for is in the class
PurchTableForm, method enableUpdateJournalButtons().
/// <summary>
/// Sets the enabled property on buttons used for posting purchase orders.
/// </summary>
\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
Post by Trieu nguyen
Hi Klaas,
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 and best regard
Trieu nguyen
Post by sams
Hi Trieu,
If I understand it correcly you need to use the "breakpoint" keyword.
Have a look here but be mindful of this: "Please note that using breakpoint
has a serious side effect:The breakpoint will be hit by all user sessions!
This is definitely something you do not want to do in a live environment."
http://blogs.msdn.com/emeadaxsupport/archive/2009/07/13/tips-tricks-around-debugging-x-code-in-dynamics-ax.aspx.
Post by Trieu nguyen
Hi Sams,
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
Trieu nguyen
2010-02-16 01:41:01 UTC
Permalink
Hi Luegisdorf,

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
Post by sams
Hi Trieu
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
Post by Trieu nguyen
Hi Sams,
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
Post by sams
Hi Trieu,
Have a look at Forms\LedgerJournalTransVendPaym\enableButtonsActive
and http://msdn.microsoft.com/en-us/library/aa882795.aspx.
Hope this helps.
Post by Trieu nguyen
Hi All,
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
Loading...