Headcode boxes were a comparatively recent phenomenon. In the days of steam, (most) railways did not display headcodes, except on specials. People who needed to know, knew.
I can't see how useful displayed headcodes would be to signalmen between Preston and Carlisle these days.
In earlier days, services were less frequent and staff worked their way up so were expected to know what train was due from memory.
Some of the earliest were backlit obscured glass plates that stencils were placed in front of. The LSWR used these for its electric trains, initially a single capital letter (there is a famous photo of 5 trains lined up at Waterloo displaying HOVIS), later changed to 2 digit number on Southern. The secondman window could be opened outwards to lean out and change the stencil.
3 digit numbers were common on Steam trains to West Country in 1950s, especially on Summer weekends when many extras ran. Helped staff identify what trains were (especially as the extras might not have had any mixed traffic or freight loco so visually identifying by rolling stock type was hard)
I think Southern region continued the 2 digit codes until early 1990s as there was still some stations using finger boards for passengers to identify trains (wooden destination boards, taken from rack by member of platform staff and inserted in a slot about 2m up). Essential to visually check in peaks when there had been disruption and trains were sometimes running out of sequence. Once destination boards became automated the platform staff didn't need these.