local mf = getMainForm() local sd = mf.SaveDialog1 local od = mf.OpenDialog1 local sdOrigOnClose = sd.OnClose local odOrigOnClose = od.OnClose local function returnFileName(path) --extracts file name from full path (not full path => return nil) return (path~=nil) and (path:match("\\([^\\]+)$")) end local currentTableNameLabel = createLabel(mf.Panel5) currentTableNameLabel.AnchorSideLeft.Control = mf.foundcountlabel currentTableNameLabel.AnchorSideLeft.Side = asrBottom currentTableNameLabel.AnchorSideTop.Control = mf.foundcountlabel currentTableNameLabel.AnchorSideTop.Side = asrCenter currentTableNameLabel.BorderSpacing.Left = 20 currentTableNameLabel.Caption = 'Table: ' currentTableNameLabel.ShowHint = true local currentTableNameTimer = createTimer(mf) currentTableNameTimer.Interval = 200 currentTableNameTimer.OnTimer = function (t) if mf.active then t.Enabled = false end local name = returnFileName(sd.Filename) if name then currentTableNameLabel.Caption = 'Table: "'..name..'"' else currentTableNameLabel.Caption = 'Table: ' end currentTableNameLabel.Hint = sd.Filename end local function OnClose(sender) if sdOrigOnClose then sdOrigOnClose(sender) end currentTableNameTimer.Enabled = true count = 0 end sd.OnClose = OnClose od.OnClose = OnClose -- Make "Delete all addresses from list" button prompts user to clear the table name if there's a table currently loaded local orgSpeedButton2Click = mf.SpeedButton2.OnClick local function newSpeedButton2Click(sender) orgSpeedButton2Click(sender) if (getAddressList().Count == 0) and (#sd.FileName > 0) and (messageDialog('Do you want to create a new table?', mtConfirmation, mbYes, mbNo) == mrYes) then sd.Filename = '' currentTableNameLabel.Caption = 'Table: ' currentTableNameLabel.Hint = '' end end mf.SpeedButton2.OnClick = newSpeedButton2Click