cancel
Showing results for 
Search instead for 
Did you mean: 

Anyone used et_FORM_DRAW?

Former Member
0 Kudos

Hi experts,

I was wondering how to catch this event. I already set it to the filters and associate it with a form. In theory the event should raise in the FormLoadAfter but I can never catch it. Please share your experiences.

Regards

Accepted Solutions (1)

Accepted Solutions (1)

former_member185682
Active Contributor

Hi Cristian,

This event is catched in ItemEvent.

To complement:

A form was drawn (ItemEvent).

The before event would raise after the FormLoadAfter event and before the form was drawn.
And after the form was drawn, which means all form items location/size is determined (for system form), the after form draw event would be raised.


Best regards,

Diego Lother


View Diego Lother's profile on LinkedIn

Message was edited by: DIEGO LOTHER

Former Member
0 Kudos

Hi Diego,

Yes, I also thought that wil be the case, but it never gets raised.

I set the filters like this

EFilter = EFilters.Add(SAPbouiCOM.BoEventTypes.et_FORM_DRAW)

EFilter.AddEx("MYUDO")

oApp.SetFilter(EFilters)

the catch the itemevent for that UDO and I make a Select Case for the eventtype.

It raises events like chosefromlist, validate, lostfocus etc etc. But the Draw event never comes...

or is is a eventy only native forms have?

former_member185682
Active Contributor
0 Kudos

Hi Cristian,

I have tested without use filters and even so, the event was not fire for UDO Form, but works fine for system form. If the event only works for native forms is not described in "SDK help" and I do not have assurance about this.

But I saw that have et_UDO_FORM_OPEN in UDOEvent, this event is fired before the Form be showed to the user, maybe can help you.

Hope it helps.


Best regards,

Diego Lother


View Diego Lother's profile on LinkedIn

former_member185682
Active Contributor
0 Kudos

Cristian,

I saw a curious thing, if your UDO was registered with matriz style, the et_FORM_DRAW is fired.

Hope it helps.


Best regards,

Diego Lother


View Diego Lother's profile on LinkedIn

Former Member
0 Kudos

Diego,

Thanx for the update, I have an UDO with header and lines I need to modify (add valid values to a combobox) and I cant do it after the form load event cause it doesnt finde the items.

Anybody has some advice?

former_member185682
Active Contributor
0 Kudos

Cristian,

I tried find some solution based in your needs, but without success.

I have a question, if is an UDO, why do not you  add a valid value in your database field?


Best regards,

Diego Lother


View Diego Lother's profile on LinkedIn

Former Member
0 Kudos

The thing is that I have already the validvalues in the DB, but I need to hide some or show depending on the user. So the Default UDO combobox doesnt have any valid values, I have to add them depending on some factors.

So what i need is to catch some event after the UDO is completly loaded so i can use the combobox in order to add the validvalues. This needs to be done in the back so the user has the validvalues only for him.

Any ideas?

former_member185682
Active Contributor
0 Kudos

Cristian,

If you don't find any other solution, I think that this workaround helps you:


        //A generic field to maintain the last event.

        private static SAPbouiCOM.BoEventTypes pLastEvent = SAPbouiCOM.BoEventTypes.et_ALL_EVENTS;

        static void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)

        {

            BubbleEvent = true;

            //After your form fire the visible event, the next event of the form is focus event with et_GOT_FOCUS.

            //Add other params in your condition if is necessary.

            if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_GOT_FOCUS && !pVal.BeforeAction && pLastEvent == SAPbouiCOM.BoEventTypes.et_FORM_VISIBLE)

            {

                SAPbouiCOM.Form oForm = SBO_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount);

                SAPbouiCOM.ComboBox cb = (SAPbouiCOM.ComboBox)oForm.Items.Item("id your control").Specific;

                cb.ValidValues.Add("1", "Test");

            }

            pLastEvent = pVal.EventType;

        }

Hope it helps.


Best regards,

Diego Lother


View Diego Lother's profile on LinkedIn

edy_simon
Active Contributor
0 Kudos

Hi Cristian,

Do you use the "Default Form" and let SBO draw your form ?

Or you have another XML that you call to draw the form from your code?

Regards

Edy

Former Member
0 Kudos

Hi Edy,

I use the default form of the UDO in order to make the changes described above.

Regards

edy_simon
Active Contributor
0 Kudos

Hi Nunez,

In this case, the workaround is to fill up your combo on ComboSelectBefore event.

Check if your ValidValues is already populated.

If it is not, populate it here.

Regards
Edy

Former Member
0 Kudos

Thanks Edy,

I am doing it right now, but since the combo has several validvalues (around 79) I notice some performance issues. The user can select a combo more than once and the function must execute itself again. Thats why I was wondering if it was possible to do it when the UDO form opens and forget about it.

Thanks anyway. Hope this event could be triggered in the future.

Best regards

edy_simon
Active Contributor
0 Kudos

Hi Cristian,

Before you re-populate,

You need to check first if your CBO has valid values, if it already has, don't re-populate.


Regards

Edy

Answers (0)