RE: PDF Widget

2021-04-24 Thread Ralph DiMola via use-livecode
I have used pdfjs on Android. When the URL of the page ends in PDF then you
download it(if not on local device already). You can view the PDF via pdfjs
in the browser widget. It does not work on desktop locally because browsers
can't access local files. I tested in the IDE using a web server.
 
Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net

-Original Message-
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf
Of Klaus major-k via use-livecode
Sent: Saturday, April 24, 2021 4:38 PM
To: How to use LiveCode
Cc: Klaus major-k
Subject: Re: PDF Widget



> Am 24.04.2021 um 21:31 schrieb JeeJeeStudio via use-livecode
:
> 
> Aber Klaus, for just displaying a PDF, you could use the browser 
> widget

Maar JeeJee, I wrote:
... directly as a control) in a stack and NOT inside of a browser widget,
which is not working "out of the box" on Android.

Yes, call me lazy... 8-)

> Op 23-4-2021 om 13:48 schreef Klaus major-k via use-livecode:
>> Hi Tore,
>> 
>>> Am 23.04.2021 um 13:28 schrieb Tore Nilsen via use-livecode
:
>>> 
>>> Not everyone needs it.
>> that was just a little joke. :-)
>> 
>>> I had the business edition for a year and for what it is worth, the 
>>> pdf-widget did not offer anything I needed. I had hoped I could use it
for mark up and annotations but did not find a way to do that.
>> It would be enough, at least for me, if we could display a PDF 
>> (directly as a control) in a stack and NOT inside of a browser widget,
which is not working "out of the box" on Android.
>> 
>>> I do however think that it would be a good thing if it was possible to
buy widgets on a per widget basis.
>>> That would enhance the LiveCode experience in my mind.
>> Definitively!
>> 
>>> Best regards
>>> Tore Nilsen

Best

Klaus

--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: PDF Widget

2021-04-24 Thread Klaus major-k via use-livecode



> Am 24.04.2021 um 21:31 schrieb JeeJeeStudio via use-livecode 
> :
> 
> Aber Klaus, for just displaying a PDF, you could use the browser widget

Maar JeeJee, I wrote:
... directly as a control) in a stack and
NOT inside of a browser widget, which is not working "out of the box" on 
Android.

Yes, call me lazy... 8-)

> Op 23-4-2021 om 13:48 schreef Klaus major-k via use-livecode:
>> Hi Tore,
>> 
>>> Am 23.04.2021 um 13:28 schrieb Tore Nilsen via use-livecode 
>>> :
>>> 
>>> Not everyone needs it.
>> that was just a little joke. :-)
>> 
>>> I had the business edition for a year and for what it is worth, the 
>>> pdf-widget did not offer anything
>>> I needed. I had hoped I could use it for mark up and annotations but did 
>>> not find a way to do that.
>> It would be enough, at least for me, if we could display a PDF (directly as 
>> a control) in a stack and
>> NOT inside of a browser widget, which is not working "out of the box" on 
>> Android.
>> 
>>> I do however think that it would be a good thing if it was possible to buy 
>>> widgets on a per widget basis.
>>> That would enhance the LiveCode experience in my mind.
>> Definitively!
>> 
>>> Best regards
>>> Tore Nilsen

Best

Klaus

--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: PDF Widget

2021-04-24 Thread JeeJeeStudio via use-livecode

Aber Klaus, for just displaying a PDF, you could use the browser widget


Op 23-4-2021 om 13:48 schreef Klaus major-k via use-livecode:

Hi Tore,


Am 23.04.2021 um 13:28 schrieb Tore Nilsen via use-livecode 
:

Not everyone needs it.

that was just a little joke. :-)


I had the business edition for a year and for what it is worth, the pdf-widget 
did not offer anything
I needed. I had hoped I could use it for mark up and annotations but did not 
find a way to do that.

It would be enough, at least for me, if we could display a PDF (directly as a 
control) in a stack and
NOT inside of a browser widget, which is not working "out of the box" on 
Android.


I do however think that it would be a good thing if it was possible to buy 
widgets on a per widget basis.
That would enhance the LiveCode experience in my mind.

Definitively!


