I am really pulling my hair out trying to position a text box on the screen.
I have added a new folder on the service call screen. This folder's pane level is set to 8. Now I want to add a check box onto that folder. I get the position of another item on the screen (let's say the Origin combo box on the first folder) and then I set my new item's top position to the same position as the Origin combo box. My code:
aItem = oForm.Items.Item("67") 'Origin Combo Box
oItem = oForm.Items.Add("chk_Refr", SAPbouiCOM.BoFormItemTypes.it_CHECK_BOX)
oItem.Left = 10
oItem.Top = aItem.Top
oItem.FromPane = 8
oItem.ToPane = 8
oCheck = oItem.Specific
oCheck.Caption = "Refrigeration"
This code does not put it in the same top position as the Origin Combo box, but almost half way down the screen. I have tried various other top values. I have started at 10, which puts it right at the top of the screen, I go down to about 180 which puts it just above the row of folders.
BUT it seems like as soon as I move it onto the folder, at let's say Top = 200, it moves it down to 200 from the top of the folder! So it's way down. The difference from Top = 180 to Top = 200 is about 10cm (4 inches) on my screen?????
It does the same even if I remove the FromPane and ToPane property setting.
Also, I have a matrix on another tab that I also added, which I set to the same top position and that works great, no problem. Seems like it's only with the check box?
Thanks for any help in advance,
The problem: the window has been resized, and you put your checkbox on et_form_load
Try the following:
Add you checkbox at et_form_load and pval.before_Action = false
at et_form_resize event and pval.Before_Action = false set the checkbox relative position to an existsing system created item.
This is always working, and you hair will be remain on your head:)