var Myform:TclForm; kullaniciGirdisi: TClProEdit; arastirButon:TClProButton; sonuclarTablosu,testListView:TClProListView; xWeb:TclWebBrowser; clRest : TclRest; qry,qry2:TCLJSONQuery; qryString:String; myArray: TClArrayString; testDesignerPanel : TClListViewDesignerPanel; anlam ,ornek: TclLabel; matris; void SetEdit; { kullaniciGirdisi = MyForm.AddNewProEdit(MyForm,'kullaniciGirdisi','Kelime Giriniz...'); clComponent.SetupComponent(kullaniciGirdisi,'{"Align" : "Top","Width" :180, "Height":45,"RoundHeight":10,"RoundWidth":10,"BorderColor":"#ff6b6", "BorderWidth":2,"MarginLeft":50,"MarginRight":50,"MarginTop":50}'); } void SetButon; { arastirButon=Myform.AddNewProButton(MyForm, 'arastirButon', 'Araştır'); arastirButon.Align=alTop; arastirButon.clProSettings.FontColor=clAlphaColor.clHexToColor('#ffffff'); arastirButon.clProSettings.BackgroundColor=clAlphaColor.clHexToColor('#ffb61a'); arastirButon.clProSettings.FontSize = 16; arastirButon.Height=40; arastirButon.Margins.Left=60; arastirButon.Margins.Right=60; arastirButon.Margins.Top=5; arastirButon.clProSettings.IsRound = True; arastirButon.clProSettings.RoundHeight = 15; arastirButon.clProSettings.RoundWidth = 15; arastirButon.SetclProSettings(arastirButon.clProSettings); } void CreateListView { testListView = MyForm.AddNewProListView(MyForm,'testListView'); testListView.clProSettings.ItemSpace = 10; testListView.clProSettings.IsFill = True; testListView.Height = 500;
testListView.clProSettings.IsRound = True;
testListView.Align=alBottom; testListView.clProSettings.RoundHeight = 5; testListView.clProSettings.RoundWidth = 5; testListView.clProSettings.BorderColor =clAlphaColor.clHexToColor('#f3aa44'); testListView.clProSettings.BorderWidth = 2; testListView.clProSettings.ItemHeight = 75; testListView.clProSettings.ColCount = 1; testListView.SetclProSettings(testListView.clProSettings);
}
void CreateDesignerPanel { testDesignerPanel = MyForm.AddNewProListViewDesignerPanel(testListView, 'testDesignerPanel'); clComponent.SetupComponent(testDesignerPanel, '{"Height":75, "BackgroundColor":"#ffb638", "RoundHeight":20, "RoundWidth":20}'); testListView.SetDesignerPanel(testDesignerPanel); }
void CreateData; { anlam = MyForm.AddNewLabel(testDesignerPanel, 'anlam', 'test'); anlam.AutoSize = true; anlam.WordWrap = True; anlam.TextSettings.Font.Size = 16; anlam.TextSettings.FontColor = clAlphaColor.clHexToColor('#ffffff'); /* anlam.Align = alMostTop; anlam.clProSettings.FontSize = 16; anlam.Margins.Top=10; anlam.Margins.Bottom=10; anlam.Margins.Right=10; anlam.Margins.Left=10; anlam.Width = 180; anlam.Height = 50;
anlam.clProSettings.FontVertAlign =palLeading ; anlam.clProSettings.FontColor =clAlphaColor.clHexToColor('#ffffff'); anlam.SetclProSettings(anlam.clProSettings); */ testDesignerPanel.AddPanelObject(anlam, clCaption);
}
void AddDataToListView; { testListView.clLoadProListViewDataFromDataset(Clomosy.ClDataSetFromJSON(qry.GetJSONString)); }
void arastirButonClick; { myArray = TClArrayString.Create; qry = TCLJSONQuery.Create(nil); clRest=TclRest.Create; clRest.BaseURL = ' https://api.collectapi.com/dictionary/wordSearchTurkish?query=" rel="nofollow - https://api.collectapi.com/dictionary/wordSearchTurkish?query= '+kullaniciGirdisi.Text; clRest.Accept = 'application/json'; clRest.Method = rmGet; clRest.AddHeader('authorization','apikey 1VOgIPelUyRrGJAN4JWRwb:2FcrKVmIDEWmsBlA6yyCl0'); clRest.Execute; qry = Clomosy.ClDataSetFromJSON(clRest.Response); with qry do { qryString=FieldByName('result').AsString; } qry=Clomosy.ClDataSetFromJSON(qryString);
with qry do { qryString=FieldByName('madde').AsString; } qry=Clomosy.ClDataSetFromJSON(qryString); with qry do { qryString=FieldByName('kelime').AsString; } qry=Clomosy.ClDataSetFromJSON(qryString); AddDataToListView; /* with qry do { if (Found) { First; while (not EOF) { qryString=FieldByName('anlam').AsString; myArray.Add(qryString); Next; } } } ShowMessage(myArray.GetItem(0));*/ }
{
Myform=TclForm.Create(Self); SetEdit; SetButon; CreateListView; CreateDesignerPanel; CreateData; Myform.AddNewEvent(arastirButon,tbeOnClick,'arastirButonClick'); Myform.Run; }
|