Best regards
Tore Nilsen


23. apr. 2021 kl. 13:24 skrev Klaus major-k via use-livecode 
:

Either that or everyone that wants it has business edition?

EVERYONE needs and wants it, but not everyone has the business edition! :-D

Sent from my iPhone

Hi all,

as far as I know the "PDF widget" is only available in the
BUSINESS Version of Livecode.

I already asked this in the past, but I would like to be
able to buy this widget separately.

Any idea if LC is planning to sell this separately at some time
in the future?

Best

Klaus

noone else interested in buying that widget separately?

Best

Klaus

--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: IOS required SDK

2021-04-24 Thread J. Landman Gay via use-livecode
Thanks to both you and Scott. I'm still unsure how to proceed. There is 
really only one 32-bit app I need to maintain and I have an ancient MacBook 
Air that is stuck at Mac OS High Sierra. I could move the app there and 
update my main working Mac to Big Sur. My main concern is that the Air will 
fail and I'll lose all the accumulated data.


Maybe I'll keep good backups and pray. If it does bite the dust I'll move 
to a VM with Mojave on it. In my case I don't use the app often enough to 
make that an inconvenience.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On April 23, 2021 6:33:43 PM Paul Dupuis via use-livecode 
 wrote:



No need to partition drives with VMs. You *do* need a good chunk of free
disk space, for example for Catalina, you probably want a minimum of a
50GB "drive" (a VM file on disk) and for Big Sur, I went to 100GB, but I
have a 1TB hard disk.

We also have a MacMini here with a bunch of external USB disk drives and
a ton of partitions each with a different macOS from 10.9 up to 10.15,
but rebooting to a different macOS version for testing is a pain in the
butt compared to VMs.

All you really need is (1) VirtualBox for macOS and (2) installation
file(s) for the macOS's you want to install. For current and most recent
OS, these can usually be downloaded from the Apple Developer site. For
anything older, you have to do some hunting as Apple does not have an
archive of older version of macOS for developers (that I can find!) It
is easiest if the installer for macOS is an .iso disk image. Then you
run VirtualBox, create a new VM, set it for macOS, create a disk of the
suitable size. Mount the .iso image file as a "virtual" disc drive and
start it up and follow the macOS install instructions. (there is devils
in the details, but that really is the jist)


On 4/23/2021 5:43 PM, J. Landman Gay via use-livecode wrote:

Thanks Paul, I was wondering about a VM. I've scanned Oracle's docs
for all of 10 minutes but it looks a bit complicated. Did you need to
partition your hard drive? It also says to put the OS intaller on a
DVD but of course we don't have DVD drives any more. Does the mounted
OS install image work?

On 4/23/21 4:13 PM, Paul Dupuis via use-livecode wrote:

On 4/23/2021 5:02 PM, J. Landman Gay via use-livecode wrote:

Apple will require SDK 14 for new or updated iOS apps. Due to
incompatible 32-bit software, I'm still on Mojave. Does this mean I
need to update to Big Sur or Catalina before I can build for iOS?

I don't suppose there's any way to do it on Mojave? I've been
dreading this...



I run Mojave on a Macbook Pro and use VirtualBox to have a Catalina
and Big Sur VMs as I too have 32 bit software I want to be able to
continue to run. I do macOS development under Mojave and only use the
Catalina and/or Big Sur VMs for testing or builds (if for some reason
I need to check a build under one of those OSes. Both Catalina and
Big Sur work with VirtualBox. VMs are of course slower, but he
ability to back them up, clone them, restore to a specific save point
and such I think outweigh  the speed as a developer tool.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode






___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Dynamic scripted nested array keys?

2021-04-24 Thread Keith Clarke via use-livecode
Thanks Brian this conversion to pPath to an array of keys hit the nail on the 
head.

So, for anyone else looking to show the (full non-truncated) content of a node 
in a read-only Tree widget in a tooltip, by clicking the actionInspect icon, is…
on actionInspect pPath

put the arrayData of widget "Tree" into aContent -- get the Tree's data

split pPath by comma -- convert pPath from list to an array of keys

set the tooltip of widget "Tree" to aContent[pPath] -- the current Tree node's 
content

end actionInspect


Thanks too Jaque, Paul, Bob & Henry for playing! :-) 
Best,
Keith  

