[ANN] This Week in LiveCode 259

2021-03-22 Thread panagiotis merakos via use-livecode
Hi all,

Read about new developments in LiveCode open source and the open source
community in today's edition of the "This Week in LiveCode" newsletter!

Read issue #259 here: http://bit.ly/3tY74Qj

This is a weekly newsletter about LiveCode, focussing on what's been
going on in and around the open source project. New issues will be
released weekly on Mondays. We have a dedicated mailing list that will
deliver each issue directly to your e-mail, so you don't miss any!

If you have anything you'd like mentioned (a project, a discussion
somewhere, an upcoming event) then please get in touch.



-- 
Panagiotis Merakos 
LiveCode Software Developer

Everyone Can Create Apps 
___
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: numberformat question

2021-03-22 Thread jbv via use-livecode

Le 2021-03-22 12:14, John Balgenorth via use-livecode a écrit :

You might be able to get the info by running your javascript
from a shell command.  Here is a link that might be of help;

https://stackoverflow.com/questions/12659778/is-it-possible-to-run-javascript-files-from-the-command-line



Thank you, but if I run javascript, I would prefer to use a
browser objet and revBrowserCallScript...
BTW, as I haven't used browser controls in a long time, am I
forced to use a distant url, or can I point to some html + js
stored in my stack as a field or even a variable ?

Thanks in advance.

___
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: numberformat question

2021-03-22 Thread Bob Sneidar via use-livecode
The ingenuity of people on this list never ceases to amaze me. 

Bob S


> On Mar 22, 2021, at 6:41 AM, Craig Newman via use-livecode 
>  wrote:
> 
> Check out this thread in the forum:
> 
> https://forums.livecode.com/viewtopic.php?f=7=25132=130985=longadd#p130985
>  
> 
> 
> Craig
> 
>> On Mar 21, 2021, at 7:34 AM, jbv via use-livecode 
>>  wrote:
>> 
>> Paul, Sean,
>> 
>> Thank you both for your answers, although it doesn't really solve my problem.
>> The most surprising thing is that javascript runs these calculations without
>> problem :
>> (-0.007347880794884118999 / 10) returns -7.347880794884119e-16
>> (-0.007347880794884118999 / 1) returns -7.347880794884119e-19
>> 
>> Best
>> 
>> 
>> Le 2021-03-21 07:11, Sean Cole (Pi) via use-livecode a écrit :
>>> Livecode can handle floating point numbers up to 2^52. But then
>>> calculations would have to fit within that range in a floating point
>>> perspective too. So, once you add that ninth zero to the end of your
>>> divider, it struggles with the calculation and returns, effectively, number
>>> out of range.
>>> Fractions in FP binary are tremendously complicated. Calculation in it are
>>> even more so.
>>> https://www.h-schmidt.net/FloatConverter/IEEE754.html
>>> On Sat, 20 Mar 2021 at 20:23, Paul Dupuis via use-livecode <
>>> use-livecode@lists.runrev.com> wrote:
 I don't have an answer, other than to say there has been a LOT of
 discussion over the years about the limits of number precision in
 LiveCode and a number of enhancement requests and 3rd party libraries
 that have attempted to provide a framework for high precision math. You
 might search the list archives or search the forum on the LC web site
 for past discussions about number precision.
 On 3/20/2021 3:06 PM, jbv via use-livecode wrote:
> Hi list,
> I am a bit lost :
> 
>   set numberformat to ".#"
>   put -0.007347880794884118999 / 1000
> -- returns -0.07347880794884119  which is ok
> 
>   put -0.007347880794884118999 / 100
> -- returns -0.7347880794884 -> also ok
> 
>   put -0.007347880794884118999 / 1
> -- returns -0.0073478807949 -> still ok
> 
>   put -0.007347880794884118999 / 10
> -- returns 0 -> ?
> 
> Any explanations ?
> Thanks in advance.
> Best,
> jbv
> 
> ___
> 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
> 
> ___
> 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: numberformat question

2021-03-22 Thread Mark Wieder via use-livecode

On 3/22/21 9:39 AM, Sean Cole (Pi) via use-livecode wrote:

JS should use exactly the same standard as LC
https://www.avioconsulting.com/blog/overcoming-javascript-numeric-precision-issues

2^53, same in JS as LC. IEEE 754


Right. To get any more precision you'll have to stringify the 
calculations, and Craig has already posted a link to MaxV's excellent 
set of functions for this.


Someday maybe we'll get that decimal math library shoehorned into place 
and then we can look back on these days and laugh.


--
 Mark Wieder
 ahsoftw...@gmail.com

___
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: LC Bug: Copying an Image fails

