Add setWidget function.