> On 24 Apr 2021, at 14:31, Brian Milby via use-livecode 
>  wrote:
> 
> I guess I should reply to myself and say why this works.  At some point the
> feature was added that you could use an array as an index into an array.
> The format is a one based ordered array of keys.  So tPath[1] is the first
> level key, tPath[2] is the second level, etc.  If you wanted to get
> tTree["one"]["two"] then tPath[1]="one" and tPath[2]="two" so you could
> just get tTree[tPath].  Since comma is the default path delimiter (which
> can be changed), you can use split to turn a path list into a path array.
> 
> On Sat, Apr 24, 2021 at 9:26 AM Brian Milby  wrote:
> 
>> Easiest way is to use split...
>> 
>> Given a tree widget this will take a path from field 1 and put the value
>> at that path in field 2
>> 
>> on mouseUp pMouseButton
>>   local tTree, tLoc
>>   put the arrayData of widget 1 into tTree
>>   put field 1 into tLoc
>>   split tLoc by comma
>>   put tTree[tLoc] into field 2
>> end mouseUp
>> 
>> Thanks,
>> Brian
>> 
>> On Sat, Apr 24, 2021 at 9:06 AM Paul Dupuis via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>> 
>>> I have only partially been following this thread, but if you need to
>>> find the array 'content' in an arbitrary nested array from a comma
>>> delimited path of array keys, recursion is the way to do it:
>>> 
>>> function fetchArrayContentFromPath pArray,pPath
>>>   -- pArray is an array
>>>   -- pPath is a comma delimited 'path' of array keys to the desired
>>> content
>>>   local tKey
>>>   if pArray is not an array then
>>> return pArray -- I have reached the content, so return that content
>>>   else if pPath is empty then
>>> return pArray -- should not happen in a tree widget, but this is if
>>> the path ends in an array instead of the content of an array element
>>>   else
>>> put item 1 of pPath into tKey -- get the key of element in the
>>> currnet path
>>> delete item 1 of pPath-- remove it from the current path,
>>> so the path is the next set of key(s)
>>> return fetchArrayContentFromPath(pArray[tKey],pPath) - recursively
>>> fetch the remainig keys from the currnet array element
>>>   end if
>>> end fetchArrayContentFromPath
>>> 
>>> It will not matter is the 'path' is key1,key1 or
>>> key1,key2,key3,key4,key5,key6,key7, or whatever.
>>> 
>>> 
>>> On 4/24/2021 7:10 AM, Keith Clarke via use-livecode wrote:
 Hi folks,
 Inspired by Jaque’s (working - thank you!) response to my question
>>> “Show Tree widget row contents on hover” I’ve isolated the final piece of
>>> that puzzle that leaves me baffled.
 
 Specifically, can LiveCode accept a dynamically built key for a nested
>>> multi-dimensional array? Copy the button script recipe below to see the
>>> problem.
 
 Perhaps the LC array experts here can help explain why Jaque’s
>>> hard-wired key definition works but my attempts to replicate this syntax
>>> via scripting to support variable depth of arrays  get ignored? Is it my
>>> syntax or just the way arrays work in LC…?
 on mouseUp pButtonNumber
 
 # Create a nested array
 
 put "Content" into tArray["key1"]["key2"]["key3"]["key4"]
 
 
 # Replicate the path response from the Tree widget actionInspect
>>> function
 
 put "key1,key2,key3,key4" into pPath
 
 
 # Jaque's 'hard-wired' array key recipe works!
 
 answer tArray[item 1 of pPath][item 2 of pPath][item 3 of pPath][item 4
>>> of pPath] --returns 'Content'
 
 
 # Replicate Jaque's syntax dynamically
 
 put the number of items in pPath into tKeyCount
 
 put empty into iNum
 
 repeat for each item i in pPath
 
 add 1 to iNum
 
 # Try building the full key string
 
 put "[" & item iNum of pPath & "]"after tKey1
 
 
 # Try building keys string to 'embed' into the regular array key syntax
 
 put item iNum of pPath after tKey2
 
 if iNum < tKeyCount then put "][" after tKey2
 
 
 # Try building by each key
 
 if i is not empty then put "[" & item iNum of pPath & "]" after tArray2
 
 end repeat
 
 
 # Dynamic tKey1 results
 
 answer tKey1 -- returns '["key1"]["key2"]["key3"]["key4"]' ...seems
