An automated way to delete the list is:

if cb_pin_function.dropdown.cols.rowcount > 0 then
  for i:=1 to cb_pin_function.dropdown.cols.rowcount do
    cb_pin_function.dropdown.cols.deleterow(0);

On Thu, Mar 18, 2021 at 9:57 PM vasi vasi <[email protected]> wrote:

> Of course, at runtime.
>
> let's say we have the following combobox:
> cb_pin_function: tdropdownlistedit;
>
> Now, if you need to dynamically populate (and at a later time, delete) the
> dropdown list, you do it as below. I do this because there is no wiki or
> documentation for msegui.
>
> var a:array [1..5] of msestring;
> begin
>   a[1] := 'Row 1';
>   a[2] := 'Row 2';
>   a[3] := 'Row 3';
>   a[4] := 'Row 4';
>   a[5] := 'Row 5';
>   // adding rows in the dropdown
>   cb_pin_function.dropdown.cols.addrow(a[1]);
>   cb_pin_function.dropdown.cols.addrow(a[2]);
>   cb_pin_function.dropdown.cols.addrow(a[3]);
>   cb_pin_function.dropdown.cols.addrow(a[4]);
>   cb_pin_function.dropdown.cols.addrow(a[5]);
>
>   // setting a current index in combobox dropdown
>   cb_pin_function.dropdown.itemindex:=0;
>
>   // if you need to empty the dropbox list, you can do it as below
>   cb_pin_function.dropdown.cols.deleterow(0);
>   cb_pin_function.dropdown.cols.deleterow(0);
>   cb_pin_function.dropdown.cols.deleterow(0);
>   cb_pin_function.dropdown.cols.deleterow(0);
>   cb_pin_function.dropdown.cols.deleterow(0);
>  // the number of delete operations cannot be bigger than the number of
> added rows
> end;
>
> I discovered this by trial and error and of a big help to me is Visual
> Studio Code editor, with pascal extensions that provide autocompletion and
> list of suggestions.
>
> --
> Vasi
>


-- 
Vasi
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to