RPTools.net

Discussion and Support

Skip to content

It is currently Fri Nov 17, 2017 9:41 pm 






Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

Previous topic | Next topic 

  Print view

Author Message
 Offline
Dragon
 
Joined: Wed Oct 19, 2011 1:07 am
Posts: 958
 Post subject: [patch - New Feature] Input Function enhancements
PostPosted: Fri Oct 05, 2012 10:59 pm 
As promised, here's the modified input function. I was busy this week else I would have released it sooner. Apart from the promised text area, I also thought to open the actual window model itself for MTScript users to manipulate. Please test it out so I can fix whatever's broken; though I think everything should be fine. In order for the new JSON functionality to work, however, I had to expose some private functions found in the JSON class. IDK how Azhrei and the others feel about this, but I took my cue from other classes that seemed to have had their private methods exposed as well. Anyway, to the the meatier stuff:

New functionality:

1. TEXTAREA input type - I didn't need to break the grid model as I opted for a simple containment scheme. It follows the basic input model of variable, value, prompt, and options. Value will hold the eventual contents of the text area. Options are ROWS and COLS, which sets the depth and breadth of the text area, SPAN works like it always has and is set to false by default.
Example: [input("txtAreaVar | Content | Prompt | rows=5 cols=50")]

Edit: For those who don't know, you can do ctrl+enter to emulate hitting enter on another input type and ctrl+tab and shift+tab for traversal. These were the defaults MT has been using along with what most are used to.

2. JSON - works like PROPS but is more flexible. Guided by the suggestions of aliasMask, it allows the passing of json Arrays or Objects for manipulation in an input window. The value parameter holds this passed information, of course. Options are SPAN (default=false), which only works/is meaningful for JSON Objects since I suppressed prompts for JSON array items, seeing that these are merely junk and are discarded after the transaction, and using the JSON input type is mainly focused on manipulating/creating values. WIDTH sets the text field length for all items.
Example: [input(strformat("jsonVar | %s | Prompt type | width=50", json.set("{}", "a", 1, "b", 2, "c", 3)))]

3. WINDOW - Allows MTScript users to manipulate the input window a bit. Hence, it is important to note that it is not an input type; even if it follows the input function form. The variable parameter is useless and inaccessible to MT scripters. The value parameter holds the eventual title of the window. The prompt will be the window's tool tip text. Owing to its nature of not being an input type, the code for setting prompts is skipped for aesthetic purposes, among other things. Options are as follows:

a. TYPE accepts values of -1 (plain message), 0 (error message), 1 (information message), 2 (warning message), and 3 (question message). Default is set to -1, what everyone has been using so far. Basically, this is used for aesthetics, to have that L&F icon on display depending on the type chosen.
b. CHOICES accepts values of 0 (Yes, No), 1 (Yes, No, Cancel), and 2 (Ok, Cancel). Default is set to 2, what most MT users are familiar with. More on this later.
c. OPTIONS accepts a string similar to the JSON array form, i.e. [a, b, c], to a maximum of 3 items (due to the nature of JOptionPane and how MT incorporated an HTMLPane). Each item in the "array" becomes the label for a particular button. OPTIONS overrides the CHOICES model; meaning even if a 2-button choice option is set, a 3 item OPTIONS parameter will result in a 3 button window. The only exception to this is when a blank set is passed, i.e. "[]"; here the input window reverts to whatever is set for CHOICES. Default for this is null, though this is non-impacting. Using this option parameter results in the input window becoming "customized" in nature. More on this below

Return values, default window types, "customized" mode
To avoid affecting existing MT scripts out there. The default return values are as follows:
a. Ok - returns 1 as it always has
b. Cancel - returns 0, as it always has
c. Yes - returns 1
d. No - returns 2
e Closing window through the 'X' - returns 0 for all window types including customized
f. Customized buttons - returns different values. 1 for the leftmost button, 2 for the middle, and 3 for the 3rd. This was intended to provide MT scripters with added capability a 3-button input window provides.

Example: [input("junkVar|winTitle|winToolTip|window|type=-1 choices=1 options=[Bacon, Eggs, Toast]")]

4. Radio - added the option SOF (short for SelectOnFocus). This accepts true or false values, set to false as default. What this does is, as the name states, select the radio button after it receives focus while tabbing through the input window; handy for input windows containing single radio button groups.

