How to create custom view in run time in kony.For example in android we create a button like
Button mBtn = new Button(activity.getApplicationContext());
similarly in kony how to create a view,Textfiled,Buttons in kony.
How to create custom view in run time in kony.For example in android we create a button like
Button mBtn = new Button(activity.getApplicationContext());
similarly in kony how to create a view,Textfiled,Buttons in kony.
To create a dynamic view, you need to set the properties for your Form
//Form basic configuration
var basicConf = {
id:"frmDynamic",
postShow:ShowPostShowAlert
};
//Form layout configuration
var layoutConf = {
displayOrientation:"FORM_DISPLAY_ORIENTATION_PORTRAIT",
padding:[5,5,5,5],
paddingInPixel:true
};
//Form Platform Specific Properties configuration
var platformConf = {
onDeviceBack:ShowOnBackAlert
};
Once you have all the properties, create an instance of Form2 and assign the properties that you created
//Create the form
var frmDynamic = new kony.ui.Form2(basicConf, layoutConf, platformConf);
Let's add a textbox into your Form. Just like the form, you need to set the properties for your textbox
//Textbox Basic Configuration
var textboxBC = {
id:"txtDynamic",
isVisible:true,
placeholder:"Type here..."
};
//Textbox Layout Configuration
var textboxLC = {
hExpand:true,
margin:[2,2,2,2],
padding:[0,0,0,0],
marginInPixel:true,
paddingInPixel:true
};
//Textbox Platform Specific Properties Configuration
var textboxPC = {
toolTip:"Dynamic TextBox"
};
Create the instance of TextBox2
//Create the Textbox
var txtDynamic = new kony.ui.TextBox2(textboxBC textboxLC, textboxPC);
Now add the textbox in the form and show your Form
frmDynamic.add(txtDynamic);
frmDynamic.show();
Hope it helps.