Discussion:
directory tree view
Mike Kerner via use-livecode
2018-11-15 19:34:32 UTC
Permalink
I fought through the various tree view issues and got it to build a
directory list that's kind-of functional.
Please break and report issues on the repo.
https://github.com/macMikey/directoryTreeView
--
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
and did a little diving.
And God said, "This is good."
William Prothero via use-livecode
2018-11-15 23:09:44 UTC
Permalink
Hi, I’m editing a json string (for development uses) and wonder if there is an easy way to validate whether the string is a valid JSON string.

Or, perhaps there is an easier way to display and edit a pretty simple array.

Suggestions would be helpful. Currently, I convert the array to JSON, put it in a text field, then edit the text field. It would be convenient if it could trap editing errors I might make. The simple way seems to just throw an error and stop execution of the script.

Best,
Bill

William A. Prothero
http://earthlearningsolutions.org
Terry Judd via use-livecode
2018-11-16 01:19:20 UTC
Permalink
Hi Bill - I convert the JSON (jsonImport) to an array then use a treeview widget to display it. I then use an actionDoubleClick handler in the widget script to grab the appropriate array element and display it in an ask dialog. The value goes back into the array and I export the array back to JSON (jsonExport). Works well as long as the JSON elements don't contain large amounts of text - in which case you might need a custom dialog for displaying and editing the contents.

Terry...

On 16/11/2018 10:10 am, "use-livecode on behalf of William Prothero via use-livecode" <use-livecode-***@lists.runrev.com on behalf of use-***@lists.runrev.com> wrote:

Hi, I’m editing a json string (for development uses) and wonder if there is an easy way to validate whether the string is a valid JSON string.

Or, perhaps there is an easier way to display and edit a pretty simple array.

Suggestions would be helpful. Currently, I convert the array to JSON, put it in a text field, then edit the text field. It would be convenient if it could trap editing errors I might make. The simple way seems to just throw an error and stop execution of the script.

Best,
Bill

William A. Prothero
http://earthlearningsolutions.org

_______________________________________________
use-livecode mailing list
use-***@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
William Prothero via use-livecode
2018-11-16 01:55:20 UTC
Permalink
Thanks, Terry:
I’ll give it a whack.
Bill
Post by Terry Judd via use-livecode
Hi Bill - I convert the JSON (jsonImport) to an array then use a treeview widget to display it. I then use an actionDoubleClick handler in the widget script to grab the appropriate array element and display it in an ask dialog. The value goes back into the array and I export the array back to JSON (jsonExport). Works well as long as the JSON elements don't contain large amounts of text - in which case you might need a custom dialog for displaying and editing the contents.
Terry...
Hi, I’m editing a json string (for development uses) and wonder if there is an easy way to validate whether the string is a valid JSON string.
Or, perhaps there is an easier way to display and edit a pretty simple array.
Suggestions would be helpful. Currently, I convert the array to JSON, put it in a text field, then edit the text field. It would be convenient if it could trap editing errors I might make. The simple way seems to just throw an error and stop execution of the script.
Best,
Bill
William A. Prothero
http://earthlearningsolutions.org
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
JJS via use-livecode
2018-11-16 16:22:37 UTC
Permalink
https://jsonlint.com/


not there are a few forms to write JSON
Post by William Prothero via use-livecode
I’ll give it a whack.
Bill
Post by Terry Judd via use-livecode
Hi Bill - I convert the JSON (jsonImport) to an array then use a treeview widget to display it. I then use an actionDoubleClick handler in the widget script to grab the appropriate array element and display it in an ask dialog. The value goes back into the array and I export the array back to JSON (jsonExport). Works well as long as the JSON elements don't contain large amounts of text - in which case you might need a custom dialog for displaying and editing the contents.
Terry...
Hi, I’m editing a json string (for development uses) and wonder if there is an easy way to validate whether the string is a valid JSON string.
Or, perhaps there is an easier way to display and edit a pretty simple array.
Suggestions would be helpful. Currently, I convert the array to JSON, put it in a text field, then edit the text field. It would be convenient if it could trap editing errors I might make. The simple way seems to just throw an error and stop execution of the script.
Best,
Bill
William A. Prothero
http://earthlearningsolutions.org
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
Mark Talluto via use-livecode
2018-11-16 21:57:45 UTC
Permalink
Hi Bill,

