code simplication to detect strech widget