Confused with OSCMonitor tutorial/demo

Hi, in the OSCMonitorTutorial and the OSCMonitor demo, there’s a Label “portNumberField” that is supposed to let user input a new number for OSC port, but it is also specified as:

portNumberField.setEditable (true, true, true);

Doesn’t that discard whatever number the user just input, countering its purpose?

Do you mean that last lossOfFocusDiscardsChanges argument? All that does is control whether leaving the control in mid-edit as ‘commit when I leave’ or ‘if I leave without hitting [Enter], forget what I started to put in here.’ (obviously, you can change the value & recompile to see the difference in behavior)

I did try to change it and prefer the result. Thought it was either “commit when I leave” or “undo when I leave” and didn’t expect the later also has a “commit when I hit Enter” behaviour. It was not mentioned in the document here:
https://docs.juce.com/master/classLabel.html#a9342a397932d82bb1d196ebf9a8969d8

I should have a closer look of the source code before posting. Thanks for explaining.