[EXAMPLE TlistBox.Filtered] lazarus / 21-General ---------------------------------------------------------------------- What I can do · 2024-10-31 16:55 OS:Windows 10 Lazarus 3.4 Project: a List box mixed with the path of a file names that extensions are bmp, gif, ani, ico I would like to click on radio, check box, or edit combo type input to pick the filter extensions. I thought ListBox1.Filter('.bmp') would maybe get me close but I have not yet found how to use it. could anyone point me into a help source article or link ---------------------------------------------------------------------- TRon · 2024-10-31 18:17 Not really help or an article but a small example (hopefully you are able to read/understand code) ---------------------------------------------------------------------- What I can do · 2024-10-31 19:09 Thank you! WOW! Not only was this perfect but pointed me towards a much better understanding, with other question followed by WTF moments such as ------------------------------------------------------ writestr(naming, 'file-', n, extensions[index]); //... for naming in extensions   do for SelectedExtension in SelectedExtensions   do //... then exit(true); again thank you for taking the time from your scedual. ---------------------------------------------------------------------- What I can do · 2024-10-31 20:39 interesting... at cursor writestr| [Alt][up arrow]  Nothing? [Ctrl][Space] pop up window shows WriteStr(var S:String;Args:Arguments); ok, I don't know which unit it is from. so if Arguments is a variable type can it be used to see all its parameters. but no,  a:Arguments is an error? So now... https://wiki.lazarus.freepascal.org/WriteStr is good reading but... Had to follow up with this https://wiki.lazarus.freepascal.org/Write awsome this is what I like about examples. Many times they open doors to other doors. ---------------------------------------------------------------------- TRon · 2024-10-31 22:04 Your welcome "What I can do" and I'm glad to see that you were able to solve your issue. Quotefollowed by WTF moments It is another way of iterating an array that doesn't require to declare a separate index iterator. In practice you can do that for any array (enumerable type), e.g: 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 type  TFoo = record   Bar : string;  end;  TFooArray : array of TFoo;var  Foo    : TFoo;  FooArray : TFooArray; // array is empty, needs to be "filled" before the routine below actually outputs somethingbegin  for Foo in FooArray     do writeln(Foo.Bar)end; Do note that in this case the iterator is a copy of the record and not the record itself. That means that changing any of the fields of the iterator is not actually 'stored' in the array. See also for..do documentation QuoteThe enumerable expression can be one of five cases: - An enumeration type identifier. The loop will then be over all elements of the enumeration type. The control variable must be of the enumeration type. - A set value. The loop will then be over all elements in the set, the control variable must be of the base type of the set. - An array value. The loop will be over all elements in the array, and the control variable must have the same type as an element in the array. As a special case, a string is regarded as an array of characters. - An enumerable class, object, or extended record instance. This is an instance of any structured type that supports the IEnumerator and IEnumerable interfaces. In this case, the control variable’s type must equal the type of the IEnumerator.GetCurrent return value. - Any type for which an enumerator operator is defined. The enumerator operator must return a structured type that implements the IEnumerator interface. The type of the control variable’s type must equal the type of the enumerator’s GetCurrent return value type. Quoteinteresting...at cursor writestr WriteStr works, as the documentation mentions, similar as write (or writeln but withouth the newline character added). Meaning that whatever type that can be written by write works exactly the same as when using WriteStr. The (only) difference is that the first parameter of WriteStr is the string that everything is written to (instead of writing the generated text to the standard output handle). If wanted it is possible to use writestr to 'extend' the string like: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  s : string;begin  writestr(s, '');  writestr(s, s, 'Foo');  // s contains "Foo"  writestr(s, s, 'bar');  // s contains "Foobar"end;  If there are any (other) questions then feel free to ask. Perhaps the above ramblings might be useful to someone.