Hata nerede anlayamadım.
var
MainForm:TclForm;
noteBtn:TclProButton;
notePanels:TclProPanel;
vScrollBoxL,vScrollBoxR:TclVertScrollBox;
btnBtn:TclProButton;
noteEdit:TclProEdit;
noteLabel:TclProLabel;
sqlQuery:TclSqlQuery;
colorArray:TclArrayString;
noteIDstr:String;
queue,colorQueue,textLength:Integer;
function openEditor(noteID:Integer)
{
Clomosy.GlobalVariableInteger = noteID;
MainForm.clShow;
Clomosy.RunUnit('editorPage');
}
void createNewNote
var
latestIDstr:String;
latestID:Integer;
{
sqlQuery.SQL.Text = 'SELECT * FROM Notebook';
sqlQuery.Open;
if(not sqlQuery.Found)
{
ShowMessage('Bilinmeyen hata!');
}
else
{
sqlQuery.Last;
latestIDstr = sqlQuery.FieldByName('NoteID').AsString;
latestID = StrToInt(latestIDstr);
sqlQuery.SQL.Text = 'INSERT INTO Notebook(UserGUID, Text) VALUES(' + QuotedStr(Clomosy.AppUserGUID) + ',' + QuotedStr('') + ')';
sqlQuery.ExecSql;
}
openEditor(latestID);
}
void editNoteFunc
var senderPanel:TclProLabel;
{
senderPanel = TclProLabel(MainForm.ClSender);
openEditor(StrToInt(senderPanel.Hint));
}
{
MainForm = TclForm.Create(self);
MainForm.SetFormColor('#000000','#000000',clGVertical);
colorArray = TclArrayString.Create;
colorArray.Add('#44FAFD');
colorArray.Add('#49E94C');
colorArray.Add('#BC55EC');
colorArray.Add('#E4F943');
vScrollBoxL = MainForm.AddNewVertScrollBox(MainForm,'vScrollBoxL');
vScrollBoxL.Margins.Left = 15;
vScrollBoxL.Margins.Right = 15;
vScrollBoxL.Margins.Top = 15;
vScrollBoxL.Margins.Bottom = 15;
vScrollBoxL.Width = MainForm.clWidth / 2 - 25;
vScrollBoxL.Align = alLeft;
vScrollBoxR = MainForm.AddNewVertScrollBox(MainForm,'vScrollBoxR');
vScrollBoxR.Margins.Left = 15;
vScrollBoxR.Margins.Right = 15;
vScrollBoxR.Margins.Top = 15;
vScrollBoxR.Margins.Bottom = 15;
vScrollBoxR.Width = MainForm.clWidth / 2 - 25;
vScrollBoxR.Align = alRight;
noteBtn = MainForm.AddNewProButton(MainForm, 'noteBtn', '');
clComponent.SetupComponent(noteBtn,'{
"Align" : "None"
}');
noteBtn.clProSettings.PictureSource = ' https://i.hizliresim.com/momk4f6.png" rel="nofollow - https://i.hizliresim.com/momk4f6.png ';
noteBtn.clProSettings.PictureAutoFit = True;
noteBtn.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#3F3F3F');
noteBtn.Height = 50;
noteBtn.Width = 50;
noteBtn.clProSettings.RoundHeight = 15;
noteBtn.clProSettings.RoundWidth = 15;
noteBtn.SetclProSettings(noteBtn.clProSettings);
noteBtn.Position.X = (MainForm.clWidth * 0.85) - (noteBtn.Width/2);
noteBtn.Position.Y = (MainForm.clHeight * 0.9) + (noteBtn.Height/2);
MainForm.AddNewEvent(noteBtn, tbeOnClick, 'createNewNote');
try
sqlQuery = TCLSqlQuery.Create(nil);
Clomosy.DBSQLServerConnect('SQL Server', 'clomosyserver.database.windows.net', 'dbAdmin', 'Clomosydb1234', 'ClomosyDatabase', 1433);
sqlQuery.Connection = Clomosy.DBSQLServerConnection;
except
ShowMessage('Sunucuya bağlantı kurulamadı.');
}
try
sqlQuery.SQL.Text = 'SELECT NoteID, Text FROM Notebook WHERE UserGUID = ' + QuotedStr(Clomosy.AppUserGUID);
sqlQuery.Open;
if (not sqlQuery.Found)
{
ShowMessage('Bilinmeyen bir hata ile karşılaşıldı!' + LastExceptionMessage);
}
else
{
queue = 0;
colorQueue = 0;
while(not sqlQuery.EOF)
{
noteIDstr = 'nPanel' + IntToStr(sqlQuery.FieldByName('NoteID').AsString);
if((queue mod 2) == 0)
{
ShowMessage(colorQueue);
notePanels = MainForm.AddNewProPanel(vScrollBoxL, noteIDstr);
clComponent.SetupComponent(notePanels, '{
"MarginTop" : 15,
"BackgroundColor" : "' + QuotedStr(colorArray.GetItem(colorQueue)) + '",
"RoundHeight" : 5,
"RoundWidth" : 5,
"Align" : "Top"}');
textLength = Length(sqlQuery.FieldByName('Text').AsString);
textLength = textLength / 18;
textLength = Trunc(textLength);
if(textLength < 18)
{
textLength = (textLength * 30) + 30;
}
else
{
textLength = (textLength * 30);
}
noteLabel = MainForm.AddNewProLabel(notePanels, 'noteLabel' + noteIDstr, '');
clComponent.SetupComponent(noteLabel,'{
"Align" : "Client",
"RoundHeight" : 5,
"RoundWidth" : 5,
"MarginTop" : 5,
"MarginBottom" : 5,
"MarginLeft" : 5,
"MarginRight" : 5,
"TextHorizontalAlign" : "Left"}');
noteLabel.clProSettings.AutoSize = true;
noteLabel.clProSettings.WordWrap = true;
noteLabel.clProSettings.BackgroundColor = clAlphaColor.clHexToColor(QuotedStr(colorArray.GetItem(colorQueue)));;
noteLabel.clProSettings.FontSize = 18;
noteLabel.Caption = sqlQuery.FieldByName('Text').AsString;
noteLabel.Hint = sqlQuery.FieldByName('NoteID').AsString;
noteLabel.SetclProSettings(noteLabel.clProSettings);
MainForm.AddNewEvent(noteLabel,tbeOnClick,'editNoteFunc');
notePanels.Height = textLength;
sqlQuery.Next;
Inc(queue);
if((colorQueue mod 3)==1)
{
colorQueue = 0;
}
else
{
Inc(colorQueue);
}
ShowMessage(colorQueue);
}
else
{
ShowMessage(colorQueue);
notePanels = MainForm.AddNewProPanel(vScrollBoxR, noteIDstr);
clComponent.SetupComponent(notePanels, '{
"MarginTop" : 15,
"BackgroundColor" : "' + QuotedStr(colorArray.GetItem(colorQueue)) + '",
"RoundHeight" : 5,
"RoundWidth" : 5,
"Align" : "Top"}');
textLength = Length(sqlQuery.FieldByName('Text').AsString);
textLength = textLength / 18;
textLength = Trunc(textLength);
if(textLength < 18)
{
textLength = (textLength * 30) + 30;
}
else
{
textLength = (textLength * 30);
}
noteLabel = MainForm.AddNewProLabel(notePanels, 'noteLabel' + noteIDstr, '');
clComponent.SetupComponent(noteLabel,'{
"Align" : "Client",
"RoundHeight" : 5,
"RoundWidth" : 5,
"MarginTop" : 5,
"MarginBottom" : 5,
"MarginLeft" : 5,
"MarginRight" : 5}');
noteLabel.clProSettings.AutoSize = true;
noteLabel.clProSettings.WordWrap = true;
noteLabel.clProSettings.BackgroundColor = clAlphaColor.clHexToColor(QuotedStr(colorArray.GetItem(colorQueue)));
noteLabel.clProSettings.FontSize = 18;
noteLabel.Caption = sqlQuery.FieldByName('Text').AsString;
noteLabel.Hint = sqlQuery.FieldByName('NoteID').AsString;
noteLabel.SetclProSettings(noteLabel.clProSettings);
MainForm.AddNewEvent(noteLabel,tbeOnClick,'editNoteFunc');
notePanels.Height = textLength;
sqlQuery.Next;
Dec(queue);
if((colorQueue mod 3)==1)
{
colorQueue = 0;
}
else
{
Inc(colorQueue);
}
ShowMessage(colorQueue);
}
}
}
finally
}
MainForm.Run;
}