News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Patch: new input fields for integer numbers

Started by Dwachs, November 28, 2008, 08:12:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dwachs

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.

z9999

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.

gerw

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

Dwachs

Parsley, sage, rosemary, and maggikraut.

z9999

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 ?

gerw

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.

wernieman

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

gerw

Have a look at the patch file:
Index: gui/components/gui_numberinput.cc
===================================================================
--- gui/components/gui_numberinput.cc (revision 2153)
+++ gui/components/gui_numberinput.cc (working copy)

prissi

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

gerw

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.

z9999

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