Re: Not sure what to do.....can I run this by you guys?
Hi everyone here is the github repo for the stack demonstrating the solution. May not work on all cases but can for many. Seems to work very well for my needs. 10 requests ...no problem. have not done more. https://github.com/makeshyft-tom-g/lc-single-domain-asynchronous-http On Sun, Mar 18, 2018 at 11:54 PM, Tom Glodwrote: > Yup, realized that when I thought about and tried mikes suggestion > > Yes using a ? works just the same as # but may be safer in some way.. > > I'm just completing demo stack for this .works flawlessly. > > Thanks to everyone who chimed in here to help me find solution...hopefully > i can make it easier on others to publish a demo stack. > > > > > On Sun, Mar 18, 2018 at 10:39 AM, Ben Rubinstein via use-livecode < > use-livecode@lists.runrev.com> wrote: > >> I think this depends on the base URL. If it's with a simple URL, there's >> no reason why an appended '#' parameter should cause a browser to request >> it fresh; as Mike says, it indicates scrolling to an anchor in the page. So >> it's perfectly reasonable for a smart browser - or a caching layer on the >> server, or in a proxy somewhere between you and the server - to use a >> cached version of that page ignoring the '#' suffix. >> >> With a simple URL, the better choice is to use "?" to append a parameter >> (I usually use 'the milliseconds' to guarantee that it's unique). Neither >> the browser nor any caching layer on the chain between the user agent and >> the source system should recognise it as the same URL, so this should force >> a fresh load. You can just use e.g. >> put "?" & the milliseconds after tURL >> >> or to be more explicit, name the parameter something e.g. >> put "?nocache=" & the milliseconds after tURL >> or >> >> put "?uniqueid=" & the milliseconds after tURL >> >> The only downside of using "?" is that if the URL may already includes >> parameters starting with "?" (which is what I mean by "not a simple URL"), >> you need to test for that and use "&" instead of "?" to indicate that this >> is an additional parameter; and if this is a dynamic request, which uses >> the 'query parameters' in the URL to decide what to return, you need to be >> sure that adding your parameter won't affect it! >> >> >> On 16/03/2018 13:31, Mike Bonner via use-livecode wrote: >> >>> Another way around the cache problem is to use the #2 trick at the end of >>> the url. Send each request with a pound and different number at the end >>> of >>> the url and it'll be seen as a new request thus doing an end run around >>> the >>> cache. Since it designates an inline anchor position on the page, it >>> should have zero affect on the way the url functions. (unless things >>> have >>> changed, the associated anchor doesn't need to exist on the page) >>> >>> Thanks for the neat trick Charles. :) >>> >>> On Fri, Mar 16, 2018 at 7:24 AM, Tom Glod via use-livecode < >>> use-livecode@lists.runrev.com> wrote: >>> >>> WowI'm impressedthats quite a hack Charles..I will study all this see how far I get. Thank you gentlemenyou are Rockstars!! On Fri, Mar 16, 2018 at 7:13 AM, Lagi Pittas via use-livecode < use-livecode@lists.runrev.com> wrote: Maybe not 100% reliable but > > https://stackoverflow.com/questions/1341089/using-meta- > tags-to-turn-off-caching-in-all-browsers > > Regards Lagi > > On 16 March 2018 at 09:48, Charles Warwick via use-livecode > wrote: > >> Hi Tom, >> >> If the site you are trying to contact has CORS enabled appropriately, >> > then you can do something like this... > >> >> With the LiveCode browser widget, you can call JavaScript functions >> > from > LC script and have the JavaScript functions call LC handlers in return. > JavaScript has the capability to perform asynchronous HTTP requests. > >> >> You can create a HTML page that you automatically load up in the >> > browser > widget that has a small JavaScript function which you can call from LC > with > ‘do in widget’. All this function needs to do is issue an > asynchronous > HTTP call to the URL passed to it as a parameter and when it receives > the > data, return it back to your LC script by calling a nominated LC > handler > and passing the returned data as a parameter. > >> >> The HTML page would look something like this: >> >> >> >> Javascript Async Test >> >> >> function httpGetAsync(theUrl) >> { >> var xmlHttp = new XMLHttpRequest(); >> xmlHttp.onreadystatechange = function() { >> if (xmlHttp.readyState == 4 && xmlHttp.status == 200) >> liveCode.httpRequestComplete(theUrl, >> > xmlHttp.responseText); > } >> xmlHttp.open("GET",
Re: LC 9 and Icon Families
I finally got around to setting up an account and uploaded my tool. It works pretty good as a plugin, but I need to top level it once per session for the navigation to work (grid card). Thanks, Brian On Thu, Mar 15, 2018 at 4:35 AM hh via use-livecode < use-livecode@lists.runrev.com> wrote: > @Brian > Please add your tool also to "Sample Stacks". > This was reworked in the last year and works really fine here. > And it is *very* fast for searching and downloading a stack. > > Such wonderful stacks go (somehow) lost in the list or the forum. > > ___ > 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: Not sure what to do.....can I run this by you guys?
Yup, realized that when I thought about and tried mikes suggestion Yes using a ? works just the same as # but may be safer in some way.. I'm just completing demo stack for this .works flawlessly. Thanks to everyone who chimed in here to help me find solution...hopefully i can make it easier on others to publish a demo stack. On Sun, Mar 18, 2018 at 10:39 AM, Ben Rubinstein via use-livecode < use-livecode@lists.runrev.com> wrote: > I think this depends on the base URL. If it's with a simple URL, there's > no reason why an appended '#' parameter should cause a browser to request > it fresh; as Mike says, it indicates scrolling to an anchor in the page. So > it's perfectly reasonable for a smart browser - or a caching layer on the > server, or in a proxy somewhere between you and the server - to use a > cached version of that page ignoring the '#' suffix. > > With a simple URL, the better choice is to use "?" to append a parameter > (I usually use 'the milliseconds' to guarantee that it's unique). Neither > the browser nor any caching layer on the chain between the user agent and > the source system should recognise it as the same URL, so this should force > a fresh load. You can just use e.g. > put "?" & the milliseconds after tURL > > or to be more explicit, name the parameter something e.g. > put "?nocache=" & the milliseconds after tURL > or > > put "?uniqueid=" & the milliseconds after tURL > > The only downside of using "?" is that if the URL may already includes > parameters starting with "?" (which is what I mean by "not a simple URL"), > you need to test for that and use "&" instead of "?" to indicate that this > is an additional parameter; and if this is a dynamic request, which uses > the 'query parameters' in the URL to decide what to return, you need to be > sure that adding your parameter won't affect it! > > > On 16/03/2018 13:31, Mike Bonner via use-livecode wrote: > >> Another way around the cache problem is to use the #2 trick at the end of >> the url. Send each request with a pound and different number at the end >> of >> the url and it'll be seen as a new request thus doing an end run around >> the >> cache. Since it designates an inline anchor position on the page, it >> should have zero affect on the way the url functions. (unless things have >> changed, the associated anchor doesn't need to exist on the page) >> >> Thanks for the neat trick Charles. :) >> >> On Fri, Mar 16, 2018 at 7:24 AM, Tom Glod via use-livecode < >> use-livecode@lists.runrev.com> wrote: >> >> WowI'm impressedthats quite a hack Charles..I will study all this >>> see how far I get. >>> >>> Thank you gentlemenyou are Rockstars!! >>> >>> On Fri, Mar 16, 2018 at 7:13 AM, Lagi Pittas via use-livecode < >>> use-livecode@lists.runrev.com> wrote: >>> >>> Maybe not 100% reliable but https://stackoverflow.com/questions/1341089/using-meta- tags-to-turn-off-caching-in-all-browsers Regards Lagi On 16 March 2018 at 09:48, Charles Warwick via use-livecodewrote: > Hi Tom, > > If the site you are trying to contact has CORS enabled appropriately, > then you can do something like this... > > With the LiveCode browser widget, you can call JavaScript functions > from >>> LC script and have the JavaScript functions call LC handlers in return. JavaScript has the capability to perform asynchronous HTTP requests. > > You can create a HTML page that you automatically load up in the > browser >>> widget that has a small JavaScript function which you can call from LC >>> with >>> ‘do in widget’. All this function needs to do is issue an asynchronous HTTP call to the URL passed to it as a parameter and when it receives the data, return it back to your LC script by calling a nominated LC handler and passing the returned data as a parameter. > > The HTML page would look something like this: > > > > Javascript Async Test > > > function httpGetAsync(theUrl) > { > var xmlHttp = new XMLHttpRequest(); > xmlHttp.onreadystatechange = function() { > if (xmlHttp.readyState == 4 && xmlHttp.status == 200) > liveCode.httpRequestComplete(theUrl, > xmlHttp.responseText); >>> } > xmlHttp.open("GET", theUrl, true); // true for asynchronous > xmlHttp.send(null); > } > > > > > > > You can either load that from a file into the browser widget’s URL or > set its htmlText property accordingly... > > Then in LC, make sure you register the httpRequestComplete handler so > that the widget can call it: > > set the javascriptHandlers of widget “browser” to “httpRequestComplete” > > After that, add a
Re: tsNetSmtpSync (with attachment
Hi, That does seem odd... Is there any chance you might have some anti-virus software running that might be getting in the way? Regards, Charles > On 14 Mar 2018, at 1:18 am, G. Wolfgang Gaich via use-livecode >wrote: > > Hallo all, > > try to send an email with attachment (PDF) from LiveCode with tsNet > (tsNetSmtpSync) > > I tried the sample stack "Mail v1.2" from > https://downloads.techstrategies.com.au/tsnet/LCMail.livecode > > I get an error when I try to send with an attachment (PDF document): > > Error tsneterr: (28) schannel: timed out sending data (bytes sent: 0) > returned from server > > > Without the attachment the email is send. > > Windows 7, LC 8.1.9 > > > Any ideas? > > Best > Günter > > > ___ > 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: tsNet woes
Hi Dan, LC 8.1.9 has the latest version of tsNet at present. If this is something you are still experiencing, are you able to share the code with me so I can see if I can replicate it? Regards, Charles > On 14 Mar 2018, at 12:37 am, Dan Friedman via use-livecode >wrote: > > Charles, > > I misspoke… I’m not on 8.1.5, I’m using 8.1.9. Is there another version > you would recommend? > > -Dan > > > Hi Dan, > > If tsNetIsSyncBlocked() is always returning true then a connection must be > stalled. > > The latest version of tsNet defaults to timing out stalled connections after > 30 seconds. If you want to stay with LC 8.1.5 then just add the following > code in your application’s startup: > > tsNetSetTimeouts 60,0,30,6,30,1000 > > The last two parameters of this command mean timeout the connection in 30 > seconds if less than 1000 bytes per second are transferred over this period. > > You can adjust those values to suit your application. > > Regards, > > Charles > > >> On Mon, Mar 12, 2018 at 7:11 PM, Dan Friedman via use-livecode < >> >>> Greetings! >>> >>> I have an app I am working on and it’s working perfectly on my Mac and in >>> the iOS simulator. However, on an Android device, once I do a couple of >>> get urls, tsNet stops functioning. I get a variety of results: >>> >>> Previous request not completed >>> Sync request already in progress (most common) >>> tsNet is not initialized >>> >>> Also, tsNetIsSyncBlocked() always returns true. >>> >>> I am using LC Indy 8.1.5. Any thoughts or advise? >>> >>> -Dan > > ___ > 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: Dinamyc variables.
> On 19 Mar 2018, at 1:08 pm, Heriberto Torrado via use-livecode >wrote: > I am trying to create a new variable with the name of a dynamically generated > card. > Please note that I would like to create a new variable, not to put the name > of the card inside the variable. This seems a little strange. Are you sure you aren’t suffering from an X/Y problem here. Perhaps explain what it is you are wanting to do with the variable? Cheers Monte ___ 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: Dinamyc variables.
Can you use value(cdname) ? Haven’t tried it, tho. Bill William Prothero http://es.earthednet.org > On Mar 18, 2018, at 7:08 PM, Heriberto Torrado via use-livecode >wrote: > > > Dear Livecode programmers, > > I am trying to create a new variable with the name of a dynamically generated > card. > Please note that I would like to create a new variable, not to put the name > of the card inside the variable. > > I would like to have something like this (PseudoCode) > > "Get the name of this card and create a variable with the name of the card." > > I searched the forum and the dictionary but I cannot find how to do that. > > Best regards/ Saludos cordiales/ Cordialement > > Heriberto Torrado > Chief Technology Officer (CTO) > Director de informática > Directeur informatique > > *NetDreams S.C.* > http://www.networkdreams.net > > ___ > 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
Dinamyc variables.
Dear Livecode programmers, I am trying to create a new variable with the name of a dynamically generated card. Please note that I would like to create a new variable, not to put the name of the card inside the variable. I would like to have something like this (PseudoCode) "Get the name of this card and create a variable with the name of the card." I searched the forum and the dictionary but I cannot find how to do that. Best regards/ Saludos cordiales/ Cordialement Heriberto Torrado Chief Technology Officer (CTO) Director de informática Directeur informatique *NetDreams S.C.* http://www.networkdreams.net ___ 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: Not sure what to do.....can I run this by you guys?
I think this depends on the base URL. If it's with a simple URL, there's no reason why an appended '#' parameter should cause a browser to request it fresh; as Mike says, it indicates scrolling to an anchor in the page. So it's perfectly reasonable for a smart browser - or a caching layer on the server, or in a proxy somewhere between you and the server - to use a cached version of that page ignoring the '#' suffix. With a simple URL, the better choice is to use "?" to append a parameter (I usually use 'the milliseconds' to guarantee that it's unique). Neither the browser nor any caching layer on the chain between the user agent and the source system should recognise it as the same URL, so this should force a fresh load. You can just use e.g. put "?" & the milliseconds after tURL or to be more explicit, name the parameter something e.g. put "?nocache=" & the milliseconds after tURL or put "?uniqueid=" & the milliseconds after tURL The only downside of using "?" is that if the URL may already includes parameters starting with "?" (which is what I mean by "not a simple URL"), you need to test for that and use "&" instead of "?" to indicate that this is an additional parameter; and if this is a dynamic request, which uses the 'query parameters' in the URL to decide what to return, you need to be sure that adding your parameter won't affect it! On 16/03/2018 13:31, Mike Bonner via use-livecode wrote: Another way around the cache problem is to use the #2 trick at the end of the url. Send each request with a pound and different number at the end of the url and it'll be seen as a new request thus doing an end run around the cache. Since it designates an inline anchor position on the page, it should have zero affect on the way the url functions. (unless things have changed, the associated anchor doesn't need to exist on the page) Thanks for the neat trick Charles. :) On Fri, Mar 16, 2018 at 7:24 AM, Tom Glod via use-livecode < use-livecode@lists.runrev.com> wrote: WowI'm impressedthats quite a hack Charles..I will study all this see how far I get. Thank you gentlemenyou are Rockstars!! On Fri, Mar 16, 2018 at 7:13 AM, Lagi Pittas via use-livecode < use-livecode@lists.runrev.com> wrote: Maybe not 100% reliable but https://stackoverflow.com/questions/1341089/using-meta- tags-to-turn-off-caching-in-all-browsers Regards Lagi On 16 March 2018 at 09:48, Charles Warwick via use-livecodewrote: Hi Tom, If the site you are trying to contact has CORS enabled appropriately, then you can do something like this... With the LiveCode browser widget, you can call JavaScript functions from LC script and have the JavaScript functions call LC handlers in return. JavaScript has the capability to perform asynchronous HTTP requests. You can create a HTML page that you automatically load up in the browser widget that has a small JavaScript function which you can call from LC with ‘do in widget’. All this function needs to do is issue an asynchronous HTTP call to the URL passed to it as a parameter and when it receives the data, return it back to your LC script by calling a nominated LC handler and passing the returned data as a parameter. The HTML page would look something like this: Javascript Async Test function httpGetAsync(theUrl) { var xmlHttp = new XMLHttpRequest(); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 && xmlHttp.status == 200) liveCode.httpRequestComplete(theUrl,
xmlHttp.responseText);
} xmlHttp.open("GET", theUrl, true); // true for asynchronous xmlHttp.send(null); } You can either load that from a file into the browser widget’s URL or set its htmlText property accordingly... Then in LC, make sure you register the httpRequestComplete handler so that the widget can call it: set the javascriptHandlers of widget “browser” to “httpRequestComplete” After that, add a httpRequestComplete handler to the card script to handle the returned data: on httpRequestComplete pUrl, pData — pUrl will be the URL requested — pData will be the data returned from the URL requested end httpRequestComplete Lastly, make your async requests do (“httpGetAsync(‘http://www.livecode.com’);” in widget “browser” Since the JavaScript in the browser widget is issuing the requests and sending the data back to LC, it doesn’t need to display anything related to it in the browser widget itself - it can be a blank canvas. Just be aware that the browser widget can cache URLs and there is no easy way (that I know of?) in LC to clear the browser’s cache...
Re: Stupid Question Again - Proportional Scaling
J. Landman Gay wrote: > On 3/18/18 12:41 PM, Richard Gaskin via use-livecode wrote: >> Exactly. The contents of the window can respond to the resizeStack >> message to be maximized within the window's content region without >> necessarily constraining the resize of the window's shape itself. >> > > Sure, but aesthetically it's ugly. That's a pretty sweeping dismissal of the countless apps that handle this problem that way. Some feel that many multi-window apps are ugly, in a world increasingly migrating to less fidgety UIs that keep everything in one window separated by panes (consider Premier vs iMovie). Personally, I'm disinclined to consider any solution "ugly" until I've seen the context of use. With this challenge of displaying an image in a window, if the common solution is truly ugly you've chosen the wrong neutral color. ;) Otherwise it's simply a design decision, as attractive or unattractive as you make it. Inventing novel interaction models that break from user expectations is not without some risk of its own. I won't go so far as to say it's necessarily ugly, but whenever I find myself considering a seldom-seen against-the-grain solution I first look at how others solve this and consider the necessity of inventing new ways of doing things as common as resizing windows. But in some rare cases, rare solutions may be the perfect fit. HH's code is very nice - does the job well, resizing very smoothly on my Ubuntu box. If it's what's needed, by all means use it. Without seeing the full app design, I have no opinion of whether any proposed solution could be considered attractive or otherwise. I'm just providing options for consideration. -- Richard Gaskin Fourth World Systems Software Design and Development for the Desktop, Mobile, and the Web ambassa...@fourthworld.comhttp://www.FourthWorld.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: A poor man's app updater
On 3/18/18 6:44 AM, Graham Samuel via use-livecode wrote: Now, here is the primitive bit: if the user selects the update option, he/she is invited to carry out the following sequence: - quit the current version (actually this can of course be done automatically via an “OK” button); I'd automate this. The fewer steps the user needs to follow, the better. - delete the current version using the facilities of the OS (just trash it from the Applications folder on a Mac, or use the Control Panel on Windows): there is no reliable way of doing this from within an LC standalone, AFAIK; I think you'd benefit from distributing some type of installer. When the user clicks the "OK" button, launch the URL of your web site where they can download it. Matthias' LC installer is ready (and the signing version is close to ready) so you could use that while staying within the LC environment. It does all the work for you. Users know how to use installers and many Windows users don't understand anything else. There are more users than you think who don't know how to find a file or where apps are stored on their drive. The OS and/or the installer will manage older versions so you don't have to. - download and run a special “Uninstall Helper” program that gets rid of the Working Stack in the writeable area, plus preference files and the like - I don’t see any way of making this happen automatically, since logically it needs to be done **after** the main program is deleted; Instead of a helper, I'd put some logic into your app itself. The working stack would have a custom property with its current version number. The standalone would check on launch if the working stack exists, and if so, if its custom version property matches the one it expects. If not, overwrite the existing one with the new one. The new one could either be downloaded from the internet on demand, or stored as a binary in a custom property of the standalone. Either way, overwriting is just a matter of putting the binary content into the existing stack file path on disk. - use the information given at the time of purchase to download the appropriate installer from the server; - reinstall the program and input the registration data from the original purchase. So, it sounds like you are already using an installer. If so, they're mostly done. I wouldn't remove the user registration file or preferences; unless it's changed there's no reason to make the user find their registration info again (and many will lose or misplace it, which will increase support requests.) The short summary: The user only has to click "OK", the app quits, and the user is taken to a web site to download the update installer. Once they launch that and run the install, everything else is automatic. On first launch, the app replaces any necessary files. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.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: Stupid Question Again - Proportional Scaling
Never tried to script that. It's *eventually* simple -- as always with LC. Here again a little bit optimised, changing the size also by the scrollWheel: -- 1. Don't use a resizestack handler -- 2. Set resizable of the stack to FALSE local l0, t0, ff on mouseDown put the long id of the target into tgt if not tgt begins with "image " then exit mouseDown put the left of this stack into l0 put the top of this stack into t0 -- if the image is always the same then ff can be computed once put the formattedHeight of tgt/the formattedWidth of tgt into ff put the right of tgt - the clickH into dx setRects dx,tgt end mouseDown on setRects dx,tgt if setRects is in the pendingmessages then exit setRects lock screen; lock messages put dx+the mouseH into w0 put ff*w0 into h0 set the rect of this stack to (l0,t0,l0+w0,t0+h0) set the rect of tgt to (0,0,w0,h0) if the mouse is down --> TMHO, polling the mouse is here OK then send "setRects dx,tgt" to me in 8 millisecs --> 8-16 millisecs end setRects on rawkeydown k put the long id of the target into tgt if not tgt begins with "image " then pass rawkeydown lock screen; lock messages put the left of this stack into l0 put the top of this stack into t0 switch k case 65308; put 16 into d; break -- scrollwheel backward case 65309; put -16 into d; break -- scrollwheel forward end switch put d+the width of tgt into w0 -- if the image is always the same then this becomes: put w0*ff into h0 put w0*the formattedHeight of tgt/the formattedWidth of tgt into h0 set the rect of this stack to (l0,t0,l0+w0,t0+h0) set the rect of tgt to (0,0,w0,h0) end rawkeydown ___ 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: Stupid Question Again - Proportional Scaling
Very nice. :) On 3/18/18 1:29 PM, hh via use-livecode wrote: @Peter You could try the following (doesn't need a shiftkey down). Put the following into the stack's script and drag anywhere the image to resize it and the stack proportionally (topLeft fixed). -- 1. Don't use any resize stack handler -- 2. set resizable of the stack to FALSE local l0, t0, ew, eh on mouseDown put the long id of the target into tgt if not tgt begins with "image " then exit mouseDown put the left of this stack into l0 put the top of this stack into t0 put the formattedWidth of tgt into ew put the formattedHeight of tgt into eh put the right of tgt - the clickH into dx setRects dx,tgt end mouseDown on setRects dx,tgt lock screen; lock messages put dx+the mouseH into w0; put eh/ew * w0 into h0 set the rect of this stack to (l0,t0,l0+w0,t0+h0) set the rect of tgt to (0,0,w0,h0) if the mouse is down --> TMHO, polling the mouse is here OK then send "setRects dx,tgt" to me in 8 millisecs --> 8-16 millisecs end setRects -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.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: Stupid Question Again - Proportional Scaling
On 3/18/18 12:41 PM, Richard Gaskin via use-livecode wrote: Exactly. The contents of the window can respond to the resizeStack message to be maximized within the window's content region without necessarily constraining the resize of the window's shape itself. Sure, but aesthetically it's ugly. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.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: Stupid Question Again - Proportional Scaling
@Peter You could try the following (doesn't need a shiftkey down). Put the following into the stack's script and drag anywhere the image to resize it and the stack proportionally (topLeft fixed). -- 1. Don't use any resize stack handler -- 2. set resizable of the stack to FALSE local l0, t0, ew, eh on mouseDown put the long id of the target into tgt if not tgt begins with "image " then exit mouseDown put the left of this stack into l0 put the top of this stack into t0 put the formattedWidth of tgt into ew put the formattedHeight of tgt into eh put the right of tgt - the clickH into dx setRects dx,tgt end mouseDown on setRects dx,tgt lock screen; lock messages put dx+the mouseH into w0; put eh/ew * w0 into h0 set the rect of this stack to (l0,t0,l0+w0,t0+h0) set the rect of tgt to (0,0,w0,h0) if the mouse is down --> TMHO, polling the mouse is here OK then send "setRects dx,tgt" to me in 8 millisecs --> 8-16 millisecs end setRects ___ 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: Stupid Question Again - Proportional Scaling
Exactly. The contents of the window can respond to the resizeStack message to be maximized within the window's content region without necessarily constraining the resize of the window's shape itself. -- Richard Gaskin Fourth World Systems J. Landman Gay wrote: > I think he wants to use window resizing as an automatic zoom, like > a magnifying glass. Google Maps does this with + and - buttons but > doesn't resize the window content to fit. > -- > Jacqueline Landman Gay | jacque at hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com > > On March 18, 2018 11:58:55 AM Richard Gaskin via use-livecode wrote: > > But if maintaining the image within the window to maximally fit > the window's rect while maintaining its proportions is the goal, > a suitably neutral color fil ___ 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: Stupid Question Again - Proportional Scaling
I think he wants to use window resizing as an automatic zoom, like a magnifying glass. Google Maps does this with + and - buttons but doesn't resize the window content to fit. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On March 18, 2018 11:58:55 AM Richard Gaskin via use-livecodewrote: But if maintaining the image within the window to maximally fit the window's rect while maintaining its proportions is the goal, a suitably neutral color filling the card would seem to suffice as at least as well as whatever clutter may be behind the window outside of its bounds, no? ___ 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: Stupid Question Again - Proportional Scaling
Peter Reid wrote: >> I have a sub-stack that contains an image. I want the user to be >> able to drag the corners and edges of the sub-stack window to make >> the window and its image larger or smaller, but the window and >> image must maintain their original aspect ratio ? no stretching, >> no empty borders etc. ... > It's a pity that this proved a bit more convoluted than perhaps it > should have been. How often do we see apps that constrain window resizing? There are probably a few, and now one more. But it's not common, and apparently what few OS APIs may be provided for such hooks aren't easy to access or at least often used, or we might see more of it. LC tends to provide easy access to common UI objects and behaviors that the OSes make easy to use. When we pursue and edge case is where things get tricky. If your solution is working well for what you need then it's probably not worth revisiting the design. But one thing I've learned from my customers is that they sometimes resize windows for reasons I didn't anticipate. As designers, we tend to think of resizing a window as something we do to view the window's content. In that use case, if the content is square there's certainly no harm, and perhaps some benefit, in constraining the user's resize action to keep the window square as well. But I've found sometimes users resize windows to remove visual clutter from their desktop. This can result in a window with empty space along at least two edges if the content within it has no sensible way to make full use of the window's content region. Yet in some cases, I have to ask: why not let the user define their own preferred rect for the window, and I'll do my job of making the interior fit as usably and attractively as I can within whatever the user wants to do. Of course I have no idea what you're building, and there may be some excellent reasons to constrain the user's resize action. But if maintaining the image within the window to maximally fit the window's rect while maintaining its proportions is the goal, a suitably neutral color filling the card would seem to suffice as at least as well as whatever clutter may be behind the window outside of its bounds, no? Certainly simpler to write. :) When I find myself working hard against the grain of what OSes suggest for common UI elements, sometimes it helps me pause and reconsider *why* I'm doing that, to see if there's a more with-the-grain approach the maintains consistency for the user experience. -- Richard Gaskin Fourth World Systems Software Design and Development for the Desktop, Mobile, and the Web ambassa...@fourthworld.comhttp://www.FourthWorld.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: Stupid Question Again - Proportional Scaling
Hi Jacqueline & hh Thanks for the feedback. After I sent my query I came across a relevant response in the forum: https://forums.livecode.com/viewtopic.php?t=30385 In particular MaxV's response which is very similar to yours Jacqueline. When I tried this I too realised that I'd need a "send" to tidy-up afterwards! Here's my complete code (all in the stack script): local tAdjustingStack on resizeStack if not tAdjustingStack then put the top of image "myImage" into tTop put the left of image "myImage" into tLeft put the realSize of image "MyImage" into tSize put the startsizeStack of image "myImage" into tSS set the width of image "myImage" to (item 1 of tSize * the width of this stack / item 1 of tSS ) set the height of image "myImage" to (item 2 of tSize * the height of this stack / item 2 of tSS ) if the width of image "myImage" > the height of image "myImage" then set the width of image "myImage" to (item 1 of tSize / item 2 of tSize * the height of image "myImage") else set the height of image "myImage" to (item 2 of tSize / item 1 of tSize * the width of image "myImage") end if set the top of image "myImage" to tTop set the left of image "myImage" to tLeft end if pass resizeStack end resizeStack on tidyUpAfterwards put the topLeft of this stack into tTL if the width of this stack <> the width of image "myImage" then lock screen put true into tAdjustingStack set the width of this stack to the width of image "myImage" set the topLeft of this stack to tTL end if if the height of this stack <> the height of image "myImage" then lock screen put true into tAdjustingStack set the height of this stack to the height of image "myImage" set the topLeft of this stack to tTL end if unlock screen put false into tAdjustingStack send "tidyUpAfterwards" to me in 5 ticks end tidyUpAfterwards on preOpenStack put false into tAdjustingStack set the realsize of image "myImage" to (the width of image "myImage", the height of image "myImage") set the startSizeStack of image "myImage" to (the width of this stack, the height of this stack) send "tidyUpAfterwards" to me in 5 ticks end preOpenStack It's a pity that this proved a bit more convoluted than perhaps it should have been. Thanks again. Peter -- Peter Reid 71 Leconfield Road, Loughborough, Leics. LE11 3SP, UK Tel: +44 (0)1509 268843 Mobile/Cell: 07778 632533 Email: pe...@reidit.net > Message: 1 > Date: Sat, 17 Mar 2018 17:14:36 + > From: Peter Reid> To: use-livecode@lists.runrev.com > Subject: Stupid Question Again - Proportional Scaling > Message-ID: <6de66fac-c1bc-4f32-8186-b76d769d7...@reidit.co.uk> > Content-Type: text/plain; charset=utf-8 > > I know it's possible and I know it's simple really, but I can't remember > it/figure it out! > > I have a sub-stack that contains an image. I want the user to be able to > drag the corners and edges of the sub-stack window to make the window and its > image larger or smaller, but the window and image must maintain their > original aspect ratio ? no stretching, no empty borders etc. I've tried the > following in the card script: > > global gImageRatio > > on resizeStack pNewWidth, pNewHeight, pOldWidth, pOldHeight > propSizeImage "coinSet", gImageRatio > pass resizeStack > end resizeStack > > on propSizeImage pImageName, @pImageRatio > put the width of this stack into propWidth > set the width of image pImageName to propWidth > put propWidth div pImageRatio into propHeight > put the width of image pImageName into tWidth > put the height of image pImageName into tHeight > if propHeight > tHeight then > put tHeight into propH > put tHeight * pImageRatio into propW > else if propHeight < tHeight then > put propHeight into propH > put propH * pImageRatio into propW > else > put tWidth into propW > put tHeight into propH > end if > set the height of image pImageName to propH > set the width of image pImageName to propW > set the height of this stack to propH > set the width of this stack to propW > set the topLeft of image pImageName to 0,0 > end propSizeImage > > with the following initialisation in the stack script: > > global gImageRatio > > on preOpenStack > put the width of image "CoinSet" / the height of image "CoinSet" into > gImageRatio > end preOpenStack > > I'm probably missing something obvious, but can anyone help please?! > > Thanks > > Peter > -- > Peter Reid > Loughborough, UK > > -- > > Message: 10 > Date: Sun, 18 Mar 2018 01:04:19 -0500 > From: "J. Landman Gay" > To: How to use LiveCode > Subject: Re: Stupid Question Again - Proportional Scaling > Message-ID: <82c5cec5-1b64-6690-60e0-dfce7a178...@hyperactivesw.com> >
A poor man's app updater
I’ve written before about trying to include within a desktop app a check for updates, and a user-driven update action: I’ve looked a bit at Trevor’s incorporation of such a scheme in Levure, and independently at Sparkle (only for Macs), but I have never reached an encapsulated solution that works without leaving my LiveCode comfort zone. I just thought people might like to know what I’ve actually done to solve the problem - it’s primitive beyond belief to anyone who is happy to go outside the LCCZ, but it’s all I can do with very limited resources of intellect and time. I’d love to hear of a better solution (there must be one). The app in question (only desktop right now) is a classic splash screen design, with the splash providing access to a licensing gateway and a script library, and everything else in another mainstack (let’s call it the Working Stack), which is not compiled but rather included as a file in the installed package as a template - a copy is made in a writeable area for working purposes when the program starts up for the first time. The app is installed via a web site, so there is a server we can use for stuff such as installers. This server includes a tiny text file which records the latest version number of the app. When the app is initialised, it compares a version number built in to the Working Stack with the version number in the file on the server - of course if the program isn’t connected to the internet, this doesn’t take place. If the comparison shows that there is a more recent version, the user is warned via a dialog and asked whether to ignore for now, ignore this particular update permanently, or to install the update. The “ignore this version” option updates a property in the Working Stack so the same warning isn’t repeated next time. Now, here is the primitive bit: if the user selects the update option, he/she is invited to carry out the following sequence: - quit the current version (actually this can of course be done automatically via an “OK” button); - delete the current version using the facilities of the OS (just trash it from the Applications folder on a Mac, or use the Control Panel on Windows): there is no reliable way of doing this from within an LC standalone, AFAIK; - download and run a special “Uninstall Helper” program that gets rid of the Working Stack in the writeable area, plus preference files and the like - I don’t see any way of making this happen automatically, since logically it needs to be done **after** the main program is deleted; - use the information given at the time of purchase to download the appropriate installer from the server; - reinstall the program and input the registration data from the original purchase. Clunky ain’t in it, but so far I have not thought of a better solution. Graham ___ 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: Stupid Question Again - Proportional Scaling
On 3/18/18 1:26 AM, hh via use-livecode wrote: [Sorry lost above half of my answer.] You could try the following with user's interaction: For proportional resizing a stack window hold the shiftkey down when resizing. And in card's script add on resizestack w,h set rect of img 1 to (0,0,w,h) end resizestack If Peter doesn't mind instructing his users to use the shift key, this would be a good solution. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.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: Stupid Question Again - Proportional Scaling
[Sorry lost above half of my answer.] You could try the following with user's interaction: For proportional resizing a stack window hold the shiftkey down when resizing. And in card's script add on resizestack w,h set rect of img 1 to (0,0,w,h) end resizestack ___ 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: Stupid Question Again - Proportional Scaling
For proportional resizing a stack window hold the shiftkey down when resizing. ___ 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: Stupid Question Again - Proportional Scaling
On 3/17/18 12:14 PM, Peter Reid via use-livecode wrote: I have a sub-stack that contains an image. I want the user to be able to drag the corners and edges of the sub-stack window to make the window and its image larger or smaller, but the window and image must maintain their original aspect ratio – no stretching, no empty borders etc. I wish we had a way to determine when a stack resize is finished. The best I could do is run a "send" loop to check the mouse state. Maybe someone else knows a better way. It doesn't seem possible to change the stack size within a resizeStack handler, which makes sense, so the adjustment has to be done afterward. I think this sort of does what you want, but there's a "snap" at the end when the stack adjusts to the new image size. It accomodates images of any orientation. constant kImgName = "coinSet" on resizeStack pNewWidth, pNewHeight, pOldWidth, pOldHeight put the formattedWidth of img kImgName into tFWidth put the formattedHeight of img kImgName into tFHeight if tFHeight > tFWidth then resizeToHeight tFHeight,tFWidth else resizeToWidth tFHeight,tFWidth end if checkResizeDone end resizeStack on resizeToHeight tOrigImgHeight,tOrigImgWidth put the height of this cd/tOrigImgHeight into tRatio put (tOrigImgWidth * tRatio) into tNewWidth put (tOrigImgHeight * tRatio) into tNewHeight set the rect of img kImgName to 0,0,tNewWidth,tNewHeight end resizeToHeight on resizeToWidth tOrigImgHeight,tOrigImgWidth put the width of this cd into tW put tW/tOrigImgWidth into tRatio put (tOrigImgWidth * tRatio) into tNewWidth put (tOrigImgHeight * tRatio) into tNewHeight set the rect of img kImgName to 0,0,tNewWidth,tNewHeight end resizeToWidth on checkResizeDone if the mouse is up then set the rect of this stack to \ (globalLoc(the topleft of img kImgName) & globalLoc(the bottomright of img kImgName)) else send "checkResizeDone" to me in 100 milliseconds end if end checkResizeDone -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.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