Jeremy
 
I know the feeling
'Case' in point a RadioGroup with four buttons 'Left', 'Right', 'Up', 'Down'
 
What is the 'correct' way to interogate this component in an associated event
 
procedure TForm1.Button1Click(Sender: TObject);
begin
  case RadioGroup.ItemIndex of
  ....
end;
 
ItemIndex is an integer but if you rearrange the radio buttons you break the code so
is it better to use
 
procedure TForm1.Button1Click(Sender: TObject);
begin
  if CompareText(RadioGroup.Items[ItemIndex],'UP') = 0 then ....
  ....
end;
 
but you are hard coding constants another no no
 
Think about it
 
Regards
Neven
 
 
 
 
 
----- Original Message -----
Sent: Tuesday, 15 February 2000 14:37
Subject: [DUG]: VB Like Case statement

Hi all.
 
the one thing I DO miss from VB is its case statement which can be a number or a string.
 
i.e. select case myvariable
       case "Hello"
           show_hello
      case "goodbye"
           show_goodbye
     end select.
 
This  has its good and bad points, BUT ofcourse in Delphi it pretty much has to me an integer etc.
Does anyone have any ideas how this could be implemented in Delphi, OR if Delphi has a simlilar type of thing....
 
THanks,
 
Jeremy Coulter (manager)
Visual Software Solutions

110 Harewood Road
Christchurch
ph +64 3 3521595
fx +64 3 3521596
cell +21 2533214
http://www.vss.co.nz
 

Reply via email to