[patch - New Feature] Input Function enhancements

Notes on testing the latest builds of MapTool

Moderators: dorpond, trevor, Azhrei

Nildik
Cave Troll
Posts: 76
Joined: Mon Oct 31, 2011 7:32 pm

Re: [patch] Input Function improvements(?)

Post by Nildik »

Wow, is more dificult than I supposed in the first look. Yesterday, I spend a lot of time trying to set it up, but no results. I give up, but thanks anyway.
Can you generate a special version with your patches in it? Seems that a new version of maptool is taking a long time, and a improved Input function is very useful to me (mainly for the textarea input).
Thanks.

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: [patch] Input Function improvements(?)

Post by Lee »

To all: Updated the patch to reflect a few changes to the behavior; mainly, SOF (select on focus) is set to false as default, and corrected focus behavior on radio controls.

@Nildik: Ah, sorry to hear that. As much as I'd want to, you'll be better off for now to stay within the official MT build. Whatever gets accepted into the final official version, it is sure to be better, even if I applied all my patches right now; and if you broke off and wrote scripts using special, unsanctioned features, it will be a pain for you to convert back to the official MT if these features are unavailable then.

What I can suggest to you is to continue building your stuff with a text area in mind but making do with a text field for now. When the final build comes out and this patch doesn't make it in, I'll stand by what I said and build a special version for you; and then you can refactor all those text fields into text areas easily. Besides, I'm still tinkering with this and might add more to it; maybe positional control if there will be use for it, to name one..

Nildik
Cave Troll
Posts: 76
Joined: Mon Oct 31, 2011 7:32 pm

Re: [patch] Input Function improvements(?)

Post by Nildik »

You are right Lee, is better to stay in the official version. I have to wail until the new version is released. Anybody knows how long it takes?

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: [patch] Input Function improvements(?)

Post by Lee »

It's a matter up to the official dev team. Personally, I'm inclined toward a longer wait since I, and others like me, are working on improvements that would need testing and requirements verification to make it in. Others have stated a preference for sooner, rather than later, ironing out the last major bugs, closing shop, and having any further development come by way of forks from the last official build.

I think that is a viable option as well; though I also think that it might create a little over-proliferation of available versions, and fragment the community a bit regarding choice till 1.4 comes out. Well, that's just an opinion.

Nildik
Cave Troll
Posts: 76
Joined: Mon Oct 31, 2011 7:32 pm

Re: [patch - New Feature] Input Function enhancements

Post by Nildik »

Hello.
Do you know if this feature is included in the b89? If not, Why?

I think that is a very good enhancement to the input function and would be nice if it were included.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [patch - New Feature] Input Function enhancements

Post by wolph42 »

Nildik wrote:Hello.
Do you know if this feature is included in the b89? If not, Why?

I think that is a very good enhancement to the input function and would be nice if it were included.
AFAIK its not implemented in b89 as it was too much of a change of the core code.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: [patch] Input Function improvements(?)

Post by Azhrei »

wolph42 wrote:AFAIK its not implemented in b89 as it was too much of a change of the core code.
True; it's not a bug fix. And I haven't looked at the code at all.
aliasmask wrote:
Lee wrote:Example: [input(strformat("jsonVar | %s | Prompt type | width=50", json.set("{}", "a", 1, "b", 2, "c", 3)))]
Cool, that'll actually work. I was afraid the syntax of the json would be a problem, especially for quotes.
So the JSON data is embedded within the input() parameter as a string? That means if it were already in a variable it would need to be string-ified and then JSON-ified back again inside the macro function, right? That seems a waste.

Why not provide a variable name instead? The variable can be created to hold the JSON and if the variable doesn't hold a JSON object then the error message can even be specific: "Variable <...> does not contain a JSON object".

The code that converts a String to a JSON typically checks for a leading "[" or "{" and then calls new JSONObject(s) or new JSONArray(s). But if the string doesn't start with those characters, you could use the parser to look up the value of the variable and use the result. If it's already JSON then there's no conversion back and forth and no need to worry about quotes not being nested properly.

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: [patch - New Feature] Input Function enhancements

Post by Lee »

Hi Azhrei,

I'll have to remember how this all works before making a worthwhile reply, but what I know is the JSON need not be embedded in the string and can be passed as a variable when strformat is used to construct the input argument(s). I hope I'm on the same page here :lol:

Nildik
Cave Troll
Posts: 76
Joined: Mon Oct 31, 2011 7:32 pm

Re: [patch - New Feature] Input Function enhancements

Post by Nildik »

Ok, understood, and thanks for the explanations.

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: [patch - New Feature] Input Function enhancements

Post by Lee »

I've gone over the old stuff I wrote when I was learning the MT code and found that it can be done a lot better. I've taken out the patch I uploaded here and will work on the improved version in the future.

Nildik
Cave Troll
Posts: 76
Joined: Mon Oct 31, 2011 7:32 pm

Re: [patch - New Feature] Input Function enhancements

Post by Nildik »

Any chance to include this patch in the newer versions?

Post Reply

Return to “Testing”