My favorite JSON validator is: https://jsonformatter.curiousconcept.com <https://jsonformatter.curiousconcept.com/>


Best regards,

Mark Talluto
livecloud.io <http://livecloud.io/>
nursenotes.net <http://nursenotes.net/>
canelasoftware.com <http://www.canelasoftware.com/>
Post by William Prothero via use-livecode
Hi, I’m editing a json string (for development uses) and wonder if there is an easy way to validate whether the string is a valid JSON string.
Or, perhaps there is an easier way to display and edit a pretty simple array.
Suggestions would be helpful. Currently, I convert the array to JSON, put it in a text field, then edit the text field. It would be convenient if it could trap editing errors I might make. The simple way seems to just throw an error and stop execution of the script.
Best,
Bill
William A. Prothero
http://earthlearningsolutions.org
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
William Prothero via use-livecode
2018-11-17 23:39:47 UTC
Permalink
Folks:
I guess I could have been more clear. I am editing the JSON directly in a text field. If I make a mistake, then use JSONToArray, the program just fails silently. What I would like to do is get a dialog that the JSON wasn’t formed correctly. Of course, since I’m using it for my personal development of my app, I can know that it failed if I don’t get the answer dialog I put in after it. but, it seems a kludge. Shouldn’t there be some kind of an error result if the JSON is ill-formed?
Best,
Bill
Post by Mark Talluto via use-livecode
Hi Bill,
My favorite JSON validator is: https://jsonformatter.curiousconcept.com <https://jsonformatter.curiousconcept.com/>
Best regards,
Mark Talluto
livecloud.io <http://livecloud.io/>
nursenotes.net <http://nursenotes.net/>
canelasoftware.com <http://www.canelasoftware.com/>
Post by William Prothero via use-livecode
Hi, I’m editing a json string (for development uses) and wonder if there is an easy way to validate whether the string is a valid JSON string.
Or, perhaps there is an easier way to display and edit a pretty simple array.
Suggestions would be helpful. Currently, I convert the array to JSON, put it in a text field, then edit the text field. It would be convenient if it could trap editing errors I might make. The simple way seems to just throw an error and stop execution of the script.
Best,
Bill
William A. Prothero
http://earthlearningsolutions.org
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
bob--- via use-livecode
2018-11-18 14:18:04 UTC
Permalink
Livecode provides a text editor to, well, edit text. It does not understand the syntax/grammar of languages (Livecode, HTML, Javascript, JSON, YML, etc). What you need is an editor that “knows" JSON.

Your best bet is to copy the text into Sublime, Visual Studio Code or Atom which do understand JSON’s syntax/grammar. There may be some configuration to the tool you will need to do but you will get indications from these editors when you have malformed JSON.

- Bob Hall
Post by William Prothero via use-livecode
What I would like to do is get a dialog that the JSON wasn’t formed correctly. Of course, since I’m using it for my personal development of my app, I can know that it failed if I don’t get the answer dialog I put in after it. but, it seems a kludge. Shouldn’t there be some kind of an error result if the JSON is ill-formed?
prothero--- via use-livecode
2018-11-18 18:30:30 UTC
Permalink
Bob,
Tnx for the info. However, isn’t it reasonable that the LC conversion should respond with some indication that it can’t do the JSON to array conversion, rather than throw a script error?

Bill

