button moved after resizing form
Ina Colman
Hello,I placed a button on a form.
With the replace method of cs customize I changed the position of the button. This position is left at the bottom of the form.
I exported the cs rule and imported the rule on another system. Without changing a parameter, the position of the button is changed.
! After I resize my form the button is moved to the original position.
How do I get the button from the first time at the right position?
Bye,
Ina
Michael Egloff
Hello Ina,moving items is depending on several conditions such as screen resolution and font size.
Maybe this is the cause of the problem.
Manuel Marhold
Hi Ina,playes check if you set the property "LinkTo" -> if not, do this: Enter the itemID of an item next to your button.
Ina Colman
Hi Manuel,Where can I set this property?
Bye,
Ina
Manuel Marhold
Hi Ina,Pseudocode, not tested:
item.GetFromUID().LinkTo="___" <- ___ = uniqueID of the button ect to you item
unknown
Good day,If you have to move too many COM items on one form, then do not use Customizer's ItemPlacement tool. It is better to use Optimizer's FormLoad property and change location of each item programmatically: you are able then to align your item according to other items on the form, regardless of the forms size.
So far about opening differently sized form.
But what about when the user resizes form after it is opened?
Once again you will need to use Optimizer's FormLoad property and add the Resize event to pVal.Form.
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Obtain an SAP COM form object
SAPbouiCOM.Form o_Form1 = ((SAPbouiCOM.Form) SwissAddonFramework.B1Connector.GetB1Connector().Application.Forms.Item(pVal.Form.UniqueID));
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Add resizing event
pVal.Form.AddHandler_Resize(SwissAddonFramework.UI.Components.ModeComponent.FormModes.ALL, null, new SwissAddonFramework.UI.EventHandling.ItemEvents.FormResizeEventHandler(delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.FormResize o_f1_eventVal)
{
// Resize given items accordingly
o_Form1.Items.Item( ....).Left = ....;
o_Form1.Items.Item( ....).Top = ....;
}
));
If you like, you can also set a break at Form's minimum width and height so that it will not move or scale down (in case of rectangles) below a certain point.
Best Regards,
-
0
Please sign in to leave a comment.
Comments
0 comments