var Form1: TclStyleForm; btnS: TclProButton; vScroll: TCLVertScrollBox; BtnCaptionArr, BtnNameArr, btnImgArr: array of String; i: Integer; trfPanel: TclProPanel; Panels: array[0..4] of TclProPanel;
procedure ShowPanel(index: Integer); var j: Integer; begin // Tüm panelleri gizle for j := 0 to 4 do begin Panels[j].Visible := False; end;
// Belirli paneli görünür yap Panels[index].Visible := True; end;
procedure BtnOnClick(Sender: TObject); var clickedBtn: TClProButton; index: Integer; begin clickedBtn := TClProButton(Sender);
for index := 0 to 4 do begin if clickedBtn.Name = BtnNameArr[index] then begin ShowPanel(index); Break; end; end; end;
begin Form1 := TclStyleForm.Create(Self); Form1.SetFormColor('#ffffff', '', clGNone); Form1.clSetCaption('Menu Listesi');
vScroll := Form1.AddNewVertScrollBox(Form1, 'ScrollBoxY'); vScroll.Align := alMostTop; vScroll.Height := Form1.ClientHeight - 50;
BtnNameArr := ['btntkrdg', 'btnpd', 'btnkbk', 'btnhşmrm', 'btnkstnkbb']; BtnCaptionArr := ['Tekirdağ Köftesi', 'Tahinli Pide', 'Kabak Tatlısı', 'Höşmerim', 'Kestane Kebabı']; btnImgArr := [' https://www.yemektarifi.com/wp-content/uploads/2018/10/Tekirda%C4%9F-K%C3%B6ftesi-Tarifi-1.jpg" rel="nofollow - https://www.yemektarifi.com/wp-content/uploads/2018/10/Tekirda%C4%9F-K%C3%B6ftesi-Tarifi-1.jpg ', ' https://cdn.yemek.com/mncrop/940/625/uploads/2021/08/tahinli-pide-kucuk.jpg" rel="nofollow - https://cdn.yemek.com/mncrop/940/625/uploads/2021/08/tahinli-pide-kucuk.jpg ', ' https://iasbh.tmgrup.com.tr/6ebbab/650/344/0/0/752/395?u=https://isbh.tmgrup.com.tr/sbh/2020/04/24/kabak-tatli-tarifi-kabak-tatlisi-nasil-yapilir-1587752707126.jpg" rel="nofollow - https://iasbh.tmgrup.com.tr/6ebbab/650/344/0/0/752/395?u=https://isbh.tmgrup.com.tr/sbh/2020/04/24/kabak-tatli-tarifi-kabak-tatlisi-nasil-yapilir-1587752707126.jpg ', ' https://www.mutfagimdantarifler.com/wp-content/uploads/2017/02/hosmerim.jpg" rel="nofollow - https://www.mutfagimdantarifler.com/wp-content/uploads/2017/02/hosmerim.jpg ', ' https://i.pinimg.com/736x/d5/98/52/d59852ab2c5da1f001d4e17fb19f2d8e.jpg" rel="nofollow - https://i.pinimg.com/736x/d5/98/52/d59852ab2c5da1f001d4e17fb19f2d8e.jpg '];
for i := 0 to 4 do begin btnS := Form1.AddNewProButton(vScroll, BtnNameArr, BtnCaptionArr); btnS.Align := AlTop; btnS.Height := 150; btnS.Margins.Bottom := 5; btnS.clProSettings.IsFill := True; btnS.clProSettings.FontSize := 14; btnS.clProSettings.FontColor := clAlphaColor.clHexToColor('#000000'); btnS.clProSettings.TextSettings.Font.Style := [fsBold, fsItalic]; btnS.clProSettings.BackgroundColor := clAlphaColor.clHexToColor('#f2eeed'); btnS.clProSettings.FontVertAlign := palLeading; btnS.clProSettings.FontHorzAlign := palCenter; btnS.clProSettings.PictureSource := btnImgArr; btnS.clProSettings.PictureAutoFit := True; btnS.SetclProSettings(btnS.clProSettings); btnS.Name := BtnNameArr; Form1.AddNewEvent(btnS, tbeOnClick, 'BtnOnClick');
Panels := TclProPanel.Create(Form1); Panels.Parent := Form1; Panels.SetBounds(50, 50 + i * 310, 400, 300); // Panelin konumu ve boyutu Panels.BorderWidth := 2; Panels.BorderColor := clAlphaColor.clHexToColor('#000000'); Panels.RoundHeight := 10; Panels.RoundWidth := 10; Panels.Visible := False; end;
ShowPanel(0); Form1.Run; end; // kodun ' if clickedBtn.Name = BtnNameArr[index] then' kısmında sebebini çözemediğim bir hata alıyorum (kodda yapmak istediğim şey dizi şeklinde butonlarım var ve bu butonlara basıldığında bir panel açmasını istiyorum.)
|