William Prothero
http://es.earthednet.org
Post by bob--- via use-livecode
Livecode provides a text editor to, well, edit text. It does not understand the syntax/grammar of languages (Livecode, HTML, Javascript, JSON, YML, etc). What you need is an editor that “knows" JSON.
Your best bet is to copy the text into Sublime, Visual Studio Code or Atom which do understand JSON’s syntax/grammar. There may be some configuration to the tool you will need to do but you will get indications from these editors when you have malformed JSON.
- Bob Hall
Post by William Prothero via use-livecode
What I would like to do is get a dialog that the JSON wasn’t formed correctly. Of course, since I’m using it for my personal development of my app, I can know that it failed if I don’t get the answer dialog I put in after it. but, it seems a kludge. Shouldn’t there be some kind of an error result if the JSON is ill-formed?
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
J. Landman Gay via use-livecode
2018-11-18 19:40:14 UTC
Permalink
When I needed to check JSON validation, I put the JSONToArray function
inside a "try" structure. The catch clause will trigger and tell you
there's an error. It isn't too much different than what the editor does but
It can give you a clue.

--
Jacqueline Landman Gay | ***@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On November 18, 2018 12:32:27 PM prothero--- via use-livecode
Post by prothero--- via use-livecode
Bob,
Tnx for the info. However, isn’t it reasonable that the LC conversion
should respond with some indication that it can’t do the JSON to array
conversion, rather than throw a script error?
Bill
William Prothero
http://es.earthednet.org
On Nov 18, 2018, at 6:18 AM, bob--- via use-livecode
Livecode provides a text editor to, well, edit text. It does not understand
the syntax/grammar of languages (Livecode, HTML, Javascript, JSON, YML,
etc). What you need is an editor that “knows" JSON.
Your best bet is to copy the text into Sublime, Visual Studio Code or Atom
which do understand JSON’s syntax/grammar. There may be some configuration
to the tool you will need to do but you will get indications from these
editors when you have malformed JSON.
- Bob Hall
On Nov 17, 2018, at 6:39 PM, William Prothero via use-livecode
What I would like to do is get a dialog that the JSON wasn’t formed
correctly. Of course, since I’m using it for my personal development of my
app, I can know that it failed if I don’t get the answer dialog I put in
after it. but, it seems a kludge. Shouldn’t there be some kind of an error
result if the JSON is ill-formed?
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
prothero--- via use-livecode
2018-11-18 20:14:07 UTC
Permalink
Jacqueline,
Thanks. Makes sense. I’ll do that.
Bill

William Prothero
http://es.earthednet.org
When I needed to check JSON validation, I put the JSONToArray function inside a "try" structure. The catch clause will trigger and tell you there's an error. It isn't too much different than what the editor does but It can give you a clue.
--
HyperActive Software | http://www.hyperactivesw.com
Post by prothero--- via use-livecode
Bob,
Tnx for the info. However, isn’t it reasonable that the LC conversion should respond with some indication that it can’t do the JSON to array conversion, rather than throw a script error?
Bill
William Prothero
http://es.earthednet.org
Post by bob--- via use-livecode
Livecode provides a text editor to, well, edit text. It does not understand the syntax/grammar of languages (Livecode, HTML, Javascript, JSON, YML, etc). What you need is an editor that “knows" JSON.
Your best bet is to copy the text into Sublime, Visual Studio Code or Atom which do understand JSON’s syntax/grammar. There may be some configuration to the tool you will need to do but you will get indications from these editors when you have malformed JSON.
- Bob Hall
Post by William Prothero via use-livecode
What I would like to do is get a dialog that the JSON wasn’t formed correctly. Of course, since I’m using it for my personal development of my app, I can know that it failed if I don’t get the answer dialog I put in after it. but, it seems a kludge. Shouldn’t there be some kind of an error result if the JSON is ill-formed?
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
Mark Talluto via use-livecode
2018-11-19 17:05:22 UTC
Permalink
I always appreciate error reporting. I ran into the same problem. Sometimes you can see the error easily enough. But, in complex arrays, it is harder to see the error when looking at JSON. For this reason, I find dropping it into a validator to be useful. They can point you in the right direction to fix the JSON.

But, if you are trying to pick up on this programmatically in an app, the best you can do is check for success or failure by looking for data in the array. If it is not there, an error took place.