2021-03-22 Thread Bob Sneidar via use-livecode
+1

On Mar 19, 2021, at 9:55 PM, Curry Kenworthy via use-livecode 
mailto:use-livecode@lists.runrev.com>> wrote:

Bob:

> MS Office copy operations are notoriously problematic.
> Microsoft maintains their own clipboard format, so that when
> switching to another product the clipboard must be translated.
> Other apps may do the same.
> The translation does not always go to plan.

Eh ... I think this is a more useful current summary:

1. The Windows blank pasted image bug was about a data stream pointer.
Thanks to the LC Team for looking into that; hope it's merged sooner.

2. There's a crash for some copied image data. Not just MS Office.

3. Mac has image copy/paste troubles too. Also not just MS Office.
I'll report that soon, and we'll probably see improvement.

4. There are dozens of issues with copied content being converted in LC.
I'm crushing many of those with workarounds, so improvement there too!

Is copy/paste between apps effortless? No.
Do users expect it? Yes.
Even with the most popular apps? Of course!
There are problems, but also progress

Best wishes,

Curry Kenworthy

Custom Software Development

___
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: numberformat question

2021-03-22 Thread Sean Cole (Pi) via use-livecode
JS should use exactly the same standard as LC
https://www.avioconsulting.com/blog/overcoming-javascript-numeric-precision-issues

2^53, same in JS as LC. IEEE 754

Sean

On Mon, 22 Mar 2021 at 16:14, John Balgenorth via use-livecode <
use-livecode@lists.runrev.com> wrote:

> You might be able to get the info by running your javascript
> from a shell command.  Here is a link that might be of help;
>
>
> https://stackoverflow.com/questions/12659778/is-it-possible-to-run-javascript-files-from-the-command-line
>
> JB
>
>
> > On Mar 22, 2021, at 9:05 AM, jbv via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> > Hi Craig,
> >
> > Thank you for the link, but it doesn't help much :
> >
> > bigDivide(-0.007347880794884118999,10)
> > returns 0 , -0.01
> >
> > what I'm actually trying to do is to transpose in LC
> > an algo for solving cubic equations that runs perfectly
> > in javascript.
> > So my solution will finally be to multiply data by 10^6,
> > run the algo, and then divide the results by 10^6 by
> > treating them as strings and moving the dot...
> > It's not really elegant and especially quite slow, as I
> > need to process large amounts of data and am not sure
> > that I'll be able to use LC for that project (which is
> > so far only a prototype).
> >
> > I don't mean to start another endless thread on this topic,
> > but one thing puzzles me though : I understand that LC doesn't
> > use decimal numbers for internal calculations for reasons
> > of speed, but then how come does js perform high precision
> > calculations without any speed issues ?
> >
> > Best
> >
> > Le 2021-03-22 09:41, Craig Newman via use-livecode a écrit :
> >> Check out this thread in the forum:
> >>
> https://forums.livecode.com/viewtopic.php?f=7=25132=130985=longadd#p130985
> >> <
> https://forums.livecode.com/viewtopic.php?f=7=25132=130985=longadd#p130985
> >
> >> Craig
>  On Mar 21, 2021, at 7:34 AM, jbv via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >>> Paul, Sean,
> >>> Thank you both for your answers, although it doesn't really solve my
> problem.
> >>> The most surprising thing is that javascript runs these calculations
> without
> >>> problem :
> >>> (-0.007347880794884118999 / 10) returns
> -7.347880794884119e-16
> >>> (-0.007347880794884118999 / 1) returns
> -7.347880794884119e-19
> >>> Best
> >>> Le 2021-03-21 07:11, Sean Cole (Pi) via use-livecode a écrit :
>  Livecode can handle floating point numbers up to 2^52. But then
>  calculations would have to fit within that range in a floating point
>  perspective too. So, once you add that ninth zero to the end of your
>  divider, it struggles with the calculation and returns, effectively,
> number
>  out of range.
>  Fractions in FP binary are tremendously complicated. Calculation in
> it are
>  even more so.
>  https://www.h-schmidt.net/FloatConverter/IEEE754.html
>  On Sat, 20 Mar 2021 at 20:23, Paul Dupuis via use-livecode <
>  use-livecode@lists.runrev.com> wrote:
> > I don't have an answer, other than to say there has been a LOT of
> > discussion over the years about the limits of number precision in
> > LiveCode and a number of enhancement requests and 3rd party libraries
> > that have attempted to provide a framework for high precision math.
> You
> > might search the list archives or search the forum on the LC web site
> > for past discussions about number precision.
> > On 3/20/2021 3:06 PM, jbv via use-livecode wrote:
> > > Hi list,
> > > I am a bit lost :
> > >
> > >set numberformat to ".#"
> > >put -0.007347880794884118999 / 1000
> > > -- returns -0.07347880794884119  which is ok
> > >
> > >put -0.007347880794884118999 / 100
> > > -- returns -0.7347880794884 -> also ok
> > >
> > >put -0.007347880794884118999 / 1
> > > -- returns -0.0073478807949 -> still ok
> > >
> > >put -0.007347880794884118999 / 10
> > > -- returns 0 -> ?
> > >
> > > Any explanations ?
> > > Thanks in advance.
> > > Best,
> > > jbv
> > >
> > > ___
> > > 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
> >>> 

