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.

  • 1
    $\begingroup$ If characters are fixed-width, find out the width of a character and divide by this? $\endgroup$ – shrx Jun 17 '13 at 21:47
  • $\begingroup$ @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. $\endgroup$ – William Jun 17 '13 at 22:40
  • $\begingroup$ Have you tried the ImageSize option for InputField? $\endgroup$ – Silvia Jun 17 '13 at 23:05
  • $\begingroup$ @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. $\endgroup$ – William Jun 17 '13 at 23:16
  • $\begingroup$ Hmm... I didn't encounter any speed issue with that option. Could you describe your issues more precisely? $\endgroup$ – Silvia Jun 17 '13 at 23:19

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]]];
   InputField["fixed", String,
    ImageSize -> {width1, Automatic}],
   InputField["dynamic", String, 
    ImageSize -> {Dynamic[width] - 124 - width1, Automatic}]
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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