>>> 'correct'
 
 answer tArray & tKey1 -- returns '["key1"]["key2"]["key3"]["key4"]'
>>> ...dynamic key 

Re: Dynamic scripted nested array keys?

2021-04-24 Thread Paul Dupuis via use-livecode

On 4/24/2021 9:31 AM, Brian Milby via use-livecode wrote:

I guess I should reply to myself and say why this works.  At some point the
feature was added that you could use an array as an index into an array.
The format is a one based ordered array of keys.  So tPath[1] is the first
level key, tPath[2] is the second level, etc.  If you wanted to get
tTree["one"]["two"] then tPath[1]="one" and tPath[2]="two" so you could
just get tTree[tPath].  Since comma is the default path delimiter (which
can be changed), you can use split to turn a path list into a path array.


I never heard of this! Thanks.

p.s I can not find any reference to this 'feature' in the 9.6.2rc5 
dictionary. Do you know if this is documented anywhere?


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Dynamic scripted nested array keys?

2021-04-24 Thread Brian Milby via use-livecode
I guess I should reply to myself and say why this works.  At some point the
feature was added that you could use an array as an index into an array.
The format is a one based ordered array of keys.  So tPath[1] is the first
level key, tPath[2] is the second level, etc.  If you wanted to get
tTree["one"]["two"] then tPath[1]="one" and tPath[2]="two" so you could
just get tTree[tPath].  Since comma is the default path delimiter (which
can be changed), you can use split to turn a path list into a path array.

On Sat, Apr 24, 2021 at 9:26 AM Brian Milby  wrote:

