Forum > LCL

[SOLVED] TShellTreeView crashes when deleting folders outside application.

<< < (2/2)

Mig.BR:
Thank's Ally and wp for the quick help and solution to the problem. I made a small change to the proposed solution as I thought it would be interesting to keep the alignment of the name of the deleted folders (aesthetics only). :)


--- 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";}};} ---var  filename: WideString;  ico: TIcon;  size: TSize;   ...   if ico = nil then  begin    size := GetBuiltinIconSize;    Result := Types.Size(size.Width, size.Height);    exit;  end; 

Ally:
Here some more code aesthetics  ;) :)

--- 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 ico = nil then    Exit(GetBuiltinIconSize); 

Mig.BR:

--- Quote from: Ally on July 29, 2022, 11:35:40 am ---Here some more code aesthetics  ;) :)

--- 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 ico = nil then    Exit(GetBuiltinIconSize); 
--- End quote ---

Yes, Ally, it looks better that way. I used to do it this way in Java. I'm also an old school programmer like wp. With time we value easy code interpretation, that is, we simplify. I avoid returns in Exits because in the past I had problems with memory leaks. It is not the case here but the hurry sometimes makes us inattentive to what we can or cannot return in Exits. Someone in the future may want to turn a Record into a Class. The compiler doesn't always warn us about this.

wp:
I think the unindented name better indicates that something is wrong with this file

Navigation

[0] Message Index

[*] Previous page

Go to full version