Jump to content

Delphi TListBox Question

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
nullbyte

nullbyte

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 302 posts
So I have 2 ListBox-es on my form.
On the first one, I want to have 2 items: Maths and Languages. On the second, when user clicks Maths I want to show: Algebra and Geometry, and if user clicks on Languages to display Norwegian, Swedish etc.

How to do it?

Thanks for help.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
You will need an (I think) onclick event for the first listbox that clears the stringlist and uses the .add() method to add the new options to second listbox.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Rustix666

Rustix666

    Newbie

  • Members
  • PipPip
  • 15 posts
ListBox2.Items.Clear;
case ListBox1.ItemIndex of
0: 
begin
ListBox2.Items.Add('Algebra);
ListBox2.Items.Add('Geometry');
end;
1:
begin
ListBox2.Items.Add('Norwegian');
ListBox2.Items.Add('Swedish');
end;
end;

Edited by Jaan, 13 December 2009 - 12:22 PM.
Please use code tags when you are posting your codes!