Best regards,

Mark Talluto
livecloud.io <http://livecloud.io/>
nursenotes.net <http://nursenotes.net/>
canelasoftware.com <http://www.canelasoftware.com/>
Post by William Prothero via use-livecode
I guess I could have been more clear. I am editing the JSON directly in a text field. If I make a mistake, then use JSONToArray, the program just fails silently. What I would like to do is get a dialog that the JSON wasn’t formed correctly. Of course, since I’m using it for my personal development of my app, I can know that it failed if I don’t get the answer dialog I put in after it. but, it seems a kludge. Shouldn’t there be some kind of an error result if the JSON is ill-formed?
Best,
Bill
Post by Mark Talluto via use-livecode
Hi Bill,
My favorite JSON validator is: https://jsonformatter.curiousconcept.com <https://jsonformatter.curiousconcept.com/>
Best regards,
Mark Talluto
livecloud.io <http://livecloud.io/>
nursenotes.net <http://nursenotes.net/>
canelasoftware.com <http://www.canelasoftware.com/>
Post by William Prothero via use-livecode
Hi, I’m editing a json string (for development uses) and wonder if there is an easy way to validate whether the string is a valid JSON string.
Or, perhaps there is an easier way to display and edit a pretty simple array.
Suggestions would be helpful. Currently, I convert the array to JSON, put it in a text field, then edit the text field. It would be convenient if it could trap editing errors I might make. The simple way seems to just throw an error and stop execution of the script.
Best,
Bill
William A. Prothero
http://earthlearningsolutions.org
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
Bob Sneidar via use-livecode
2018-11-15 23:59:45 UTC
Permalink
Do I have to create/compile the widget before being able to use the stack? Never done widgets before...

Bob S
Post by Mike Kerner via use-livecode
I fought through the various tree view issues and got it to build a
directory list that's kind-of functional.
Please break and report issues on the repo.
https://github.com/macMikey/directoryTreeView
Brian Milby via use-livecode
2018-11-16 02:52:37 UTC
Permalink
This just leverages the included widget.  The latest RC no longer needs the hack to clear the hilited item (empty no longer throws an error).

Thanks,
Brian
Post by Bob Sneidar via use-livecode
Do I have to create/compile the widget before being able to use the stack? Never done widgets before...
Bob S
Post by Mike Kerner via use-livecode
I fought through the various tree view issues and got it to build a
directory list that's kind-of functional.
Please break and report issues on the repo.
https://github.com/macMikey/directoryTreeView
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
Mike Kerner via use-livecode
2018-11-16 15:04:38 UTC
Permalink
Brian,
The widgets are backward-compatible, right? I can include the new version
of the widget and it will work in any version of 8 or 9?
Brian Milby via use-livecode
2018-11-16 16:23:15 UTC
Permalink
It would not work with 8 unless compiled with 8.  It should work with any release of 9.

Thanks,
Brian
Post by Mike Kerner via use-livecode
Brian,
The widgets are backward-compatible, right? I can include the new version
of the widget and it will work in any version of 8 or 9?
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
Mike Kerner via use-livecode
2018-11-16 21:11:29 UTC
Permalink
Brian,
So walk me through this: Is the LCB code for the widget a component of the
widget itself or of LC - i.e. is the widget in a stack just a reference to
the widget in LC (which would mean that the code changes with each version
of LC, until you do a build), or is it dependent on the version of LC that
was used to build the stack that contains the widget, i.e. the way to
update the widget in my project is to open the stack with the RC, delete
the widget, reinstall it with the new version, and then the changes to the
widget code base apply to all 9.x versions (if that's the case, we need to
have a discussion with LC about being able to see which version of a widget
is installed in a stack...)

