Re: getProp puzzle
Thanks to Mike Bonner for his helpful suggestions. Stack A and Stack B are both mainStacks. Further tests seem to confirm this rule: A setProp or getProp handler in the script of stack A cannot be invoked for a target in Stack B UNLESS we have "started using" stack A (even if Stack A is the frontmost stack). On first thought this seems a little strange to me. For function or command handlers, we only need to "start using" a stack if we want to call its script's handlers when that stack is not frontmost; and when we "start using" it those handlers are just as accessible as the handlers in the frontmost stack's script. But for getProp and setProp handlers, the script of the frontmost stack and the script of a stack we have started using do not have the same efficacy. Perhaps the logic is clearer if Stack B has its own getProp myProp handler whose script differs from Stack A's getProp myProp handler. In that case it probably makes sense for the virtual property of an object in Stack B to follow the getProp rules of its own stack, when called from Stack A (even though a function handler in Stack A that queries properties of Stack B, invoked while Stack A is frontmost, would take priority over a function handler in Stack B). David Epstein ___ 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
Save Stack very slow in Windows 7
I have for years successfully run a set of stacks using LiveCode 5.5.3 in Windows 7. Recently certain operations have become painfully slow (Windows says "not responding" for 2 minutes or so, but eventually does respond and the operation is completed). Setting some breakpoints to investigate, I discovered that the bottleneck commands are 2 simple "Save stack x" statements. The stacks being saved are 2.3 and 0.3 megabytes. The same stacks run without problem using LiveCode 5.5 on Mac OSX. And until recently they ran well on Windows 7. Has anyone had this experience, or an idea for a remedy? Thanks very much. David Epstein ___ 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
Script-controlled export of animation from Livecode?
Is there a way of scripting the export of an animation constructed in Livecode to some standard video file format (avi, mp4, etc.)?Alternatively, is there a way of scripting the creation of a standalone Livecode file that contains the animation? David Epstein ___ 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
Field loses its identity as a target
I have encountered a bizarre problem that occurs in a somewhat complicated context. I wonder if anyone has experienced anything similar. In short: when I click a locked field on one occasion “the long id of the target” returns the expected result; but when I click on it subsequently “the long id of the target” returns the long id of the card instead. Details: To allow the user to edit certain properties of a card, I copy a “dropPanel” group to that card, allowing the user the adjust various controls on that group whose settings I use to adjust the appropriate properties of the card. I want the “dropPanel” to disappear if the user clicks outside of it, so I insert a frontScript that, on mousedown, checks whether the targeted object is part of the dropPanel group. This has worked well for a long time, but I now encounter this problem. Several of the controls in one of my dropPanels are locked fields (call one of these “A”). The first time one is clicked on, it operates as expected. But on subsequent clicks my dropPanel gets deleted. When I debug my frontScript, I see that on the first occasion the long id of the target is recognized as “field id x of group id y of… etc.”—and my script confirms that this control is indeed part of the dropPanel group and so clicking it should not delete that group. On subsequent clicks, however, that same target is interpreted as “card id x… etc.”, which of course is not a member of the group, and this causes my group to be deleted. Why does my field “A” lose its identity between these two clicks? When working properly, the click on the locked field causes a different group to be created adjacent to it, allowing the user to select one or more things from a list field (“B”), and then click a Cancel or OK button. (This subgroup does not have the auto-close feature). The OK button of that subgroup sets a custom property of and sets the text of field “A”—neither of which seems like it should cause that main field no longer to be recognized as a target. And the Cancel button does nothing at all to the main field. OK and Cancel both delete the subgroup that includes them and Field “B”. Testing various combinations of events, I learned that the problem arises whenever the user selects something in the list field “B”—regardless of whether he clicks OK or Cancel—but there is no problem if he never makes a selection in that list field “B”—again, regardless of whether he clicks OK or Cancel. (And if toggleHilites is true for field “B” the problem arises even if the user removes a selection he initially made). So it seems as if nothing my scripts do to Field “A” is associated with its losing its identity; it is rather the fact that one or more lines have been selected in a different field (the list field “B”). Two more symptoms - clicking on a second locked field that operates in the same way also causes the problem; i.e., two clicks on one field or one each on two fields makes no difference. - Field A does not seem to lose its identity until the subgroup containing Field B is deleted. If a wayward user repeatedly clicks on Field A and makes a selection in Field B without clicking OK or Cancel, the script as written will keep creating new subgroups with new Field B’s. Only after the user has repeatedly clicked OK or Cancel to remove the duplicative series of subgroups will a click on Field A cause the problem. Thanks very much for any insights about this. David Epstein ___ 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: Insertion point problems
Thanks to Bernd for the simplest solution to my practical problem. If we "go to" Stack A "the selectedChunk" will mean "the selectedChunk in stack A". But, as he notes, preservation of the prior selection depends on certain conditions (more on this below). One anomaly is that "the selectedChunk" seems to preserve its value when we are NOT in Stack A--but ONLY if it was (let's call it) a "selectedRun" and not just an insertion point; and ONLY if we are not in and have not navigated to some stack with an unlocked field. (It turns out that whether Stack B is a palette, and my "set the default stack to StackA" command, are both irrelevant). This anomaly may have no practical importance, given Bernd's approach (and the option others have explained to store our own record of the selectedChunk). But one other aspect of Bernd's approach is surprising. When we "go to" a stack (either by script or by clicking on the title bar), the restoration of its prior selection varies as follows: 1. if it was a selectedRun, and we have not since been to a stack with an unlocked field, the selectedChunk remains that run. 2. If it was a selectedRun and we have been to a stack with an unlocked field, the selectedChunk becomes an insertion point just after the selectedRun. (!) 2. If it was an insertion point, that insertion point seems to be restored as the selectedChunk--EVEN IF we have visited a stack with an unlocked field. David Epstein ___ 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: Insertion point problems
Thanks to Craig Newman and Bob Sneidar. Unless I have misunderstood them, which is possible, I think I have not clearly enough explained my problem. I want a menu button in a palette to paste the clipboard's contents to the topStack at the selectedChunk. This works if the selectedChunk actually includes some hilited text ("char 1 to 4..."), but not if the selectedChunk is an insertion point ("char 4 to 3..."). In the second case, but not in the first, the insertion point disappears and the selectedChunk property loses its value when a palette button is pressed, so the paste fails. I recall that people resort to various ways of storing the selectedChunk, but am puzzled by this inconsistency between the first and second cases. My second question is whether LiveCode 7.01 only rarely shows the blinking insertion point that it should be showing whenever the current selection is before or after, or between consecutive, characters of an unlocked field. This is my experience on Mac Yosemite, but it seems like such an obvious and important flaw that I would think others would have complained. Many thanks. David Epstein ___ 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
Resolution of PDF in player object
I'm quite sure that on my PowerPC Mac a high resolution PDF in a LiveCode Player object was displayed not like a bitmap but just like it was in Preview or Acrobat. I assume that LiveCode is tapping into QuickTime to render PDFs, so why is the PDF file's resolution degraded? Is there any prospect that this will be corrected in future releases? I have not tried revBrowser to display PDFs, so am not sure how its resolution works; but as I understand it revBrowser does not let us view pages other than the first of a multi-page PDF. Regards, David Epstein This probably doesn¹t help you, but in years gone by, my experience when using a player to view a PDF resulted in the content being displayed as a bitmap image, regardless of the type of content. So enlarging beyond 100% would often appear pixelated. I never encountered a player-viewed PDF displayed as anything BUT a bitmap. But this was all QuickTime stuff, so things may have changed more recently. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/26/15, 4:09 PM, "David Epstein" < dfepstein at comcast.net > wrote: > In the past, when I displayed a PDF in a player object on my PowerPC Mac > Mini, I could scale it to, say, 1.5x the formattedWidth and > formattedHeight, and see it beautifully displayed at full resolution. On > my newer MacBook Air and iMac this is not true; the PDF looks terrible > when scaled to anything other than 100%. And if I print it, even at > 100%, I get screen quality, i.e., very bad, resolution. Has something > changed? Can LiveCode not display or print PDFs at full resolution on an > Intel Mac? > > David Epstein ___ 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
Can a script preempt substack name conflicts?
Thanks for this prudent advice. The case I am contemplating would involve a user creating new substacks to hold content. While I can make sure each substack created by my program gets a unique name, if a file created on one machine is moved to another machine there is some chance of a conflict (reduced but not absolutely eliminated if I went to great lengths, like embedding in each substack's name "the ticks" at creation time). I think I can work around this IF the "substack name conflict problem" is only a problem for the LiveCode UI. In other words if in my own scripts I am careful always to refer to a substack by its long name, am I safe even if two substacks have the same short name? David Epstein -- On 5/14/2015 8:16 PM, David Epstein wrote: > With stack A already open, I open stack B and get a alert like this: > > "A stack "" in file is already in > > memory. The Revolution UI does not distinguish stacks which have > identical names, so editing these stack files while both are in > memory could result in data loss.” > > Is it possible by script to intercept the message that generates this > alert, and rename either the substack that is already in memory or > the substack of the stack I am trying to open, so as to avoid both > the alert and the risk of data loss? My impression is that if I try > to learn the substack names of a file I will already be loading that > file into memory, and it will be too late to head off the alert. I don't think it's worth it to try and hack the IDE to get around the warning. You won't lose any data unless you make changes to one of the duplicate stacks and then try to save it. So what I usually do is note the name of the problem stack and quit LC. Then I restart, open the stack I want to change, and temporarily alter its name in the property inspector. I don't save it. Then open the second stack, do whatever work is necessary, and then close and remove it from memory. After that you can change the name of the original stack back to what it was again. When I know in advance I'm going to open duplicate-named stacks, I just change the first stack temporarily before opening the second one. It saves time. -- Jacqueline Landman Gay | jacque at 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: What is driving the MB of a stack?
Thanks to Scott Rossi and Richard Gaskin for their suggestions, which led me to the problem (large block of data stored as a custom property of a substack). While poking around, I noticed that many but not most controls and groups, when I get "the customPropertySets" of them, return the value "cREVGeneral", although when I look for this in the property inspector I do not find it. What causes this custom property set to be created for some but not all controls, and (assuming it is really there), is there any harm in removing it? David Epstein ___ 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 driving the MB of a stack?
A stack I have gradually improved over several years now occupies 4 MB on disk, whereas for a long time it was more like 500 KB. Is there some way to diagnose what elements are causing this? I'd like to generate a list of all of the stack's substacks, cards, fields, images, scripts, etc., and see the amount of stack space each is occupying. David Epstein ___ 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: Vector export?
For high resolution export of vectors: open printing to pdf David Epstein ___ 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: Speed testing: Fastest search method
compared 3 methods of stripping lines from a variable, and concluded: If memory is an issue, then Method 2 is best If memory is not an issue, then Method 3 is best 3 questions: 1. Is there a good way to determine ahead of time whether memory is an issue? When I start the handler I can find out how big tVar is, but how do I find out how much memory is available? 2. Does this step in all 3 handlers -- put fld "Data" into tVar -- itself use up memory? If fld "Data" is occupying a gigabyte of RAM, does writing it to tVar use another gigabyte? 3. Method #2 appears to me to violate the rule against modifying the variable to which you are applying "repeat for each": #2: on mouseUp set the cursor to watch put the long seconds into tStart put fld "data" into tVar repeat for each line L in tVar add 1 to x if L="" then put "" into line x of tVar -- RIGHT HERE, WE'RE MODIFYING tVar! end if end repeat put tVar into fld "output" put the long seconds - tStart into fld "timer2" end mouseUp Have I misunderstood that rule? Many thanks. David Epstein ___ 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
Achieving highest resolution output
I hope someone can help me understand printing resolution. If I use LiveCode to generate a PDF that will be printed at 300 dpi, how do I achieve the best output? For vectors, I assume that it makes no difference at what scale I compose the picture. (Is that true?) But suppose I want to print a bit map 1 inch wide. I would tell LiveCode to "print into rect 0,72,0,72" (for example) to indicate that it should be 1 inch square. Will this work better if the original bit map is 300 pixels wide (to match the intended 300 dpi resolution)? Or if it's a multiple of 72, like 288, pixels wide? Further suppose that I want some 9 point text on my 1 inch square. For the case where I'm printing 288 pixels of width into a rectangle that is 72 wide, it seems clear I can compose with 36 point text. But if I'm printing 300 pixels into that 72 wide rectangle, will 36 be slightly too small? Should I use 37 point text? Is composing at 300 pixels better for the bit map quality but 288 pixels better for getting the right the text size? Thanks for any guidance. David Epstein ___ 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
numberFormat question
I am trying to set the numberFormat so that calculation is precise enough for the situation. Since I don't know ahead of time how many decimal places will be used, I wrote a function that I hoped would adjust things as necessary. But when this function is called with parameters m = 1.09131 and n = .001 and k = 1, it returns 1.09131 rather than 1.0913101. The last couple of lines were added for testing, and the debugger shows that the numberFormat is being set correctly but that the truncated value is put into hold. Can anybody see what is going wrong? Many thanks. David Epstein function preciseEnough m,n,k -- return the value m + k*n -- default numberFormat shows up to 6 decimal places -- If m, n, or k has more than that precision, this function sets the numberFormat with a margin of safety -- before returning the answer put length(m) - offset(".",m) into aPlaces put length(n) - offset(".",n) into bPlaces put length(k) - offset(".",k) into cPlaces put the numberFormat into myString if max(aPlaces,bPlaces,cPlaces) + 4 > length(myString) then get myString & "" set the numberFormat to it end if put the numberFormat into nf put m + k*n into hold return hold end preciseEnough ___ 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: Finding matched parentheses
Testing for speed, I found that my July 29 function--the one that uses lineDelimiter and itemDelimiter--is thwarted when two parens appear as consecutive characters, and gives the wrong answer in that case. Sorry about that. I may not have correctly implemented Peter Haworth's Regex string, but I get wrong answers from writing the function as below -- offsetPair6("(a(a))") returns "2 5". function offsetPair6 str put "\?>[^()]+)|(?R))*)\)" into tRegex get matchChunk(str,tRegex,tStart,tEnd) return tStart && tEnd end offsetPair6 As far as I know the function I posted July 26 works correctly. David Epstein ___ 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: Finding matched parentheses
On second thought : function offsetPair a,b,str -- str cannot be more than one line -- returns first instance of char a && "matching" instance of char b in str, or 0 if no a or empty if no match put offset(a,str) into ca if ca = 0 then return 0 put numToChar(7) into char 1 to ca of str set lineDelimiter to a set itemDelimiter to b repeat with i = 1 to the number of items in str if i = the number of lines in item 1 to i of str then return ca && ca+length(item 1 to i of str) end repeat return empty end offsetPair ___ 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: How Many Pages are in a PDF?
1 + (the duration of player myPlayerName)/ 75 David Epstein ___ 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: Page 2 of a PDF
I think this will work on a Mac: on pdfToPage n -- show page n of the pdf in player 1 put round(n) into n -- n as passed by scrollBarDrag doesn't seem to -- always be an integer put (n-1)*75 into t set the playSelection of player 1 to true set the startTime of player 1 to t set the endTime of player 1 to t+1 play step player 1 end pdfToPage Ray Horsley wrote using a player object I can't control from a script which page of the PDF the player object is displaying. David Epstein ___ 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
Opening a stack crashes RevMedia, and message box won't work
I have encountered two strange new symptoms using RevMedia 2.9 on a Windows 7 machine. I do not know if they are related. 1. I often write stacks on my Macintosh with Metacard 2.0, then run them successfully in Windows with RevMedia 2.9. But for a new stack that works fine on my Mac, opening it in RevMedia causes Rev to quit, with no warning or advice. I tried opening the same stack with a script "lock messages; go card 1 of stack x", but the result was the same. To try to troubleshoot, in a separate stack, I put the script of stack x into a field; edited the script to comment out the "openStack" and "resumeStack" handlers (the only ones that I see that would execute when the stack is opened); set the script of stack x to the revised version; and saved stack x. (Somewhat to my surprise, this all seemed to work, since I thought that such commands mean that Rev loads the stack into memory; so why no crash in this case?). (Card 1 of stack x has no script). How can I diagnose the problem? 2. When I try to execute any command in the Message box, I get an error message, indicating that Rev has been tripped up on this line: do "global" && the globalNames of the "revExecuteMessage" handler in the script of field "Message Field" of stack "Message Box." Any suggestions? Many thanks. David Epstein ___ 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
Pasting to a field from Internet Explorer 8
I have for a long time pasted text copied from other programs to a field by using a script like "set the htmlText of [destination chunk] to clipboardData["html"] After a recent upgrade to Windows 7 and Internet Explorer 8 this does not work for text copied from Internet Explorer; pasting yields a few commas or dashes instead. If I first paste that text to Notepad, then select and copy it again, my script pastes correctly. [this is in Rev Media 2.9] Does anyone have the same problem or a remedy? Many thanks. David Epstein ___ 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
Counting days from a past date
I want to count the number of days between some past date and today. I tried this (using Rev 3.0): on mouseUp put "March 12, 2012" into a convert a to seconds -- LC should understand this as midnight get the date convert it to seconds -- should also be midnight put (it - a)/(24*3600) -- elapsed seconds divided by seconds per day end mouseUp This yields "57", which seems right. But if I change the first line to put "March 11, 2012" into a the result is not an integer: 57.958333 Why would that be? David Epstein ___ 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: [Bug 10199] New: Office Excel Clipboard Translation
Perhaps relevant to this thread is this problem I have found while copying in Excel, pasting in LC (actually an older version of Rev): When you zoom Excel's display, the number formatting changes. E.g., "442593" becomes "4E+05" if space is too tight, or "" if space is really tight. This is not a problem while working in Excel, as the underlying data remains the same. But contrary to my expectation, if you select cells, copy, and paste to Rev you do not get those underlying values. You get only the displayed text. "" at least tells you something is amiss; but "4E+05" is an unannounced but severe amendment from "442593." If you paste instead to Notepad, you do get the underlying values If you export the Excel sheet as tab delimited text, the results are also strange: in my test, values shown in scientific notation were exported as integers; but values displayed as "" were exported in scientific notation. David Epstein ___ 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: printing rotated text
Ben Rubenstein asked Can I just confirm that there's no way to print high-quality rotated text from LC? Create the field with fontsize 4 times what your want, take a snapshot, rotate, paste, and reduce the image's width and length to 25% of the original . David Epstein ___ 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