Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

How do I have an InputField adjust to fill the remaining size of the window automatically? For example:

enter image description here

Using the ImageSize option often either freezes or takes 5 seconds or longer to run in Mathematica 8.0 in Windows 7. No longer an issue.

share|improve this question
1  
If characters are fixed-width, find out the width of a character and divide by this? –  shrx Jun 17 '13 at 21:47
    
@shrx With all the different Unicode variations, or even a common example for mathemaiica users the -> I can't really imagine the InputField contain a fixed width font, but I could be wrong. –  Liam William Jun 17 '13 at 22:40
    
Have you tried the ImageSize option for InputField? –  Silvia Jun 17 '13 at 23:05
    
@Silvia ImageSize just seems to take forever to evaluate in mathematica for me. I am going to edit the question example that shows the speed issues. –  Liam William Jun 17 '13 at 23:16
    
Hmm... I didn't encounter any speed issue with that option. Could you describe your issues more precisely? –  Silvia Jun 17 '13 at 23:19

1 Answer 1

up vote 0 down vote accepted

Not sure if 124px as the difference will work in all Operating System, but it certainly seems to work in Windows 7 M8.0.

width1 = 100;
width = Dynamic[(WindowSize /. 
      Options[SelectedNotebook[], WindowSize])[[1]]];
Grid[{{
   InputField["fixed", String,
    ImageSize -> {width1, Automatic}],
   InputField["dynamic", String, 
    ImageSize -> {Dynamic[width] - 124 - width1, Automatic}]
   }}]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.