The International Simutrans Forum

 

Author Topic: Making textinput using an internal string and call_listener with all changes.  (Read 4076 times)

0 Members and 1 Guest are viewing this topic.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
This is an ongoing effort, as it needs changes with many dialoges. But in the end a much more consistent scheme will be obtained, and the many intermediate strings to compare will be hopefully all gone.

Online Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4869
  • Languages: EN, DE, AT
In your patch it seems that the city info window will send a rename-command every time a letter is inserted / deleted?

Also their is the possibility for unexpected results:
Code: [Select]
1) open city window "Berlin"
2) accidentally delete last letter: "Berli", rename command is send to server
3) undo this change: "Berlin" - as the rename command has not arrived yet at the client, no rename command is sent
4) now the rename command arrives: "Berli"

I do not see, why it is necessary to call listeners on every letter change?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
Direct showing the changes was the behaviour until last year. It gave also very direct feedback to the user (especially for filtering for instance, try the convoi filter or the line window) and avoid the hassle with the many temperary old/current content strings. With a server the update in the map will lag.

In your case it will just issue two rename commands, "Berli" and "Berlin". Those will be executed one after each other, and in the end you will have Berlin.

But of course the three dialogues (stadt, convoi, haltinfo) with the update_data() calls on could simply refrain from updating the content of the name field if it has currently the focus.

Offline VS

  • Senior Plumber (Devotee)
  • Devotees (Inactive)
  • *
  • Posts: 4856
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
When I played with renaming stops with cities, the change-while-typing was a very frustrating behaviour, too...

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
OK, why? Isn't that what you expect?

Offline VS

  • Senior Plumber (Devotee)
  • Devotees (Inactive)
  • *
  • Posts: 4856
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
The problems were specific to that situation, really. Still... there's an expected difference between typing and some "accepting" of what was typed. I think the same applies here. Programmer wants a "rename" operation to be atomic, not a series of changes that can pass through some nexus where everything is possible (empty string).

Offline Fabio

  • Devotee
  • Administrator
  • *
  • Posts: 2898
  • The Pak128 Guy
    • Visit me on Facebook
  • Languages: EN, IT, RO, FR
IMHO it's important to distinguish between name text field, where the change must be applied only pressing enter or leaving the field (and maybe ctrl-z undoes last change) and filter fields, where real time changes in text field might be useful (e.g. Google's search fields).

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
The only field, where I personally would expect to wait for explicit is a password entry. Other than that for the programming both is not too difficult. The few extra messages are not very important.

Especially what was exactly the problem of renaming stops and seeing the output immediately?

Anyway, if you rather see changes only by closing dialoges or hitting Enter, I can live with that. There was just a rule of UI design to provide immediate feedback, which I tried to follow again more closely.

Offline Ashley

  • Coder/Patcher
  • Devotees (Inactive)
  • *
  • Posts: 1288
    • entropy.me.uk
The immediate feedback comes from the box you're typing the text into. IMO changes should only be applied upon hitting enter in the text box, or closing the dialog.

Offline Carl

  • Devotee
  • *
  • Posts: 1682
    • Website
  • Languages: EN
Perhaps non-programmers would feel differently about this. When I started playing Simutrans, it came as a surprise to me that I had to press enter in order to get a stop-name to save, and I found this counter-intuitive.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
Even currently, city names are immediately changed. So there is already inconsistency around.

Offline Fabio

  • Devotee
  • Administrator
  • *
  • Posts: 2898
  • The Pak128 Guy
    • Visit me on Facebook
  • Languages: EN, IT, RO, FR
Would it be possible to have both systems, selectable by simuconf.tab or game settings?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
As always, with some extra effort: Yes

Offline VS

  • Senior Plumber (Devotee)
  • Devotees (Inactive)
  • *
  • Posts: 4856
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
IMO making this switchable makes little sense. I think the problems are mostly on the level of programming... Anyway, at least current implementation is consistent, so everyone knows what to expect :)

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
Current implementation is not consistent. Cities are renamed instantaniously. That brought me working on that ... I will try to use a macro, so we can decide later.