GUI is a bit different when it comes for example to selecting units in a strategy game. I usually make a loop of shown units that calculates which one's center point is nearest to the cursor, while cursor has to be closer than unit radius. That way it always clicks the unit you are pointing at.
for i:=0 to UnitCount-1 do
with unit[i] do begin
if (temp<Nearest) and (temp<=Radius) then begin
// And here our Selected variable is index to closest unit to cursor
// if it is greater than or equal to 0 ...