Re: numberformat question

2021-03-22 Thread John Balgenorth via use-livecode
You might be able to get the info by running your javascript
from a shell command.  Here is a link that might be of help;

https://stackoverflow.com/questions/12659778/is-it-possible-to-run-javascript-files-from-the-command-line

JB


> On Mar 22, 2021, at 9:05 AM, jbv via use-livecode 
>  wrote:
> 
> Hi Craig,
> 
> Thank you for the link, but it doesn't help much :
> 
> bigDivide(-0.007347880794884118999,10)
> returns 0 , -0.01
> 
> what I'm actually trying to do is to transpose in LC
> an algo for solving cubic equations that runs perfectly
> in javascript.
> So my solution will finally be to multiply data by 10^6,
> run the algo, and then divide the results by 10^6 by
> treating them as strings and moving the dot...
> It's not really elegant and especially quite slow, as I
> need to process large amounts of data and am not sure
> that I'll be able to use LC for that project (which is
> so far only a prototype).
> 
> I don't mean to start another endless thread on this topic,
> but one thing puzzles me though : I understand that LC doesn't
> use decimal numbers for internal calculations for reasons
> of speed, but then how come does js perform high precision
> calculations without any speed issues ?
> 
> Best
> 
> Le 2021-03-22 09:41, Craig Newman via use-livecode a écrit :
>> Check out this thread in the forum:
>> https://forums.livecode.com/viewtopic.php?f=7=25132=130985=longadd#p130985
>> 
>> Craig
 On Mar 21, 2021, at 7:34 AM, jbv via use-livecode 
  wrote:
>>> Paul, Sean,
>>> Thank you both for your answers, although it doesn't really solve my 
>>> problem.
>>> The most surprising thing is that javascript runs these calculations without
>>> problem :
>>> (-0.007347880794884118999 / 10) returns -7.347880794884119e-16
>>> (-0.007347880794884118999 / 1) returns 
>>> -7.347880794884119e-19
>>> Best
>>> Le 2021-03-21 07:11, Sean Cole (Pi) via use-livecode a écrit :
 Livecode can handle floating point numbers up to 2^52. But then
 calculations would have to fit within that range in a floating point
 perspective too. So, once you add that ninth zero to the end of your
 divider, it struggles with the calculation and returns, effectively, number
 out of range.
 Fractions in FP binary are tremendously complicated. Calculation in it are
 even more so.
 https://www.h-schmidt.net/FloatConverter/IEEE754.html
 On Sat, 20 Mar 2021 at 20:23, Paul Dupuis via use-livecode <
 use-livecode@lists.runrev.com> wrote:
> I don't have an answer, other than to say there has been a LOT of
> discussion over the years about the limits of number precision in
> LiveCode and a number of enhancement requests and 3rd party libraries
> that have attempted to provide a framework for high precision math. You
> might search the list archives or search the forum on the LC web site
> for past discussions about number precision.
> On 3/20/2021 3:06 PM, jbv via use-livecode wrote:
> > Hi list,
> > I am a bit lost :
> >
> >set numberformat to ".#"
> >put -0.007347880794884118999 / 1000
> > -- returns -0.07347880794884119  which is ok
> >
> >put -0.007347880794884118999 / 100
> > -- returns -0.7347880794884 -> also ok
> >
> >put -0.007347880794884118999 / 1
> > -- returns -0.0073478807949 -> still ok
> >
> >put -0.007347880794884118999 / 10
> > -- returns 0 -> ?
> >
> > Any explanations ?
> > Thanks in advance.
> > Best,
> > jbv
> >
> > ___
> > 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
>> ___
>> 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 

Re: numberformat question

2021-03-22 Thread jbv via use-livecode

Le 2021-03-22 12:03, jbv via use-livecode a écrit :

Hi Craig,

Thank you for the link, but it doesn't help much :

bigDivide(-0.007347880794884118999,10)
returns 0 , -0.01




