Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

A function to set the size and position of an object.

Hi, everybody

We write our add-ons using VB.NET in Visual Studio.

Everything is coded in VB.NET / SDK, and we don't use B1DE (yet). We must find time to learn that tool someday!.

The sizes and positions of all objects are coded like:

        oItem = oForm.Items.Add("EditTxt", SAPbouiCOM.BoFormItemTypes.it_EDIT)

       oItem.Left = 820

        oItem.Width = 125

        oItem.Top = 750

        oItem.Height = 10

        oEdit1 = oItem.Specific

     

As we use a large number of these codes, I am wondering if we can use a function (or should we use a sub?) to code the dimensions.

For ex. we could have a function called LeftWidthTopHeight(), so that the lines in bold above could be replaced by a single line:

LeftWidthTopHeight(820,125,750,10)

Sometimes we develop very lengthy add-ons; so this could reduce coding.

Any ideas on how to achieve this are most welcome.

Thanks

Leon

replied

Hi Leon,

Everything is coded in VB.NET / SDK, and we don't use B1DE (yet). We must find time to learn that tool someday!.

I don't recommend you to start with B1DE since i think with the new B1Studio for VS, the B1DE (B1Wizardbase to be more precise) will be obsolete. More over there is no official B1DE for 64 bit addon.

You should go direct to B1Studio for VS. Almost the same, but a bit different from the sample I gave you your multiple classes post.

As for this question, you should really draw your form in srf/xml and load them using the LoadBatchActions method of SBO_Application.

If you still want to stick with your current way, of course you can always create a sub/function for this

Public Sub ResizeItem(ByRef oItem as SAPbouiCOM.Item, Left as Integer, Top as Integer, Height as Integer, Width as Integer)

     oItem.Left = Left

     oItem.Top = Top

     oItem.Height = Height

     oItem.Width = Width

End Sub

Place the above code in a Module so that it is accessible anywhere in your project.

You call in your code

        oItem = oForm.Items.Add("EditTxt", SAPbouiCOM.BoFormItemTypes.it_EDIT)

        'oItem.Left = 820

        'oItem.Width = 125

        'oItem.Top = 750

        'oItem.Height = 10

        ResizeItem(oItem, 820,750,10,125)

        oEdit1 = oItem.Specific

Regards
Edy

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question