How can create a new form pressing a button?
Emanuele Croci
Dear all,when I press a button in a SAP form I'd like to open a new form containing a grid.
Here, I write my code:
...
...
SwissAddonFramework.UI.Components.Form newForm = SwissAddonFramework.UI.Components.Form.CreateNewForm("1111", "TCForm");
SwissAddonFramework.UI.Components.Grid myGrid = SwissAddonFramework.UI.Components.Grid.CreateNew("TC_Grid");
myGrid.FromPane = 77;
myGrid.ToPane = 77;
newForm.AddItem(myGrid);
newForm.Visible = true;
...
but nothing happens...
Can some one help to visualize my form?
Regards
Emanuele
Manuel Marhold
Hi Emanuele,I think you have to do an Refresh or update before you show the form.
Emanuele Croci
Dear Manuel,I added
...
newForm.Update();
...
but the new form doesn't appear.
newForm.Refresh() command doesn't exist...
I added a new row in the "Function buttons" section to add a new button in the Bill of Materials form. Then I added my source code in the Edit window to create and visualise a new form when I press this button.
Does an example exist? Some examples? Source codes?
Please, where can I download the chm file (Customize sdk help) with all the Customize classes and their methods and members?
Regards
Emanuele
Manuel Marhold
Hi Emanuele,you can find it here: http://www.coresystems.ch/forum.html?&tx_mmforum_pi1[action]=list_post&tx_mmforum_pi1[tid]=2628
please take a look at the SAP Menu "Windows" if you can find an empty entry or an entry with the name of your form, after you ran your code.
Emanuele Croci
Thank you Manuel!I resolved my issue. This is my code:
SwissAddonFramework.UI.Components.Form newForm = SwissAddonFramework.UI.Components.Form.CreateNewForm("TCForm", "TCForm" + SwissAddonFramework.Utils.UniqueStringGenerator.Next());
SwissAddonFramework.UI.Components.Grid myGrid = SwissAddonFramework.UI.Components.Grid.CreateNew("TC_Grid");
myGrid.FromPane = 77;
myGrid.ToPane = 77;
myGrid.Left = 50;
myGrid.Top = 50;
myGrid.Width = 300;
myGrid.Height = 300;
newForm.AddItem(myGrid);
Button btn = Button.CreateNew();
btn.UniqueID = "1";
btn.Top = 10;
btn.Left = 5;
btn.Value = "OK";
newForm.AddItem(btn);
newForm.Value = "Prova";
newForm.PaneLevel = 77;
newForm.Visible = true;
newForm.Load();
string query = @"SELECT T0.U_field1 as 'field1', T0.U_field2 as 'field2' FROM [dbo].[@TCPROVACUSTOM] T0 ";
myGrid.ExecuteQuery(query);
myGrid.AffectsFormMode = false;
myGrid.Columns["field1"].Editable = false;
myGrid.Columns["field2"].Editable = true;
newForm.Update();
...
I also added a button in my new form.
Now, I would like to implement a procedure when I press the button.
What should I do to implement this action?
Thank you for your help.
Regards
Emanuele
Emanuele Croci
Dear Manuel,my new button management works now.
I added a new row in the 'Customize Optimizer' and implemented my procedure in the 'Edit' window.
Thank you for your help.
Regards
Emanuele
0
Please sign in to leave a comment.
Comments
0 comments