Aleksey Bochkov
Oct 15, 2015 11:49 PM
Active user
Points:: 0
Joined:: Nov 19, 2012
Hi Mehmet Tuğrul SARIÇİÇEK, Here is an example how to dynamically create buttons and input fields:
Code //Add new command and button
ButtonCode = "NewButton";
FormCommand = ThisForm.Commands.Add(ButtonCode);
FormCommand.Action = "ButtonClick";
FormCommand.Title = "ButtonClick";
NewButton = Items.Add(ButtonCode, Type("FormButton"));
NewButton.Type = FormButtonType.UsualButton;
NewButton.CommandName = ButtonCode;
NewButton.Title = "Push me!";
NewButton.Picture = PictureLib.AddToFavorites;
NewButton.Representation = ButtonRepresentation.PictureAndText;
//add new input fields - checkbox and text input
NewAttributes = New Array;
NewAttributes.Add(New Structure("FieldCode,Type,Boolean", "FieldBoolean", New TypeDescription("Boolean"), True));
NewAttributes.Add(New Structure("FieldCode,Type,Boolean", "FieldString", New TypeDescription("String"), False));
AddDetails = New Array;
For Each Page In NewAttributes Do
Attribute = New FormAttribute(Page.FieldCode, Page.Type, , Page.FieldCode, True);
AddDetails.Add(Attribute);
EndDo;
ThisForm.ChangeAttributes(AddDetails);
For Each Page In NewAttributes Do
Control = Items.Add(Page.FieldCode, Type("FormField"));
Control.Type = ?(Page.Boolean, FormFieldType.CheckBoxField, FormFieldType.InputField);
Control.DataPath = Page.FieldCode;
EndDo;
Profile