> Easiest way is to use split...
>
> Given a tree widget this will take a path from field 1 and put the value
> at that path in field 2
>
> on mouseUp pMouseButton
>local tTree, tLoc
>put the arrayData of widget 1 into tTree
>put field 1 into tLoc
>split tLoc by comma
>put tTree[tLoc] into field 2
> end mouseUp
>
> Thanks,
> Brian
>
> On Sat, Apr 24, 2021 at 9:06 AM Paul Dupuis via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>
>> I have only partially been following this thread, but if you need to
>> find the array 'content' in an arbitrary nested array from a comma
>> delimited path of array keys, recursion is the way to do it:
>>
>> function fetchArrayContentFromPath pArray,pPath
>>-- pArray is an array
>>-- pPath is a comma delimited 'path' of array keys to the desired
>> content
>>local tKey
>>if pArray is not an array then
>>  return pArray -- I have reached the content, so return that content
>>else if pPath is empty then
>>  return pArray -- should not happen in a tree widget, but this is if
>> the path ends in an array instead of the content of an array element
>>else
>>  put item 1 of pPath into tKey -- get the key of element in the
>> currnet path
>>  delete item 1 of pPath-- remove it from the current path,
>> so the path is the next set of key(s)
>>  return fetchArrayContentFromPath(pArray[tKey],pPath) - recursively
>> fetch the remainig keys from the currnet array element
>>end if
>> end fetchArrayContentFromPath
>>
>> It will not matter is the 'path' is key1,key1 or
>> key1,key2,key3,key4,key5,key6,key7, or whatever.
>>
>>
>> On 4/24/2021 7:10 AM, Keith Clarke via use-livecode wrote:
>> > Hi folks,
>> > Inspired by Jaque’s (working - thank you!) response to my question
>> “Show Tree widget row contents on hover” I’ve isolated the final piece of
>> that puzzle that leaves me baffled.
>> >
>> > Specifically, can LiveCode accept a dynamically built key for a nested
>> multi-dimensional array? Copy the button script recipe below to see the
>> problem.
>> >
>> > Perhaps the LC array experts here can help explain why Jaque’s
>> hard-wired key definition works but my attempts to replicate this syntax
>> via scripting to support variable depth of arrays  get ignored? Is it my
>> syntax or just the way arrays work in LC…?
>> > on mouseUp pButtonNumber
>> >
>> > # Create a nested array
>> >
>> > put "Content" into tArray["key1"]["key2"]["key3"]["key4"]
>> >
>> >
>> > # Replicate the path response from the Tree widget actionInspect
>> function
>> >
>> > put "key1,key2,key3,key4" into pPath
>> >
>> >
>> > # Jaque's 'hard-wired' array key recipe works!
>> >
>> > answer tArray[item 1 of pPath][item 2 of pPath][item 3 of pPath][item 4
>> of pPath] --returns 'Content'
>> >
>> >
>> > # Replicate Jaque's syntax dynamically
>> >
>> > put the number of items in pPath into tKeyCount
>> >
>> > put empty into iNum
>> >
>> > repeat for each item i in pPath
>> >
>> > add 1 to iNum
>> >
>> > # Try building the full key string
>> >
>> > put "[" & item iNum of pPath & "]"after tKey1
>> >
>> >
>> > # Try building keys string to 'embed' into the regular array key syntax
>> >
>> > put item iNum of pPath after tKey2
>> >
>> > if iNum < tKeyCount then put "][" after tKey2
>> >
>> >
>> > # Try building by each key
>> >
>> > if i is not empty then put "[" & item iNum of pPath & "]" after tArray2
>> >
>> > end repeat
>> >
>> >
>> > # Dynamic tKey1 results
>> >
>> > answer tKey1 -- returns '["key1"]["key2"]["key3"]["key4"]' ...seems
>> 'correct'
>> >
>> > answer tArray & tKey1 -- returns '["key1"]["key2"]["key3"]["key4"]'
>> ...dynamic key definition is not appended to array(?)
>> >
>> >
>> > # Dynamic tKey2 results
>> >
>> > answer tKey2 -- returns '"key1"]["key2"]["key3"]["key4"'
>> >
>> > answer tArray[tKey2] -- returns null ...dynamic key definition is not
>> understood (as first level key)?
>> >
>> >
>> > answer tArray2 -- returns '["key1"]["key2"]["key3"]["key4"]' ...dynamic
>> key definition is not appended to array(?)
>> >
>> > end mouseUp
>> >
>> >
>> > Best,
>> > Keith
>> >
>> > ___
>> > use-livecode mailing list
>> > use-livecode@lists.runrev.com
>> > Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> > http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>> 

Re: Dynamic scripted nested array keys?

2021-04-24 Thread Brian Milby via use-livecode
Easiest way is to use split...

Given a tree widget this will take a path from field 1 and put the value at
that path in field 2

on mouseUp pMouseButton
   local tTree, tLoc
   put the arrayData of widget 1 into tTree
   put field 1 into tLoc
   split tLoc by comma
   put tTree[tLoc] into field 2
end mouseUp

Thanks,
Brian

On Sat, Apr 24, 2021 at 9:06 AM Paul Dupuis via use-livecode <
use-livecode@lists.runrev.com> wrote:

> I have only partially been following this thread, but if you need to
> find the array 'content' in an arbitrary nested array from a comma
> delimited path of array keys, recursion is the way to do it:
>
> function fetchArrayContentFromPath pArray,pPath
>-- pArray is an array
>-- pPath is a comma delimited 'path' of array keys to the desired
> content
>local tKey
>if pArray is not an array then
>  return pArray -- I have reached the content, so return that content
>else if pPath is empty then
>  return pArray -- should not happen in a tree widget, but this is if
> the path ends in an array instead of the content of an array element
>else
>  put item 1 of pPath into tKey -- get the key of element in the
> currnet path
>  delete item 1 of pPath-- remove it from the current path,
> so the path is the next set of key(s)
>  return fetchArrayContentFromPath(pArray[tKey],pPath) - recursively
> fetch the remainig keys from the currnet array element
>end if
> end fetchArrayContentFromPath
>
> It will not matter is the 'path' is key1,key1 or
> key1,key2,key3,key4,key5,key6,key7, or whatever.
>
>
> On 4/24/2021 7:10 AM, Keith Clarke via use-livecode wrote:
> > Hi folks,
> > Inspired by Jaque’s (working - thank you!) response to my question “Show
> Tree widget row contents on hover” I’ve isolated the final piece of that
> puzzle that leaves me baffled.
> >
> > Specifically, can LiveCode accept a dynamically built key for a nested
> multi-dimensional array? Copy the button script recipe below to see the
> problem.
> >
> > Perhaps the LC array experts here can help explain why Jaque’s
> hard-wired key definition works but my attempts to replicate this syntax
> via scripting to support variable depth of arrays  get ignored? Is it my
> syntax or just the way arrays work in LC…?
> > on mouseUp pButtonNumber
> >
> > # Create a nested array
> >
> > put "Content" into tArray["key1"]["key2"]["key3"]["key4"]
> >
> >
> > # Replicate the path response from the Tree widget actionInspect function
> >
> > put "key1,key2,key3,key4" into pPath
> >
> >
> > # Jaque's 'hard-wired' array key recipe works!
> >
> > answer tArray[item 1 of pPath][item 2 of pPath][item 3 of pPath][item 4
> of pPath] --returns 'Content'
> >
> >
> > # Replicate Jaque's syntax dynamically
> >
> > put the number of items in pPath into tKeyCount
> >
> > put empty into iNum
> >
> > repeat for each item i in pPath
> >
> > add 1 to iNum
> >
> > # Try building the full key string
> >
> > put "[" & item iNum of pPath & "]"after tKey1
> >
> >
> > # Try building keys string to 'embed' into the regular array key syntax
> >
> > put item iNum of pPath after tKey2
> >
> > if iNum < tKeyCount then put "][" after tKey2
> >
> >
> > # Try building by each key
> >
> > if i is not empty then put "[" & item iNum of pPath & "]" after tArray2
> >
> > end repeat
> >
> >
> > # Dynamic tKey1 results
> >
> > answer tKey1 -- returns '["key1"]["key2"]["key3"]["key4"]' ...seems
> 'correct'
> >
> > answer tArray & tKey1 -- returns '["key1"]["key2"]["key3"]["key4"]'
> ...dynamic key definition is not appended to array(?)
> >
> >
> > # Dynamic tKey2 results
> >
> > answer tKey2 -- returns '"key1"]["key2"]["key3"]["key4"'
> >
> > answer tArray[tKey2] -- returns null ...dynamic key definition is not
> understood (as first level key)?
> >
> >
> > answer tArray2 -- returns '["key1"]["key2"]["key3"]["key4"]' ...dynamic
> key definition is not appended to array(?)
> >
> > end mouseUp
> >
> >
> > Best,
> > Keith
> >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Dynamic scripted nested array keys?

2021-04-24 Thread Paul Dupuis via use-livecode
I have only partially been following this thread, but if you need to 
find the array 'content' in an arbitrary nested array from a comma 
delimited path of array keys, recursion is the way to do it:


function fetchArrayContentFromPath pArray,pPath
  -- pArray is an array
  -- pPath is a comma delimited 'path' of array keys to the desired content
  local tKey
  if pArray is not an array then
    return pArray -- I have reached the content, so return that content
  else if pPath is empty then
    return pArray -- should not happen in a tree widget, but this is if 
the path ends in an array instead of the content of an array element

  else
    put item 1 of pPath into tKey -- get the key of element in the 
currnet path
    delete item 1 of pPath    -- remove it from the current path, 
so the path is the next set of key(s)
    return fetchArrayContentFromPath(pArray[tKey],pPath) - recursively 
fetch the remainig keys from the currnet array element

  end if
end fetchArrayContentFromPath

It will not matter is the 'path' is key1,key1 or 
key1,key2,key3,key4,key5,key6,key7, or whatever.



On 4/24/2021 7:10 AM, Keith Clarke via use-livecode wrote:

Hi folks,
Inspired by Jaque’s (working - thank you!) response to my question “Show Tree 
widget row contents on hover” I’ve isolated the final piece of that puzzle that 
leaves me baffled.

Specifically, can LiveCode accept a dynamically built key for a nested 
multi-dimensional array? Copy the button script recipe below to see the problem.

