Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to press enter in formspec without closing it #2743

Closed
technomancy opened this issue May 31, 2015 · 12 comments
Closed

No way to press enter in formspec without closing it #2743

technomancy opened this issue May 31, 2015 · 12 comments
Labels
Bug Issues that were confirmed to be a bug Feature request Issues that request the addition or enhancement of a feature

Comments

@technomancy
Copy link

In this form, I'd like to be able to press enter to trigger the on_receive_fields callback, but every time I press enter, it closes the form.

According to Zeno on the freenode channel, it should only close when button_exit is set, but this appears not to be checked here: https://github.com/minetest/minetest/blob/master/src/guiFormSpecMenu.cpp#L3038

@Zeno- Zeno- added Bug Issues that were confirmed to be a bug Feature request Issues that request the addition or enhancement of a feature labels May 31, 2015
@Zeno-
Copy link
Contributor

Zeno- commented May 31, 2015

I've labeled this as a bug (as well as feature request) because I think that, in essence and in my opinion, not having a way to bypass the enter key closing a formspec is undesirable behaviour

@technomancy
Copy link
Author

For what it's worth, my long-term goal is to be able to implement a terminal in Minetest (a la computercraft's) but since that appears to be currently impossible the current engine, so I'm shooting for the next-best thing, line-oriented teletype interaction.

@4aiman
Copy link
Contributor

4aiman commented Jun 3, 2015

I just show another formspec to a player in magichet.
I have to update some fields in the current formspec most of the time anyway.

But image_button work well for me - I sort inventory with it and it doesn't close anything.

@technomancy
Copy link
Author

@4aiman Could you give me a link to the code where you just show another formspec to make it appear as if enter doesn't close the form? I've tried this in my own code and haven't been able to get it to work.

@4aiman
Copy link
Contributor

4aiman commented Jun 14, 2015

@technomancy
There's no link to a code sample at the moment, but I can assure you that the following works:

  1. Create a handler for on_recieve_fields()
  2. minetest.show_formspec()
  3. inside your handler (from the point 1) you should have something like:
if formname == 'bla-bla-bla' then
   if fields.button1 then
      minetest.show_formspec()
   end
end

In case you'll need more info: please, tell me what are you trying to do and if possible show your code that needs "fixing". I'll be able to help you. I won't demand anything from you in turn, so feel at ease about licensing or whatever distribution concerns you may have.

@technomancy
Copy link
Author

@4aiman Thanks. What I've got is here: technomancy/calandria@84f3651

I call minetest.show_formspec(...) in on_receive_fields regardless of the value of formname or fields, but it does nothing. If I call the function with no arguments, it crashes the game with a ServerError.

@4aiman
Copy link
Contributor

4aiman commented Jun 15, 2015

@technomancy
I've answered in a comment below your code ;)
technomancy/calandria@84f3651#commitcomment-11673753

Please, try the things I've described and tell other people here should you succeed.
(Or tell me in comments in your repo if you won't, so I will be able to help you.)

@technomancy
Copy link
Author

Just to follow-up back here re: conversations held elsewhere, there are some workarounds for this, but none of them work for keyboard-initiated form callbacks, which is what I need.

Is there anything I could do to help get this fixed inside Minetest itself?

@tenplus1
Copy link
Contributor

tenplus1 commented Mar 4, 2016

I wouldn't say this is a bug, more down to how the formspec/mod is written... Check out how nametags are done in mobs redo, you can hit enter and it works fine; https://github.com/tenplus1/mobs/blob/master/api.lua#L2662

@ShadowNinja
Copy link
Member

#516

@paramat
Copy link
Contributor

paramat commented Apr 2, 2016

#516 was refused btw.

@Ferk
Copy link
Contributor

Ferk commented Apr 3, 2016

I think the idea was to make a new formspec element for this, instead of changing the behavior of the current one. That's why it was refused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues that were confirmed to be a bug Feature request Issues that request the addition or enhancement of a feature
Projects
None yet
Development

No branches or pull requests

8 participants