Hi All
I am using SQLite with ListBox. I have a delete button to delete an entry within the ListBox. I want to add a Dialog Message confirming if you want to continue to delete the entry but it still deletes the entry by pressing cancel
This is the script below before adding the Dialog Message.
This is the Dialog Message added to the script below.
Can anyone help with this thank you
I am using SQLite with ListBox. I have a delete button to delete an entry within the ListBox. I want to add a Dialog Message confirming if you want to continue to delete the entry but it still deletes the entry by pressing cancel
This is the script below before adding the Dialog Message.
Código: Seleccionar todo
--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$--
-- Get the selected row number. If nothinh is selected, do nothing
--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&&--
tSelected = ListBox.GetSelected("ListBox_SiteList");
if tSelected then
nSelected = tSelected[1];
tItemRowNumber = String.ToNumber(ListBox.GetItemData("ListBox_SiteList", tSelected[1]));
--Delete the entry from the database
SQLite.Query(db, "DELETE FROM Websites WHERE RecordID = '" .. tWebsites.Data[tItemRowNumber]["RecordID"] .. "'");
nLastError = Application.GetLastError();
if nLastError ~= SQLite.OK then
Dialog.Message("Error: " .. nLastError, SQLite.GetLastErrorString());
end
FillSitesList();
-- Reselect the next item in the list...
nReselect = nSelected;
nNumItems = ListBox.GetCount("ListBox_SiteList");
if(nNumItems > 0)then
if(nReselect > nNumItems)then
nReselect = nNumItems;
end
ListBox.SelectItem("ListBox_SiteList",nReselect);
end
end
Código: Seleccionar todo
result = Dialog.Message("Warning", "Are you sure you want to DELETE this entry.", MB_OKCANCEL, MB_ICONINFORMATION, MB_DEFBUTTON1);
--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$--
-- Get the selected row number. If nothinh is selected, do nothing
--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&&--
tSelected = ListBox.GetSelected("ListBox_SiteList");
if tSelected then
nSelected = tSelected[1];
tItemRowNumber = String.ToNumber(ListBox.GetItemData("ListBox_SiteList", tSelected[1]));
--Delete the entry from the database
SQLite.Query(db, "DELETE FROM Websites WHERE RecordID = '" .. tWebsites.Data[tItemRowNumber]["RecordID"] .. "'");
nLastError = Application.GetLastError();
if nLastError ~= SQLite.OK then
Dialog.Message("Error: " .. nLastError, SQLite.GetLastErrorString());
end
FillSitesList();
-- Reselect the next item in the list...
nReselect = nSelected;
nNumItems = ListBox.GetCount("ListBox_SiteList");
if(nNumItems > 0)then
if(nReselect > nNumItems)then
nReselect = nNumItems;
end
ListBox.SelectItem("ListBox_SiteList",nReselect);
end
end