Ooops, I just realized that I forgot to add
set numberformat to "0.##"
at the beginning of bigDivide...

now bigDivide(-0.007347880794884118999,10)
0 , -0.00734788079488411899919975

___
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: numberformat question

2021-03-22 Thread jbv via use-livecode

Hi Craig,

Thank you for the link, but it doesn't help much :

bigDivide(-0.007347880794884118999,10)
returns 0 , -0.01

what I'm actually trying to do is to transpose in LC
an algo for solving cubic equations that runs perfectly
in javascript.
So my solution will finally be to multiply data by 10^6,
run the algo, and then divide the results by 10^6 by
treating them as strings and moving the dot...
It's not really elegant and especially quite slow, as I
need to process large amounts of data and am not sure
that I'll be able to use LC for that project (which is
so far only a prototype).

I don't mean to start another endless thread on this topic,
but one thing puzzles me though : I understand that LC doesn't
use decimal numbers for internal calculations for reasons
of speed, but then how come does js perform high precision
calculations without any speed issues ?

Best

Le 2021-03-22 09:41, Craig Newman via use-livecode a écrit :

Check out this thread in the forum:

https://forums.livecode.com/viewtopic.php?f=7=25132=130985=longadd#p130985


Craig

On Mar 21, 2021, at 7:34 AM, jbv via use-livecode 
 wrote:


Paul, Sean,

Thank you both for your answers, although it doesn't really solve my 
problem.
The most surprising thing is that javascript runs these calculations 
without

problem :
(-0.007347880794884118999 / 10) returns 
-7.347880794884119e-16
(-0.007347880794884118999 / 1) returns 
-7.347880794884119e-19


Best


Le 2021-03-21 07:11, Sean Cole (Pi) via use-livecode a écrit :

Livecode can handle floating point numbers up to 2^52. But then
calculations would have to fit within that range in a floating point
perspective too. So, once you add that ninth zero to the end of your
divider, it struggles with the calculation and returns, effectively, 
number

out of range.
Fractions in FP binary are tremendously complicated. Calculation in 
it are

even more so.
https://www.h-schmidt.net/FloatConverter/IEEE754.html
On Sat, 20 Mar 2021 at 20:23, Paul Dupuis via use-livecode <
use-livecode@lists.runrev.com> wrote:

I don't have an answer, other than to say there has been a LOT of
discussion over the years about the limits of number precision in
LiveCode and a number of enhancement requests and 3rd party 
libraries
that have attempted to provide a framework for high precision math. 
You
might search the list archives or search the forum on the LC web 
site

for past discussions about number precision.
On 3/20/2021 3:06 PM, jbv via use-livecode wrote:
> Hi list,
> I am a bit lost :
>
>set numberformat to ".#"
>put -0.007347880794884118999 / 1000
> -- returns -0.07347880794884119  which is ok
>
>put -0.007347880794884118999 / 100
> -- returns -0.7347880794884 -> also ok
>
>put -0.007347880794884118999 / 1
> -- returns -0.0073478807949 -> still ok
>
>put -0.007347880794884118999 / 10
> -- returns 0 -> ?
>
> Any explanations ?
> Thanks in advance.
> Best,
> jbv
>
> ___
> 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


___
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


What is the easiest way to add another snapshot from the same rect to the same PDF file?

2021-03-22 Thread William de Smet via use-livecode
Hi there,

In an existing iOS app I do this:
---
export snapshot from grc "printmarge" to tPDF as PNG
put specialFolderPath("documents") & "/file.pdf"  into tFilePath
set the printPaperOrientation to "portrait"
set the printMargins to 36,72,36,72
open printing to PDF tFilePath
print this cd from 61,207 to 961,542
close printing


What is the easiest and fastest way to add another snapshot from the same
rect to the same PDF file?


greetings,

William
___
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: numberformat question

2021-03-22 Thread Craig Newman via use-livecode
Check out this thread in the forum:

https://forums.livecode.com/viewtopic.php?f=7=25132=130985=longadd#p130985
 


Craig

