var MyForm : TclGameForm; mainPnl, topPnl : TclProPanel; nextBtn : TclProButton; successLbl : TclProLabel; pnlImage : TClProImage; getsourceList : TclStringList; SndAudio:Integer; successText, nextBtnText : String; exitBtn: TClProImage; /* procedure closeQuery; begin MyForm.clCanClose := false; end;*/ Procedure InsertUserData; begin getsourceList := Clomosy.StringListNew; getsourceList.StrictDelimiter := True; getsourceList.Delimiter := '|'; getsourceList.DelimitedText := Clomosy.GlobalVariableString; Clomosy.GlobalVariableString:= Clomosy.StringListItemString(getsourceList,0); end; procedure goToUnit; begin nextBtn.Enabled := False; Clomosy.RunUnit('uLangTopic'); MyForm.clHide; end; procedure exitButonChanged; begin Clomosy.RunUnit('uLanguages'); MyForm.clHide; end; procedure mainBody; begin mainPnl:=MyForm.AddNewProPanel(MyForm,'mainPnl'); mainPnl.Align := alContents; // {---------------Exit AND SUCCESSFULLY TEXT TOP-------------------------------} /* topPnl:= uComponentAdd.addPnl(MyForm,mainPnl,'topPnl',0,50,1,1,'','','',0,0,0,0,0); topPnl.Align:= alMostTop;*/ topPnl:=MyForm.AddNewProPanel(mainPnl,'topPnl'); topPnl.Align:= alMostTop; topPnl.Height:= 50; topPnl.clProSettings.RoundHeight:= 1; topPnl.clProSettings.RoundWidth:= 1; topPnl.clProSettings.BackgroundColor:= clAlphaColor.clnull; topPnl.SetclProSettings(topPnl.clProSettings); exitBtn := uComponentAdd.addBtnImg(MyForm, topPnl, 'exitBtn',0,30,0,0,0,5,0,'exitBtn.png','','','',5,5,True); exitBtn.Align:= alRight; MyForm.AddNewEvent(exitBtn,tbeOnClick,'exitButonChanged'); /* successLbl:= uComponentAdd.addProLbl(MyForm,topPnl,'successLbl',successText,0,(topPnl.Width*60) div 100,0,0,5,10 ,'#ffffff','','',19,0,0,0,); successLbl.Align:= alLeft; successLbl.clProSettings.FontVertAlign:= palcenter; successLbl.clProSettings.FontHorzAlign:= palLeading; successLbl.clProSettings.TextSettings.Font.Style:= [fsBold]; successLbl.SetclProSettings(successLbl.clProSettings);*/ successLbl:= MyForm.AddNewProLabel(topPnl,'successLbl',successText); successLbl.Align:= alLeft; successLbl.Margins.left:= 10; successLbl.Margins.Top:= 5; successLbl.Width:= (topPnl.Width*60) div 100; successLbl.clProSettings.FontColor:= clAlphaColor.clHexToColor('#ffffff'); successLbl.clProSettings.FontSize:= 19; successLbl.clProSettings.FontVertAlign:= palcenter; successLbl.clProSettings.FontHorzAlign:= palLeading; successLbl.clProSettings.TextSettings.Font.Style:= [fsBold]; successLbl.SetclProSettings(successLbl.clProSettings); //{---------------IMAGE CENTER-------------------------------} pnlImage := uComponentAdd.addBtnImg(MyForm, mainPnl, 'pnlImage',(mainPnl.Height*35) div 100, (mainPnl.Width*90) div 100, 20,20,0,10,0,'learnapp3.png','','','',0,0,True); pnlImage.Align:= alCenter; //{---------------BUTTON TOP-------------------------------} nextBtnText := clStrToLan('START NEXT TOPIC|SONRAKİ KONUYA BAŞLA'); nextBtn:=uComponentAdd.addbtn(MyForm,mainPnl,'nextBtnSuccess',nextBtnText,'#00B282',(mainPnl.Height*5) div 100, 20,20,0,50,0,40,40,'#ffffff','',14,0); nextBtn.Align:= alBottom; MyForm.AddNewEvent(nextBtn,tbeOnClick,'goToUnit'); end;
begin MyForm := TclGameForm.Create(Self); MyForm.AddGameAssetFromUrl(' https://clomosy.com/learn/up_chime.wav" rel="nofollow - https://clomosy.com/learn/up_chime.wav '); SndAudio := MyForm.RegisterSound('up_chime.wav'); MyForm.SoundIsActive:=True; MyForm.PlayGameSound(SndAudio); // MyForm.AddNewEvent(MyForm,tbeOnFormCloseQuery,'closeQuery'); successText := clStrToLan('Successfully Completed|Başarıyla Tamamlandı'); TclProButton(MyForm.clFindComponent('BtnGoBack')).Visible :=False; TclProButton(MyForm.clFindComponent('BtnFormMenu')).Visible :=False; MyForm.SetFormBGImage('bg4.png'); mainBody; InsertUserData; MyForm.Run;
end; //************************************************************************************************************ yukarıdaki uSuccess unitimde topPnl:= uComponentAdd.addPnl(MyForm,mainPnl,'topPnl',0,50,1,1,'','','',0,0,0,0,0); topPnl.Align:= alMostTop; bu kısım ve
successLbl:= uComponentAdd.addProLbl(MyForm,topPnl,'successLbl',successText,0,(topPnl.Width*60) div 100,0,0,5,10 ,'#ffffff','','',19,0,0,0,); successLbl.Align:= alLeft; successLbl.clProSettings.FontVertAlign:= palcenter; successLbl.clProSettings.FontHorzAlign:= palLeading; successLbl.clProSettings.TextSettings.Font.Style:= [fsBold]; successLbl.SetclProSettings(successLbl.clProSettings);
bu kısımda uComponentAdd adında bir unitten fonksiyon kullanıyorum. Bu iki kod parçasını uSuccess unitimde kullandığım zaman uSuccess sayfası projemde direk açılmıyor. Ama topPnl:=MyForm.AddNewProPanel(mainPnl,'topPnl'); topPnl.Align:= alMostTop; topPnl.Height:= 50; topPnl.clProSettings.RoundHeight:= 1; topPnl.clProSettings.RoundWidth:= 1; topPnl.clProSettings.BackgroundColor:= clAlphaColor.clnull; topPnl.SetclProSettings(topPnl.clProSettings); bu şekilde ve
successLbl:= MyForm.AddNewProLabel(topPnl,'successLbl',successText); successLbl.Align:= alLeft; successLbl.Margins.left:= 10; successLbl.Margins.Top:= 5; successLbl.Width:= (topPnl.Width*60) div 100; successLbl.clProSettings.FontColor:= clAlphaColor.clHexToColor('#ffffff'); successLbl.clProSettings.FontSize:= 19; successLbl.clProSettings.FontVertAlign:= palcenter; successLbl.clProSettings.FontHorzAlign:= palLeading; successLbl.clProSettings.TextSettings.Font.Style:= [fsBold]; successLbl.SetclProSettings(successLbl.clProSettings);bu şekilde kullandığım zaman uSuccess sayfam açılıyor. Aşağıdaki fonksiyon uComponentAdd sayfamdaki kullandığım fonksiyonlardan biri:
function addProLbl(GelenForm, konum, lblIsim, LblCaption, HeightDeger,widthDeger,rightDeger, bottomDeger, topDeger, leftDeger,fontClrDeger,bgDeger,brdrClrDeger,fontSizeDeger,rwDeger,rhdeger,brdrwidthDeger): TClProLabel; var proLbl: TClProLabel; begin proLbl := GelenForm.AddNewProLabel(konum,lblIsim,LblCaption);
with proLbl do begin Margins.Bottom:= bottomDeger; Margins.Top:= topDeger; Margins.Left:= leftDeger; Margins.Right := rightDeger; Width:=widthDeger; Height := HeightDeger; clProSettings.FontSize:= fontSizeDeger; clProSettings.RoundHeight:=rhdeger; clProSettings.RoundWidth:= rwDeger; clProSettings.BorderWidth:=brdrwidthDeger; end; //---------------------------------------------------------------------------- if(bgDeger <> '') then begin proLbl.clProSettings.BackgroundColor:=clAlphaColor.clHexToColor(bgDeger); end; //---------------------------------------------------------------------------- if(fontClrDeger <> '') then begin proLbl.clProSettings.FontColor:=clAlphaColor.clHexToColor(fontClrDeger); end; //---------------------------------------------------------------------------- if(brdrClrDeger <> '') then begin proLbl.clProSettings.borderColor:=clAlphaColor.clHexToColor(brdrClrDeger); end; //---------------------------------------------------------------------------- proLbl.SetclProSettings(proLbl.clProSettings); Result := proLbl; end; aşağıdaki ise diğer fonksiyonum:
function addPnl(GelenForm, konum, panelIsim,widthDeger,HeightDeger,rhdeger,rwDeger,bgDeger,fontClrDeger, brdrClrDeger,brdrwidthDeger,topDeger,leftDeger,rightDeger,bottomDeger): TclProPanel; var Pnl: TclProPanel; begin Pnl:=GelenForm.AddNewProPanel(konum, panelIsim); with Pnl do begin Width:= widthDeger; Height:= HeightDeger; Margins.Top:= topDeger; clProSettings.RoundHeight:=rhdeger; clProSettings.RoundWidth:=rwDeger; clProSettings.BorderWidth := brdrwidthDeger; Margins.Left:=leftDeger; Margins.Right:= rightDeger; Margins.Bottom := bottomDeger; end; //---------------------------------------------------------------------------- if(bgDeger <> '') then begin Pnl.clProSettings.BackgroundColor:=clAlphaColor.clHexToColor(bgDeger); end; //---------------------------------------------------------------------------- if(fontClrDeger <> '') then begin Pnl.clProSettings.FontColor:=clAlphaColor.clHexToColor(fontClrDeger); end; //---------------------------------------------------------------------------- if(brdrClrDeger <> '') then begin Pnl.clProSettings.borderColor:=clAlphaColor.clHexToColor(brdrClrDeger); end; //---------------------------------------------------------------------------- Pnl.SetclProSettings(Pnl.clProSettings); Result := Pnl; end;
|