Perhaps the LC array experts here can help explain why Jaque’s hard-wired key 
definition works but my attempts to replicate this syntax via scripting to 
support variable depth of arrays  get ignored? Is it my syntax or just the way 
arrays work in LC…?
on mouseUp pButtonNumber

# Create a nested array

put "Content" into tArray["key1"]["key2"]["key3"]["key4"]


# Replicate the path response from the Tree widget actionInspect function

put "key1,key2,key3,key4" into pPath


# Jaque's 'hard-wired' array key recipe works!

answer tArray[item 1 of pPath][item 2 of pPath][item 3 of pPath][item 4 of 
pPath] --returns 'Content'


# Replicate Jaque's syntax dynamically

put the number of items in pPath into tKeyCount

put empty into iNum

repeat for each item i in pPath

add 1 to iNum

# Try building the full key string

put "[" & item iNum of pPath & "]"after tKey1


# Try building keys string to 'embed' into the regular array key syntax

put item iNum of pPath after tKey2

if iNum < tKeyCount then put "][" after tKey2


# Try building by each key

if i is not empty then put "[" & item iNum of pPath & "]" after tArray2

end repeat


# Dynamic tKey1 results

answer tKey1 -- returns '["key1"]["key2"]["key3"]["key4"]' ...seems 'correct'

answer tArray & tKey1 -- returns '["key1"]["key2"]["key3"]["key4"]' ...dynamic 
key definition is not appended to array(?)


# Dynamic tKey2 results

answer tKey2 -- returns '"key1"]["key2"]["key3"]["key4"'

answer tArray[tKey2] -- returns null ...dynamic key definition is not 
understood (as first level key)?


answer tArray2 -- returns '["key1"]["key2"]["key3"]["key4"]' ...dynamic key 
definition is not appended to array(?)

end mouseUp


Best,
Keith
   
___

use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Dynamic scripted nested array keys?

2021-04-24 Thread Keith Clarke via use-livecode
Hi folks,
Inspired by Jaque’s (working - thank you!) response to my question “Show Tree 
widget row contents on hover” I’ve isolated the final piece of that puzzle that 
leaves me baffled.

Specifically, can LiveCode accept a dynamically built key for a nested 
multi-dimensional array? Copy the button script recipe below to see the problem.

Perhaps the LC array experts here can help explain why Jaque’s hard-wired key 
definition works but my attempts to replicate this syntax via scripting to 
support variable depth of arrays  get ignored? Is it my syntax or just the way 
arrays work in LC…?
on mouseUp pButtonNumber

# Create a nested array

put "Content" into tArray["key1"]["key2"]["key3"]["key4"]


# Replicate the path response from the Tree widget actionInspect function

put "key1,key2,key3,key4" into pPath


# Jaque's 'hard-wired' array key recipe works!

answer tArray[item 1 of pPath][item 2 of pPath][item 3 of pPath][item 4 of 
pPath] --returns 'Content'


# Replicate Jaque's syntax dynamically

put the number of items in pPath into tKeyCount

put empty into iNum

repeat for each item i in pPath

add 1 to iNum

# Try building the full key string

put "[" & item iNum of pPath & "]"after tKey1


# Try building keys string to 'embed' into the regular array key syntax

put item iNum of pPath after tKey2

if iNum < tKeyCount then put "][" after tKey2


# Try building by each key

if i is not empty then put "[" & item iNum of pPath & "]" after tArray2

end repeat


# Dynamic tKey1 results

answer tKey1 -- returns '["key1"]["key2"]["key3"]["key4"]' ...seems 'correct'

answer tArray & tKey1 -- returns '["key1"]["key2"]["key3"]["key4"]' ...dynamic 
key definition is not appended to array(?)


# Dynamic tKey2 results

answer tKey2 -- returns '"key1"]["key2"]["key3"]["key4"'

answer tArray[tKey2] -- returns null ...dynamic key definition is not 
understood (as first level key)?


answer tArray2 -- returns '["key1"]["key2"]["key3"]["key4"]' ...dynamic key 
definition is not appended to array(?)

end mouseUp


Best,
Keith
  
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode