Ok, I have done this- on window resize, I compute the size of other buttons in the tool bar, subtract this from current size of tool bar and get the remaining size that I will give to text field. This works, is this the same thing you were saying?
Also, this still leaves the problem of - how to initialize the text field size. I mean the above trick works when window is resized, but when the web app loads, how to get the size of tool bar and hence compute the size of text filed?