var form1:TCLForm; clRest:TclRest; qry:TCLJSONQuery; qryString:String; testDesignerPanel : TClListViewDesignerPanel; listView:TClProListView; Title,Year,imdbID,Type1 : TClProLabel; Poster : TClProImage; searchEdt : TClProSearchEdit;
void Verial; {
clRest=TCLRest.Create; clRest.BaseURL = ' https://api.collectapi.com/imdb/imdbSearchByName?query=" rel="nofollow - https://api.collectapi.com/imdb/imdbSearchByName?query= '+searchEdt.text; clRest.Accept = 'application/json'; clRest.Method = rmGET; clRest.AddHeader('Authorization','apikey 1sHfdG8TMhDkH8EC5mvJWe:7KihkVkAUEfW1z4aM8ZBIM'); clRest.Execute; qry= Clomosy.ClDataSetFromJSON(clRest.Response); with qry do { qryString=FieldByName('result').AsString; } ShowMessage(clRest.Response);
qry= Clomosy.ClDataSetFromJSON(qryString); with qry do { qryString=FieldByName('Title').AsString; } ShowMessage(qryString);
}
void CreateListView { listView = form1.AddNewProListView(form1,'listView'); listView.clProSettings.ItemSpace = 10; listView.clProSettings.IsFill = True; listView.Height = form1.clheight*75/100;
listView.clProSettings.IsRound = True;
listView.Align=alBottom; listView.clProSettings.RoundHeight = 5; listView.clProSettings.RoundWidth = 5; listView.clProSettings.BorderColor =clAlphaColor.clHexToColor('#f3aa44'); listView.clProSettings.BorderWidth = 2; listView.clProSettings.ItemHeight = 185; listView.clProSettings.ColCount = 1; listView.SetclProSettings(listView.clProSettings); searchEdt.TargetListview = listView; }
void CreateDesignerPanel { testDesignerPanel = form1.AddNewProListViewDesignerPanel(listView, 'testDesignerPanel'); clComponent.SetupComponent(testDesignerPanel, '{"Height":75, "BackgroundColor":"#ff4747", "RoundHeight":20, "RoundWidth":20}'); listView.SetDesignerPanel(testDesignerPanel); }
void CreateData; { Title = form1.AddNewProLabel(testDesignerPanel, 'Title', 'test'); Title.clProSettings.FontVertAlign = palLeading; Title.Align=alTop; Title.Margins.Top=5; Title.Margins.Left=5; Title.clProSettings.AutoSize=True; Title.clProSettings.FontColor =clAlphaColor.clHexToColor('#ffffff'); Title.SetclProSettings(Title.clProSettings); testDesignerPanel.AddPanelObject(Title, clText);
Year = form1.AddNewProLabel(testDesignerPanel, 'Year', 'test'); Year.clProSettings.FontVertAlign = palLeading; Year.Align=alTop; Year.Margins.Top=5; Year.Margins.Left=5; Year.clProSettings.AutoSize=True; Year.clProSettings.FontColor =clAlphaColor.clHexToColor('#ffffff'); Year.SetclProSettings(Year.clProSettings); testDesignerPanel.AddPanelObject(Year, clText1);
imdbID = form1.AddNewProLabel(testDesignerPanel, 'imdbID', 'test'); imdbID.clProSettings.FontVertAlign = palLeading; imdbID.Align=alTop; imdbID.Margins.Top=5; imdbID.Margins.Left=5; imdbID.clProSettings.AutoSize=True; imdbID.clProSettings.FontColor =clAlphaColor.clHexToColor('#ffffff'); imdbID.SetclProSettings(imdbID.clProSettings); testDesignerPanel.AddPanelObject(imdbID, clText2);
Type1 = form1.AddNewProLabel(testDesignerPanel, 'Type', 'test'); Type1.clProSettings.FontVertAlign = palLeading; Type1.Align=alTop; Type1.Margins.Top=5; Type1.Margins.Left=5; Type1.clProSettings.AutoSize=True; Type1.clProSettings.FontColor =clAlphaColor.clHexToColor('#ffffff'); Type1.SetclProSettings(Type1.clProSettings); testDesignerPanel.AddPanelObject(Type1, clText3);
Poster = form1.AddNewProImage(testDesignerPanel, 'Poster'); Poster.Margins.Bottom = 3; Poster.Width = (listView.Width*30)/100; Poster.Height = (listView.Height*30)/100; Poster.clProSettings.AutoSize=True; Poster.SetclProSettings(Poster.clProSettings); testDesignerPanel.AddPanelObject(Poster, clImage1);
}
void listViewVeriEkle; { listView.clLoadProListViewDataFromDataset(Clomosy.ClDataSetFromJSON(qry.GetJSONString)); }
{ form1 = TCLForm.Create(Self); Verial; searchEdt = form1.AddNewProSearchEdit(form1,'searchEdt','Film arayın...'); searchEdt.Align = alTop; searchEdt.Margins.Top = 15; searchEdt.Margins.Left = 15; searchEdt.Margins.Right = 15; searchEdt.Margins.Bottom = 10; searchEdt.Height = 40; CreateListView; CreateDesignerPanel; CreateData; listViewVeriEkle; form1.Run;
}
|