cancel
Showing results for 
Search instead for 
Did you mean: 

Form Resize Affect Column width?

Former Member
0 Kudos

Hi Folks,

I have a very strange problem. I try to add a new matrix to Production Order form. The matrix will have 2 columns which are:

1. No - Non Editable (for numbering)

2. Description (information).

My code is like the following:

oItem = oForm.Items.Add("mxRoute", SAPbouiCOM.BoFormItemTypes.it_MATRIX)

oItem.Left = 12

oItem.Width = 532

oItem.Top = 136

oItem.Height = 183

oItem.FromPane = 3

oItem.ToPane = 3

oMatrix = oItem.Specific

oColumns = oMatrix.Columns

'//***********************************

'// Adding Culomn items to the matrix

'//***********************************

oColumn = oColumns.Add("#", SAPbouiCOM.BoFormItemTypes.it_EDIT)

oColumn.TitleObject.Caption = "#"

oColumn.Width = 20

oColumn.Editable = False

oColumn = oColumns.Add("Col1", SAPbouiCOM.BoFormItemTypes.it_EDIT)

oColumn.TitleObject.Caption = "Operations"

oColumn.Width = 500

oColumn.Editable = True

The problem occured when i try to maximize my form. The first Col (#) will resize to a very big size!!! When i try to resize it to smaller form, it still very big column. Anybody has clue what should i do to the form since it is not possible to restrict the form type to Fixed???

Your help will be very appreciated..

Rgds,

Harianto Ng

Accepted Solutions (1)

Accepted Solutions (1)

AdKerremans
Active Contributor
0 Kudos

Hi Harianto Ng,

Catch the after resize event and resize both columns by hand.

1. calculate width of columns 1 + 2

2 resize the first to 20

3 resize the second to totalwidth-20

Regards

Ad

andy313
Explorer
0 Kudos

Is there an option to stop SAP from resizing column width every time the user resizing the form?

I create a new user form in SAP B1 9.2 that has a grid in it. On creating the form I will changing all column width's to the right width. And then when the user is changing the form size all widths in the grid will change again to a wrong width. Sure I can change the widths in the after resize event as Ad Kerremans is suggested.. but this is not good programming practices and not relay good for the performance...

So: is there a Option the prevent SAP from resize the grid width on the forms resize event?

Thanks

Andy

Answers (1)

Answers (1)

AdKerremans
Active Contributor
0 Kudos

Hi Andy,

Did you try to set Grid.AutoResizeColumns to false?

Regards

Ad

andy313
Explorer
0 Kudos

Hi Ad

Yes I try it; it's not workling =(

Andy