problems when using Rectangle


Dear CoreSuite guys,
Strictly for cosmetic reasons I've tried to use Rectangle item.
When I type the usual stuff necessary for UI component creation:

// create rectangle
SwissAddonFramework.UI.Components.Rectangle o_f1_r1 = SwissAddonFramework.UI.Components.Rectangle.CreateNew("rct_0001");

I will get CS compilation error:
No overloads for method "CreateNew" takes '1' argument (CS1501)
However when I type:

// create rectangle
SwissAddonFramework.UI.Components.Rectangle o_f1_r1 = SwissAddonFramework.UI.Components.Rectangle.CreateNew();
o_f1_r1.UniqueID = "rct_0001";
o_f1_r1.Left = 20;
o_f1_r1.Width = 100;
o_f1_r1.Top = 20;
o_f1_r1.Height = 100;
o_f1_r1.Visible = true; // useless, but just to make sure
o_f1_r1.ForegroundColor = System.Drawing.Color.Black; // giving it a color cause it was empty
o_f1_r1.Type = SwissAddonFramework.UI.Components.Item.ItemType.Rectangle;
...the code will compile and execute, but no rectangle will be visible.
However the GetFromUID in:

SwissAddonFramework.UI.Components.Rectangle o_f1_r2 = SwissAddonFramework.UI.Components.Rectangle.GetFromUID(o_f1, "Rect1");
Is able to propery return an SAPSDK control.
It thus the SDK-way the only way?

Thank you in advance.

Manuel Marhold

Dear unknown..

check if there are PaneLevels given in the form.
If you don't give your item From- and ToPane, but the form has a panelevel, the item won't be displayed!


Thank you very much for your answer Manuel.

The code I've posted above was a part of my own Pane-less form. (created through NewMenu).

Nevertheless, following your advice I have also tested it using Form's PaneLevel and Rectangle's FromPane/ToPane properties.
But all without satisfactory results.

The interesting thing about such SwissAddonFramework Rectangle item (the o_f1_r1 in the code above) is that - per default, that is, until I set the color to Black - it does not contain foregroundcolor. The...
MessageBox.Show("fgc=" + o_f1_r1.ForegroundColor.ToString() , "OK");
...returns: Color [Empty].

While SAPSDK rectangle, created in the following way:
SAPbouiCOM.Form o_Form1 = ((SAPbouiCOM.Form) SwissAddonFramework.B1Connector.GetB1Connector().Application.Forms.Item(o_f1.UniqueID));
SAPbouiCOM.Item o_f1_Item1 = null;
o_f1_Item1 = o_Form1.Items.Add( "rct_0001", SAPbouiCOM.BoFormItemTypes.it_RECTANGLE );
o_f1_Item1.Left = 20;
o_f1_Item1.Width = 100;
o_f1_Item1.Top = 100;
o_f1_Item1.Height = 100;
o_f1_Item1.FromPane = 1;
o_f1_Item1.ToPane = 1;

Returns -1 color. Which equals color White.

Best Regards,

Manuel Marhold

I think i cannot help you with this..

Michael Egloff

Hello unknown

I'm gonna put your question into the framework section, because it's more like a framework question and I can't see where the problem is...



Please sign in to leave a comment.

Didn't find what you were looking for?

New post