5 Props - added the WIDTH option to set the length for all prop fields.

Changes and Fixes:
1. In order for the new functionality to work, several functions in the JSON class were made public. Modified class included in the patch.
2. Fixed the bug where html content made tab traversal require 2 hits before moving on to the next component.
3. Set default value for text fields to a blank instead of 0
4. Other changes to make this work are found with comments in the code.

Do test this out and see if it's to your liking. I've made other stuff not related to this and will put it up shortly once I'm done with my newest drop-in. Please feel free to leave any questions or comments.

Thank you.

_________________
My stuff for the community:
Donate to the Mote Project
The Mote Project's G+ community
Mote on Facebook
Fully Customizable Calendar Drop-in


Last edited by Lee on Tue May 28, 2013 4:09 pm, edited 8 times in total.

Top
 Profile  
 
User avatar  Offline
Demigod
 
Joined: Mon Jun 29, 2009 9:37 am
Posts: 3108
Location: Germany
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Sat Oct 06, 2012 3:42 am 
Sounds cool, so where's the patch?

_________________
HELP: GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC.

most complete list of my maptool stuff


Top
 Profile  
 
 Offline
Dragon
 
Joined: Wed Oct 19, 2011 1:07 am
Posts: 958
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Sat Oct 06, 2012 5:36 pm 
Patch uploaded anew. Cleaned up some comments and the like. Hopefully, this didn't affect the actual code in any way.

_________________
My stuff for the community:
Donate to the Mote Project
The Mote Project's G+ community
Mote on Facebook
Fully Customizable Calendar Drop-in


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7947
Location: Bay Area
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Sat Oct 06, 2012 6:51 pm 
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.

I'm going to use the heck out of TEXTAREA. WINDOW seems interesting and I'll probably use the customize version. SOF is interesting, but on mouseover IMO could cause selection problems.

_________________
Downloads:


Top
 Profile  
 
 Offline
Dragon
 
Joined: Wed Oct 19, 2011 1:07 am
Posts: 958
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Sat Oct 06, 2012 9:10 pm 
I've tried and it accepts [input('jsonVar|["a", "b", "c"]|prompt|json')] (hope I didn't miss a closer there) as well. I thought to float a poll on SOF on whether people would like it set to true or false by default, but I opted to let people try it out with true as default and let them come back to me if they didn't like it. As for the mouseover, I'm not sure if I understand, do you mean behavior with SPAN and tooltips? I'll look into it if you have more detail.

_________________
My stuff for the community:
Donate to the Mote Project
The Mote Project's G+ community
Mote on Facebook
Fully Customizable Calendar Drop-in


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7947
Location: Bay Area
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Sat Oct 06, 2012 11:14 pm 
Maybe I missed something about SOF. Is select on focus when you mouse over the radio button or label it will select that option? Or do you mean when using the tab key to change the focus it will select it? I'm sure you now meant the second one, but I didn't get that the first time.

