No, it's all mechanical.
The auto hubs need the wheels to be in contact with the ground, with the truck moving, to lock in.
Besides the transfer case, driveshaft and hubs, there are the front differential and front axle shafts that come into play (along with a few u-joints).
To diagnose this, put the truck in 2WD, turn off the motor, and jack up both front tires. Turn the front driveshaft by hand, and make sure the front axle shafts are turning (you'll need a helper to be able to watch all of this action). If the axles are not turning, could be your differential or u-joints. If the axles are turning, you may either have a hub problem, or a u-joint problem.
I once had a problem that I thought was the hubs, turned out to be the u-joints. My hubs were slow to unlock. I replaced the hubs first, didn't make the problem go away. I had the u-joints serviced, everything is good as new.
If your hubs have never been serviced (or not in a long time), try this first (it's a free fix). Remove the front tires, pull the hubs and spring-loaded cams (do a google search, there's tons of links to this procedure). Don't take off the rotors or anything that far.
Clean these parts thoroughly (get rid of all grease). There is a spring loaded mechanism within the hubs that must move freely (it engages the cam, it should be obvious when you have it apart). Make sure that mechanism moves in/out when you press on it. Fill the hubs with ATF and let them soak for a good hour.
Clean as much grease off the spindle as possible without removing any more parts. Drain the hubs, reinstall the cams, hubs and tires, take a test drive and see if they engage.
Sometimes, excess grease (and the dirt that it collects) makes the hubs have a hard time engaging.
If that doesn't cure it, time to look at the u-joints.
You could also bring it to a trusted garage and have them diagnose it. Stay with the truck and make them show you what they think is wrong (and why). Then you can decide if you want to tackle the job yourself (pay for the diagnosis and leave), or let them do it while you're there and the truck's on the lift in a warm garage...
Mike