Forum > LCL

[SOLVED] Component inheritance

(1/1)

pcurtis:
How can I test if a component is derived from TControl or is a visual component?

devEric69:
Hello,

Already 2 simple ways (having said that, I thought that the proper of a control, was to be visual, but well... I don't see where the trap is). So, here is my dummy:


--- 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";}};} ---if (oMyComponent is TControl) then ...\...else if (oMyComponent is TWinControl) then ...\...
or


--- 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";}};} ---if (oMyComponent.InheritsFrom(TControl)) then ...\...else if (oMyComponent.InheritsFrom(TWinControl)) then ...\...

pcurtis:
Thanks

howardpc:
In fact the simple test
--- 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";}};} ---if oMyComponent.InheritsFrom(TControl) then ...is sufficient.
TWinControl is a TControl descendant.

Navigation

[0] Message Index

Go to full version