cancel in dialogs and input lazarus / 9-Editor ---------------------------------------------------------------------- skaner1900 · 2010-07-25 12:18 Hi! Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);begin  ListBox1.Items.Add(InputBox('a','b','c'));end; and Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.OpenDialog1Close(Sender: TObject);begin  ListBox1.Items.Add(OpenDialog1.FileName);end; procedure TForm1.SelectDirectoryDialog1Close(Sender: TObject);begin  ListBox1.Items.Add(SelectDirectoryDialog1.FileName);end; why this code add item to ListBox when user click "Cancel"? how to stop it? ---------------------------------------------------------------------- skalogryz · 2010-07-25 12:31 Quote from: skaner1900 on July 25, 2010, 02:18:39 pmwhy this code add item to ListBox when user click "Cancel"? how to stop it? because you don't check the result of the dialog. The modal dialog function usually returns True or False (or similar values) describing a button pressed by user: Ok or Cancel Code: [Select]procedure TForm1.Button1Click(Sender: TObject);  begin    if OpenDialog1.Execute then     ListBox1.Items.Add(OpenDialog1.FileName);  end; ---------------------------------------------------------------------- skaner1900 · 2010-07-25 14:36 yes, it's easy... last time, I worked in pascal... 5 years ago... so, sorry... but... how do it with InputBox?