Forum > Beginners
Coponents and names(Solved)
JLWest:
I have 52 card images labeled I1...I52; I can always find the string value 'I1'..'I52'.
But I would like the Timage name I1..I52. My code at line 8 isn't right. I need to pass it as a parm in the procedure ShowTrash.
Thanks
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.MoveToTrash(S : integer); Var ImageName : TImage; MyImageName : string; begin Inc(GTRASHBIN); MyImageName:='I'+IntToStr(S); ImageName := TImage.FindComponent(MyImageName); // Error ShowTrash( GTRASHBIN,ImageName ); end;
Josh:
ImageName := TImage(FindComponent(MyImageName));
JLWest:
Perfect! Thanks
Josh:
Your welcome
Question/Test for JLWest
Can you explain why it works; and why your code did not?
I Know this is odd thing to post; but I think a good learning question; rather than just fixing code..
JLWest:
ImageName := TImage.FindComponent(MyImageName);
ImageName := TImage(FindComponent(MyImageName));
I can see the difference but don't understand.
Navigation
[0] Message Index
[#] Next page