As for json option, will I have to format it like this:
Code:
[H: input(strformat("jsonVar|%s||JSON",json.set("{}","one",1))]

or like this:
Code:
[H: input(strformat('jsonVar|%s||JSON',json.set("{}","one",1))]

because the substitution puts double quotes with in double quotes for the input string. What happens if my json value has a single quote in there?
Code:
[H: input(strformat('jsonVar|%s||JSON',json.set("{}","singleQuote"," ' "))]

_________________
Downloads:


Top
 Profile  
 
 Offline
Dragon
 
Joined: Wed Oct 19, 2011 1:07 am
Posts: 958
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Sat Oct 06, 2012 11:30 pm 
Yes, I meant the latter, tabbing through a radio group will select radio buttons when they receive focus. As for the examples you gave, all went through just fine. There was a missing right parenthesis on each of the samples, however, but other than that, I encountered no problems.

Edit: I forgot to mention, with regard to the posts above, that I'm glad I was able to provide something useful. It was always the intention to provide the tools and get out of the way of all the creative people in the MT community :)

_________________
My stuff for the community:
Donate to the Mote Project
The Mote Project's G+ community
Mote on Facebook
Fully Customizable Calendar Drop-in


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9419
Location: Netherlands
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Sun Oct 07, 2012 3:20 am 
Very usefull and many thanks. Can you provide some actual useable sample scripts especially on the use of WINDOWS as I d quite get the implementatiom method. But examples of the other methods would be nice as well.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
 Offline
Dragon
 
Joined: Wed Oct 19, 2011 1:07 am
Posts: 958
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Sun Oct 07, 2012 3:58 am 
I'll see what I can do. I did place some examples on the 1st post. I guess they weren't obvious so I highlighted them in bold. All of them, however, still follow the basic input form of [input(var|value|prompt|options)]. As for Windows, perhaps this Java resource will be more informative :).

JSON can manipulate/create both JSON Arrays and Objects, and they display in a PROPS-like display. With A.M.s suggestions, JSON object keys can hold html formatting, though I haven't taken the time to try out how full the HTML capability is. Who knows? Maybe a full frame can find its way into the input window :lol: I tried putting some buttons in and they turned out fine; though linking them to macrolinks, I didn't have time to do.

_________________
My stuff for the community:
Donate to the Mote Project
The Mote Project's G+ community
Mote on Facebook
Fully Customizable Calendar Drop-in


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9419
Location: Netherlands
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Sun Oct 07, 2012 4:24 am 
Lee wrote:
I'll see what I can do. I did place some examples on the 1st post. I guess they weren't obvious so I highlighted them in bold. All of them, however, still follow the basic input form of [input(var|value|prompt|options)]. As for Windows, perhaps this Java resource will be more informative :).

JSON can manipulate/create both JSON Arrays and Objects, and they display in a PROPS-like display. With A.M.s suggestions, JSON object keys can hold html formatting, though I haven't taken the time to try out how full the HTML capability is. Who knows? Maybe a full frame can find its way into the input window :lol: I tried putting some buttons in and they turned out fine; though linking them to macrolinks, I didn't have time to do.


indeed... I noticed the first two, but missed the one concerning windows. I guess thats good enough, its just to get a feel of the correct syntax. Thanks!

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
 Offline
Dragon
 
Joined: Wed Oct 19, 2011 1:07 am
Posts: 958
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Sun Oct 07, 2012 3:52 pm 
No problem, you're welcome :)

I uploaded a new version of the patch. I missed something in the last one that I intended to go back to, but didn't; specifically the html label fix and its interaction with radio's SELECTED option. Got that all squared out and should be all good now.

_________________
My stuff for the community:
Donate to the Mote Project
The Mote Project's G+ community
Mote on Facebook
Fully Customizable Calendar Drop-in


Top
 Profile  
 
 Offline
Cave Troll
 
Joined: Mon Oct 31, 2011 6:32 pm
Posts: 73
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Sat Oct 27, 2012 10:56 pm 
Sorry by the question, but... how can I install the patch?


Top
 Profile  
 
 Offline
Dragon
 
Joined: Wed Oct 19, 2011 1:07 am
Posts: 958
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Sun Oct 28, 2012 11:15 pm 
You would need to set up the developer environment for MapTool to apply patches to the source code. A tutorial is found here. Depending on your knowledge level, you might want to wait till it gets included on a build to try it out. In case it doesn't make it into the official build, let's wait till the final build is released and I can generate a special version with my patches in it.

_________________
My stuff for the community:
Donate to the Mote Project
The Mote Project's G+ community
Mote on Facebook
Fully Customizable Calendar Drop-in


Top
 Profile  
 
 Offline
Cave Troll
 
Joined: Mon Oct 31, 2011 6:32 pm
Posts: 73
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Wed Oct 31, 2012 11:14 am 
Thanks Lee, I will make a try to do it for myself. I'm not experimented, but seems a good tutorial. I'm very interested in the implementations of your patch.


Top
 Profile  
 
 Offline
Dragon
 
Joined: Wed Oct 19, 2011 1:07 am
Posts: 958
 Post subject: Re: [patch] Input Function improvements(?)
PostPosted: Wed Oct 31, 2012 11:10 pm 
Good luck with that. Once you do set it up, applying a patch is easy, just right click on the InputFunction.java (found under src -> net.rptools.maptool.client.functions), select Team and Apply the Patch you downloaded from here.

_________________
My stuff for the community:
Donate to the Mote Project
The Mote Project's G+ community
Mote on Facebook
Fully Customizable Calendar Drop-in


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman