Hline select after creation

Hi, Is there a way to programatically select a H-line just after it has been created, so that it can be moved with mouse without having to doubleclick it first ?

after it's been created programmatically or manually ?

The line is created at runtime, would also like to select it programatically at the same time, so it can be moved with mouse without having to doubleclick first.