> On Mar 21, 2021, at 7:34 AM, jbv via use-livecode 
>  wrote:
> 
> Paul, Sean,
> 
> Thank you both for your answers, although it doesn't really solve my problem.
> The most surprising thing is that javascript runs these calculations without
> problem :
> (-0.007347880794884118999 / 10) returns -7.347880794884119e-16
> (-0.007347880794884118999 / 1) returns -7.347880794884119e-19
> 
> Best
> 
> 
> Le 2021-03-21 07:11, Sean Cole (Pi) via use-livecode a écrit :
>> Livecode can handle floating point numbers up to 2^52. But then
>> calculations would have to fit within that range in a floating point
>> perspective too. So, once you add that ninth zero to the end of your
>> divider, it struggles with the calculation and returns, effectively, number
>> out of range.
>> Fractions in FP binary are tremendously complicated. Calculation in it are
>> even more so.
>> https://www.h-schmidt.net/FloatConverter/IEEE754.html
>> On Sat, 20 Mar 2021 at 20:23, Paul Dupuis via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>>> I don't have an answer, other than to say there has been a LOT of
>>> discussion over the years about the limits of number precision in
>>> LiveCode and a number of enhancement requests and 3rd party libraries
>>> that have attempted to provide a framework for high precision math. You
>>> might search the list archives or search the forum on the LC web site
>>> for past discussions about number precision.
>>> On 3/20/2021 3:06 PM, jbv via use-livecode wrote:
>>> > Hi list,
>>> > I am a bit lost :
>>> >
>>> >set numberformat to ".#"
>>> >put -0.007347880794884118999 / 1000
>>> > -- returns -0.07347880794884119  which is ok
>>> >
>>> >put -0.007347880794884118999 / 100
>>> > -- returns -0.7347880794884 -> also ok
>>> >
>>> >put -0.007347880794884118999 / 1
>>> > -- returns -0.0073478807949 -> still ok
>>> >
>>> >put -0.007347880794884118999 / 10
>>> > -- returns 0 -> ?
>>> >
>>> > Any explanations ?
>>> > Thanks in advance.
>>> > Best,
>>> > jbv
>>> >
>>> > ___
>>> > 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

___
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: LC Server - Check for Screen size?

2021-03-22 Thread scott--- via use-livecode
Matthias, thank you so much for the complete solution. I’m such a beginner with 
LC server (and not even a beginner at JS) that your explanation was what I 
needed.
--
Scott Morrow

Elementary Software
(Now with 20% less chalk dust!)
web   https://elementarysoftware.com/
email sc...@elementarysoftware.com
booth1-360-734-4701
--


> On Mar 21, 2021, at 4:51 AM, matthias rebbe via use-livecode 
>  wrote:
> 
> Hi Rick,
> here's a sample with some put commands and comments for better understanding.
>  -- read Cookie screeres if available
> put $_COOKIE["screenres"] into tScreenRes
> 
> if tScreenRes is empty
> then
>   put "cookie not found. we need to write the cookie"
> -- the cookie does not exists or is empty, so we now executing JS, but 
> -- the following closing tag is mandatory, otherwise the js is not executed
> ?>   
> 
>   let screenwidth = (screen.availWidth);
>   let screenheight =(screen.availHeight);
>   document.cookie = "screenres="+screenwidth +","+screenheight;
> 
>put "cookie written"
> else
>   put "Cookie already there"
> end if
> 
> --now we extract height and width from the var tScreenRes
> set the itemdelimiter to ","
> put item 1 of tScreenRes to tWidth
> put item 2 of tScreenRes to tHeight
> 
> --from here take action according the detected screenresolution.
> ?>
> 
> 
> Note: The above script detects and uses the available screen resolution. 
> Regards,
> 
> 
> -
> Matthias Rebbe
> Life Is Too Short For Boring Code
> 
>> Am 21.03.2021 um 01:02 schrieb Rick Harrison via use-livecode 
>> :
>> 
>> Hi Matthias,
>> 
>> So you are thinking something like:
>> 
>> 
>> 
>> 
>> 
>> Your Screen:
>> 
>> 
>> 
>> 
>> var txt = "";
>> txt += "

Total width/height: " + screen.width + "*" + screen.height + >> "

"; >> txt += "

Available width/height: " + screen.availWidth + "*" + >> screen.availHeight + "

"; >> txt += "

Color depth: " + screen.colorDepth + "

"; >> txt += "

Color resolution: " + screen.pixelDepth + "

"; >> >> document.getElementById("demo").innerHTML = txt; >> >> >> >> >> >> And then put the information into a Javascript cookie and then read the >> cookie value with an LC Server script. >> >> I’ll see if I can get that to work. >> >> Thanks! >> >> Rick >> >>> On Mar 20, 2021, at 6:10 PM, matthias rebbe via use-livecode >>> wrote: >>> >>> As Livecode Server runs on the server there is no direct command/function >>> in LC Server available for this task. >>> >>> But you could use Javascript (document.cookie) in your LC Server script >>> to write the screen resolution into a cookie and read that cookie then with >>> your Livecode Server script. >>> >>> >>> - >>> Matthias Rebbe >>> Life Is Too Short For Boring Code >> >> ___ >> 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