Var
MyForm:TclForm;
testListView : TClProListView;
testDesignerPanel : TClListViewDesignerPanel;
productName : TclProLabel;
approveImg, rejectImg : TclProImage;
void ApproveClick;
{
ShowMessage('Tag: ' +
TclProListView(Myform.Clsender).ClTagInt + ' Item: ' +
testListView.clSelectedItemData(clText));
}
void RejectClick;
{
ShowMessage('Kullanıcı Reddedildi!');
}
void CreateListView
{
testListView =
MyForm.AddNewProListView(MyForm,'testListView');
testListView.Properties.ItemSpace =
10;
clComponent.SetupComponent(testListview,
'{"Height" : 150,
"Align":"Client",
"MarginBottom":20,
"MarginTop":20,
"MarginRight":20,
"MarginLeft":20,
"ListType":"Cart",
"ItemColumnCount" : 1,
"ItemHeight" : 150,
"BackgroundColor":"#FFFCFF",
"BorderColor":"#66FF7F",
"BorderWidth":2,
"RoundWidth":5,
"RoundHeight":5}');
}
void CreateDesignerPanel
{
testDesignerPanel =
MyForm.AddNewProListViewDesignerPanel(testListView, 'testDesignerPanel');
clComponent.SetupComponent(testDesignerPanel,
'{"Height":100,
"Width" : 150,
"BackgroundColor":"#B3FCE5",
"BorderColor":"#16FF8C",
"BorderWidth":2,
"RoundHeight":20,
"RoundWidth":20}');
testListView.SetDesignerPanel(testDesignerPanel);
}
void CreateData;
{
productName =
MyForm.AddNewProLabel(testDesignerPanel, 'productName', 'test');
clComponent.SetupComponent(productName,
'{"MarginTop" : 10,
"MarginLeft" : 10,
"MarginRight" : 10,
"MarginBottom" : 10,
"Height" : 30,
"TextSize" : 20,
"TextColor" :
"#000000",
"Align" :
"VertCenter"}');
// Adding productName as caption
testDesignerPanel.AddPanelObject(productName,
clText);
approveImg =
MyForm.AddNewProImage(testDesignerPanel, 'approveImg');
clComponent.SetupComponent(approveImg,'{"Align":"Right",
"MarginTop":30, "MarginBottom":30}');
approveImg.clTagInt = 0;
rejectImg =
MyForm.AddNewProImage(testDesignerPanel, 'rejectImg');
clComponent.SetupComponent(rejectImg,'{"Align":"Right",
"MarginTop":15, "MarginBottom":15}');
rejectImg.clTagInt = 1;
testListView.clTagInt = 3;
MyForm.AddNewEvent(testListView,tbeOnItemClick,'ApproveClick');
MyForm.AddNewEvent(rejectImg,tbeOnClick,'RejectClick');
testDesignerPanel.AddPanelObject(approveImg,
clImage1);
testDesignerPanel.AddPanelObject(rejectImg,
clImage2);
}
void AddDataToListView;
{
testListView.clLoadProListViewDataFromDataset(Clomosy.ClDataSetFromJSON('[
{"productName" : "User 1",
"approveImg" : "https://cdn-icons-png.flaticon.com/512/4315/4315445.png",
"rejectImg" : "https://cdn-icons-png.flaticon.com/512/10621/10621089.png"},
{"productName" : "User 2",
"approveImg" : "https://cdn-icons-png.flaticon.com/512/4315/4315445.png",
"rejectImg" : "https://cdn-icons-png.flaticon.com/512/10621/10621089.png"},
{"productName" : "User 3",
"approveImg" : "https://cdn-icons-png.flaticon.com/512/4315/4315445.png",
"rejectImg" : "https://cdn-icons-png.flaticon.com/512/10621/10621089.png"},
{"productName" : "User 4",
"approveImg" : "https://cdn-icons-png.flaticon.com/512/4315/4315445.png",
"rejectImg" : "https://cdn-icons-png.flaticon.com/512/10621/10621089.png"}
]'));
}
{
MyForm = TclForm.Create(Self);
CreateListView;
CreateDesignerPanel;
CreateData;
AddDataToListview;
MyForm.Run;
}
|