delphi - Create an on click event handler for an array of Radiobuttons -
i have created array of radiobuttons, created in event. want create event, saying make radiobutton invisible when clicked , show message. has happen on click. can me? how created radiobuttons
for k := 1 20 begin rd[k] := tradiobutton.create(self); rd[k].parent := pgcverkiesing; rd[k].caption := 'rs'+inttostr(k); rd[k].left := 16; if k = 1 rd[k].top := 26 else rd[k].top := (k*24) ; rd[k].onclick := onclick; end;
now want : rs1.clicked //procedure
rs1.disabled := true; richedit1.lines.add := 'name'; showmessage(names);
what do?
if understood correctly, want disable clicked radiobutton.
define event radiobuttons:
procedure tform1.onradiobuttonclick(sender : tobject);
when creating radiobuttons, tie event handler radiobuttons.
rd[k].onclick := onradiobuttonclick;
procedure tform1.onradiobuttonclick(sender : tobject); begin tradiobutton(sender).enabled := false; richedit1.lines.add( 'name'); showmessage( names); // names not defined ?? end;
Comments
Post a Comment