cancel
Showing results for 
Search instead for 
Did you mean: 

unable to disable a button

Former Member
0 Kudos

I use following code to disable a button on a UDO form, but the status of Enable of that button doesnot change. I still can click on

the button.

oFormIQCQ.Items.Item("btnIQC").Enabled = False

I even tried to add another button and had the similar code to disable it. However I still failed.

But this situation didnot happen on my another UDO forms. Does anyone know what the problem is?

Thanks for your reply.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Chao,

Though your code is correct, there might be few reason why these pesky things happen. Check if any of the following things happen in that form.

1. Make the button disabled in the screen painter itself, and check if it works.

2. See if in any particular event you want to disable the button and check if thats handled properly.

3. If the button is disabled in any particular mode of the form, like say in Find Mode or Add Mode, make it disabled in the Menu Event on the press of 1282 / 1281 and so on...

Hope this helps.

Regards,

Satish. B.

Former Member
0 Kudos

Hi, Satish,

Thanks for your reply. What I had done before I post this question includes:

1. Make the button disabled in the screen painter itself, and check if it works.

=> I had tried that, but still failed. No mather I made the button disable or enable in the screen painter, I cannot change its status.

Even, as I mentioned before, to add a new one button in the screen painter doesnot work either.

2. See if in any particular event you want to disable the button and check if thats handled properly.

=> In VS2005 debug mode, I had traced the program by adding breakpoint to every codes that will change the status of the button.

No other codes tried to change the status of button after the code I mentioned.

3. If the button is disabled in any particular mode of the form, like say in Find Mode or Add Mode, make it disabled in the Menu Event on the press of 1282 / 1281 and so on...

=> I will try this.

former_member682029
Contributor
0 Kudos

Hi

Do these

1. Set "SetAutomanagedAttributes" to the item (button)

2. Set "oForm.Automanaged = True"

SetAutomanagedAttribute method details are available in SDK help

This will solve all your issues

Anoop

Former Member
0 Kudos

Hi, Anoop,

The status of buttons can be changed throgh your suggestion. Thanks very much.

But I have some questions about SetAutoManagedAttribute.

1. I use "oitem.SetAutoManagedAttribute" to replace every "oitem.enable = true(or false)" . Is this exactly what you suggest?

Or only need to have some "oitem.SetAutoManagedAttribute" settings after the form is loaded?

2. Could you explain the function of the following code?

oItem.SetAutoManagedAttribute(SAPbouiCOM.BoAutoManagedAttr.ama_Editable, SAPbouiCOM.BoAutoFormMode.afm_All, SAPbouiCOM.BoModeVisualBehavior.mvb_Default)

former_member682029
Contributor
0 Kudos

hi

Since you are using UDO form, you can easily work with this method

This method is using to enable / disable / visible / invisible form items as per the form mode.

That means you can code in Add mode which items should be visible / invisible / enable / disable etc. Like all other modes.

The above code means the Editable property (enable / disable) will be the default for all form modes.

Anoop

Former Member
0 Kudos

Thanks, I got it.

Answers (0)