On Fri, Nov 16, 2018 at 11:23 AM Brian Milby via use-livecode <
It would not work with 8 unless compiled with 8. It should work with any
release of 9.
Thanks,
Brian
On Nov 16, 2018, 9:06 AM -0600, Mike Kerner via use-livecode <
Post by Mike Kerner via use-livecode
Brian,
The widgets are backward-compatible, right? I can include the new version
of the widget and it will work in any version of 8 or 9?
_______________________________________________
use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
--
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
and did a little diving.
And God said, "This is good."
Mike Kerner via use-livecode
2018-11-16 21:13:30 UTC
Permalink
Hmm. I just seem to have answered my own question. It seems that it is
the latter. I think we need to have a discussion with LC about widget
versions.
Post by Mike Kerner via use-livecode
Brian,
So walk me through this: Is the LCB code for the widget a component of
the widget itself or of LC - i.e. is the widget in a stack just a reference
to the widget in LC (which would mean that the code changes with each
version of LC, until you do a build), or is it dependent on the version of
LC that was used to build the stack that contains the widget, i.e. the way
to update the widget in my project is to open the stack with the RC, delete
the widget, reinstall it with the new version, and then the changes to the
widget code base apply to all 9.x versions (if that's the case, we need to
have a discussion with LC about being able to see which version of a widget
is installed in a stack...)
On Fri, Nov 16, 2018 at 11:23 AM Brian Milby via use-livecode <
It would not work with 8 unless compiled with 8. It should work with any
release of 9.
Thanks,
Brian
On Nov 16, 2018, 9:06 AM -0600, Mike Kerner via use-livecode <
Post by Mike Kerner via use-livecode
Brian,
The widgets are backward-compatible, right? I can include the new
version
Post by Mike Kerner via use-livecode
of the widget and it will work in any version of 8 or 9?
_______________________________________________
use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
--
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
and did a little diving.
And God said, "This is good."
--
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
and did a little diving.
And God said, "This is good."
Brian Milby via use-livecode
2018-11-16 21:56:40 UTC
Permalink
A widget in a stack is just a reference until an application is built where the compiled LCB and resources are packaged with the app*.  Opening a stack with a different version of the IDE will use the included widgets from that version of the IDE.  User installed widgets will remain constant as long as a compiled version is present for that particular version of the IDE (you can create a package that contains versions compiled for both 8 and 9).

Widget versions are distinct from the overall IDE version.  I have looked briefly and am not entirely sure why the versions don’t appear in the dictionary.  The metadata is available.

* It is possible to embed a widget inside a stack and have it install but I have not looked into how that is done.

Thanks,
Brian
Hmm. I just seem to have answered my own question. It seems that it is
the latter. I think we need to have a discussion with LC about widget
versions.
Post by Mike Kerner via use-livecode
Brian,
So walk me through this: Is the LCB code for the widget a component of
the widget itself or of LC - i.e. is the widget in a stack just a reference
to the widget in LC (which would mean that the code changes with each
version of LC, until you do a build), or is it dependent on the version of
LC that was used to build the stack that contains the widget, i.e. the way
to update the widget in my project is to open the stack with the RC, delete
the widget, reinstall it with the new version, and then the changes to the
widget code base apply to all 9.x versions (if that's the case, we need to
have a discussion with LC about being able to see which version of a widget
is installed in a stack...)
On Fri, Nov 16, 2018 at 11:23 AM Brian Milby via use-livecode <
It would not work with 8 unless compiled with 8. It should work with any
release of 9.
Thanks,
Brian
On Nov 16, 2018, 9:06 AM -0600, Mike Kerner via use-livecode <
Post by Mike Kerner via use-livecode
Brian,
The widgets are backward-compatible, right? I can include the new
version
Post by Mike Kerner via use-livecode
of the widget and it will work in any version of 8 or 9?
_______________________________________________
use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your
http://lists.runrev.com/mailman/listinfo/use-livecode
--
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
and did a little diving.
And God said, "This is good."
--
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
and did a little diving.
And God said, "This is good."
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
Mike Kerner via use-livecode
2018-11-17 00:19:37 UTC
Permalink
Yep, some more testing shows that it was a bug in my test code that was
leading me to believe that the widget object code was embedded in the stack.
Loading...