Mantık hatasından dolayı düzeltemedim. Yapmaya çalıştığım olay:
Edit2'den gelen sayıyı alıp,
O sayı kadar VertScrollBar'a masa eklemek istiyorum. Bu masaları kapsayacak panelin sadece 3 tane masa almasını istiyorum. 3 tane masayı geçince yeni bir panel oluşturup altına getirmesini istiyorum. 2 tane olursa eğer masa sayısı, bir panel daha oluşturup 2'sini sola hızalayıp verilmeyen masanın yerini boş bırakmasını istiyorum.
var
MainForm: TClForm;
TestPnl: TclProPanel;
TestBtn: TClProButton;
TestEdit, TestEdit2: TclProEdit;
vScroll: TCLVertScrollBox;
void SetObjectMargins(AObject,AValue){
AObject.Margins.Top = AValue;
AObject.Margins.Bottom = AValue;
AObject.Margins.Left = AValue;
AObject.Margins.Right = AValue;
}
function IconSelect(IconUI):String
var
Output: String;
{
case IconUI of
{
'ClosmosyLogo':Output = ' https://resmim.net/cdn/2025/10/22/jV6v6Q.png" rel="nofollow - https://resmim.net/cdn/2025/10/22/jV6v6Q.png ';
'AdminManagementBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju0eoT.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju0eoT.png ';
'BackArrowBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju1STG.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju1STG.png ';
'HomePageBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju1fIT.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju1fIT.png ';
'ItemsBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju1mZL.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju1mZL.png ';
'ManagementBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju1Tqh.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju1Tqh.png ';
'OrderChecklistBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju1jdK.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju1jdK.png ';
'OrdersBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju1CGQ.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju1CGQ.png ';
'QRBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju1kI7.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju1kI7.png ';
'SaveBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju1gBc.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju1gBc.png ';
'ShiftBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju18QR.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju18QR.png ';
'ShiftsBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju1Bzj.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju1Bzj.png ';
'SortBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju1rXI.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju1rXI.png ';
'StocksBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju15f6.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju15f6.png ';
'TablesBtnUI':Output = ' https://resmim.net/cdn/2025/10/24/ju1RK8.png" rel="nofollow - https://resmim.net/cdn/2025/10/24/ju1RK8.png ';
'TablesIconUI':Output = ' https://resmim.net/cdn/2025/10/30/jJABcF.png" rel="nofollow - https://resmim.net/cdn/2025/10/30/jJABcF.png ';
else{
ShowMessage('Tınne');
}
}
Result = Output;
}
void TestBtnV
var
TestLbl: TClProLabel;
TestImage: TClProImage;
MasaHarfi, MasaAdeti, Topla: String;
I, k, TempMod: Integer;
{
SetObjectMargins(TestEdit,6);
MasaHarfi = TestEdit.Text;
MasaAdeti = TestEdit2.Text;
Topla = MasaHarfi + ' ' + MasaAdeti;
for (k = 1 to IntToStr(MasaAdeti))
{
TempMod = k Mod 3;
ShowMessage('TempMod :' + IntToStr(TempMod) + ' ' + 'K :' + IntToStr(k));
if (TempMod < 3)
{
ShowMessage('1. if '+IntToStr(TempMod));
TestPnl = MainForm.AddNewProPanel(vScroll,'TestPnl'+IntToStr(k));
TestPnl.Align = alCenter;
TestPnl.Height = (MainForm.clHeight*200)/100;
TestPnl.Width = (MainForm.clWidth*200)/100;
TestPnl.Margins.Top = -60;
TestPnl.Margins.Left = -10;
TestPnl.Margins.Right = -10;
TestPnl.clProSettings.BorderWidth = 3;
TestPnl.clProSettings.BorderColor = clAlphaColor.clHexToColor('#3a3a3a');
TestPnl.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#4caf50');
TestPnl.SetclProSettings(TestPnl.clProSettings);
ShowMessage('Panel Oluştu'+IntToStr(k));
for (I = 1 to 3)
{
if (k > StrToInt(MasaAdeti)) Break;
{
TestLbl = MainForm.AddNewProLabel(TestPnl,'TestBtn'+IntToStr(k), Topla);
TestLbl.Align = alCenter;
TestLbl.Width = 400;
TestLbl.Height = 600;
TestLbl.Margins.Bottom = 60;
TestLbl.clProSettings.FontSize = 35;
TestLbl.clProSettings.FontVertAlign = palcenter;
TestLbl.clProSettings.FontHorzAlign = palcenter;
TestLbl.clProSettings.FontColor = clAlphaColor.clHexToColor('#ffffff');
TestLbl.clProSettings.TextSettings.Font.Style = [fsBold];
TestLbl.SetclProSettings(TestLbl.clProSettings);
TestImage = MainForm.AddNewProImage(TestPnl,'TestImage'+IntToStr(k));
TestImage.Align = alCenter;
TestImage.Height = (TestPnl.Height*40)/100;
TestImage.Width = (TestPnl.Width*40)/100;
TestImage.Margins.Top = 50;
TestImage.clProSettings.PictureSource = IconSelect('TablesIconUI');
TestImage.clProSettings.PictureAutoFit = True;
TestImage.SetclProSettings(TestImage.clProSettings);
Inc(k);
}
}
}
}
}
void MainPnlV
{
vScroll = MainForm.AddNewVertScrollBox(MainForm,'vScroll');
vScroll.Align = alCenter;
vScroll.Height = (MainForm.clHeight*45)/100;
vScroll.Width = (MainForm.clWidth*88)/100;
vScroll.Margins.Bottom=270;
}
{
MainForm = tclform.Create(self);
MainForm.clSetWindowState(fwsMaximized);
TestEdit = MainForm.AddNewProEdit(MainForm, 'TestEdit', '');
TestEdit2 = MainForm.AddNewProEdit(MainForm, 'TestEdit2', '');
TestEdit.Align = alMostTop;
TestEdit2.Align = alTop;
TestBtn = MainForm.AddNewProButton(MainForm,'TestBtn','Test');
TestBtn.Align = alBottom;
TestBtn.Height = 45;
TestBtn.Width = 180;
TestBtn.Margins.Top=20;
TestBtn.Margins.Left=10;
TestBtn.Margins.Right=10;
TestBtn.clProSettings.BorderWidth = 1;
TestBtn.clProSettings.RoundHeight = 4;
TestBtn.clProSettings.RoundWidth = 4;
TestBtn.clProSettings.FontSize = 27;
TestBtn.clProSettings.FontVertAlign = palcenter;
TestBtn.clProSettings.FontHorzAlign = palcenter;
TestBtn.clProSettings.BorderColor = clAlphaColor.clHexToColor('#3a3a3a');
TestBtn.clProSettings.FontColor = clAlphaColor.clHexToColor('#e8e3e3');
TestBtn.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#4caf50');
TestBtn.clProSettings.TextSettings.Font.Style = [fsBold];
TestBtn.SetclProSettings(TestBtn.clProSettings);
MainForm.AddNewEvent(TestBtn,tbeOnClick,'TestBtnV');
MainPnlV;
TestBtnV;
MainForm.SetFormColor('#121212','',clGNone);
MainForm.FormWaiting.Visible = False;
MainForm.BtnFormMenu.Visible = False;
MainForm.BtnGoBack.Visible = False;
MainForm.run;
}