Skip to main content
Topic: Patch: new input fields for integer numbers (Read 5669 times) previous topic - next topic

Patch: new input fields for integer numbers

The patch provides a new gui element, gui_intinput. It can be used for the input of numbers. It is heavily used in the 'new world' dialogue.

Features of the gui-input:
-- input by keyboard (numbers only)
-- cursor movement as for textinputs (arrows, home, end, mouse clicks)
-- buttons for increasing / decreasing like it was implemented in the new-world-dialogue.
-- uses mouse-wheel for faster increasing / decreasing
-- min and max values can be specified

It depends on this patch: http://forum.simutrans.com/index.php?topic=897

I was not sure, which min and max values should be prescribed in the world-dialogue. Any suggestions are welcome.

The climates-dialogue should also be changed using this gui-element. Here, I was not sure how to implement min/max-valus. Should the min-value of the 2nd climate depend on the actual value for the 1st climate etc?
Parsley, sage, rosemary, and maggikraut.

Re: Patch: new input fields for integer numbers

Reply #1
Is it possible to add "clear field" key ? For example, press space key to clear field.
My eyes are not very good, and clicked place and cursor position don't match.
It is hard for me to see where the cursor is.

Or, clicking field always set cursor to the same position (end position) is better.

Re: Patch: new input fields for integer numbers

Reply #2
This patch will fix it (in collaboration with Dwachs).

Re: Patch: new input fields for integer numbers

Reply #3
 :-*
Parsley, sage, rosemary, and maggikraut.

Re: Patch: new input fields for integer numbers

Reply #4
Thank you.
Another request.

When I hit "delete" or "backspace" key, cursor always move to the end position.
I must move cursor again. It is very annoying.
Is it possible to keep cursor position after hitting "delete" or "backspace" key ?

Re: Patch: new input fields for integer numbers

Reply #5
This patch will fix the wrong positioning of the cursor. It also requests the focus for the textinput if a button was pressed or the mousewheel was used.

This patch is brought to you by Dwachs and gerw.

Re: Patch: new input fields for integer numbers

Reply #6
You make so much patches .. can you write witch version do you test the patch?
I hope you understand my English

Re: Patch: new input fields for integer numbers

Reply #7
Have a look at the patch file:
Code: [Select]
Index: gui/components/gui_numberinput.cc
===================================================================
--- gui/components/gui_numberinput.cc (revision 2153)
+++ gui/components/gui_numberinput.cc (working copy)

Re: Patch: new input fields for integer numbers

Reply #8
I do not understand the purpose of keeping cursor position, but added anyway

Re: Patch: new input fields for integer numbers

Reply #9
The problem was the following: If you pressed the delete or backspace key in the input field, the cursor always jumped to the end of the string. This was a very confusing behaviour.

Re: Patch: new input fields for integer numbers

Reply #10
It works well in r2156.
Thank you for your many works.  :)