cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a Button to the Sales Order screen

Former Member
0 Kudos

Good Day

Experts:

I have added a button to the SalesOrder screen with help from a previous post here on the forum. The button was lined up with the others that were already exisitng on the screen. Recently, I have encountered a problem with it. When the SalesOrder screen is run on a different machine, the button is almost not visible. It appears there is some kind of issue with the screen resolution just for this button.

Do I have to do something special with this button when it is shown on the screen to get it to remain in line with the existing buttons?

Thanks,

EJD

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ed

Are you setting the button in relation to the surrounding existing objects? Like for instance ...

        Dim oButton As SAPbouiCOM.Item = oForm.Items.Item("2").Specific 'Cancel button
        Dim oNewButton As SAPbouiCOM.Button
        Dim oNewItem As SAPbouiCOM.Item = oForm.Items.Item("Test") 'your new button or control
        With oNewItem
            .AffectsFormMode = True
            .Left = oButton .Left  + oButton.Width ' notice how button is positioned based on  existing one
            .Top = oButton .Top
            .Width = oButton.Width
            .Height = oButton.Height
            .FromPane = oButton.FromPane
            .ToPane = oButton.ToPane
            .TextStyle = intTextStyle
            oNewButton = .Specific
        End With
        With oNewButton 
            .Caption = strCaption
        End With

Message was edited by:

Neftali Figueroa

Message was edited by:

Neftali Figueroa

Former Member
0 Kudos

Hey There

Neftali:

I was only using the following:

oItem.Left = 300

oItem.Top = 413

oItem.Width = 75

oItem.Enabled = True

oButton.Caption = "Test"

I am not do anything with the surrouding objects...not sure how to do all that.

Should I incorporate what you have in the snippet?

Thasnk,

EJD

Former Member
0 Kudos

Ed

What I mean is that you have to create you're control according to other objects in the form.

For instance, if you are adding a button beside another button, use that button's left property + its width + 5 to set your button's left property.

That way, i believe you'll solve the problem with the resolution changing.

Former Member
0 Kudos

Ok...

So, looking at your snippet I don't understand a few places...

I see what the first 2 lines are doing. But the third line "With New Item" is a bit perplexing. I am not sure what to define that as and where. But then the oButton With statement only sets the caption.

Can you clarify what is happening there?

Appreciate the help,

EJD

Former Member
0 Kudos

I'm sorry Ed .. should be perplexed after that mistake of a code a sent you

I edited the original code. I took it from a function a have and well... you can imagine!

The oNewItem variable can in reality access any time of item on the form (button, control, textbox, etc)

The last part of the code what it does is deal with that options pertinent to that kind of control only. In this case button has only that kind of <u>specific property</u> (i believe is the only one for buttons)

See, SAP groups the properties on the items as generic and specific ( as you can see them group on the screen painter)

hope it helps

Former Member
0 Kudos

Ok, makes sense now.

When I try to inellisense on the oButton to get the .Left, .Top, .Width, .Height, .FromPane, .ToPane I only get the following selections instead .Left or .Top or .Width etc:

Caption

ChooseFromListUID

Image

Type

Can you think of what I may have incorrect over here?

Thanks,

EJD

Former Member
0 Kudos

Hi Ed;

Try to Dim your button As SAPbouiCOM.Item. Sounds like you are Dimming it as a button.

Hope that helps.

Wayne

Former Member
0 Kudos

Sorry again Ed

I edited the code message again. The oButton, which loads the button (and this is an example, you can load any other item that you want to use to base the properties of your control) should have been declared as <b>SAPbouiCOM.Item</b>

i'm a bit clumpsy today

Former Member
0 Kudos

Thanks for the help... I have the button on the screen now using the information from the Cancel button. Another "thing" learned here as I come up on 9 months working with the VB.net Add-on.

Good Day,

ED

Former Member
0 Kudos

Yes, I keep learning new ones too on this development environment ... Cheers

Answers (0)