virtual height, parsing text and some bug

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
trevix
Posts: 1112
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

virtual height, parsing text and some bug

Post by trevix »

Hi and thanks for answering
(rev 2.9 on OSX)
question 1:
if I modify trought script the virtual height of the card, the minimum height of a resizable stack does not change according to it. I think it should because in this way the user gets a strange behaviour when he try to resize...

question 2:
is there a fast text parsing command ? (for example to take off extra spaces on a space delimited list). Now I am doing a repeat with word extraction...

Bug 1:
sometime a long script window keep scrolling by itself on mouse movements, as if I were keeping the mouse down on it (but I am not). It is rather annoying...
Bug 2:
On script debug mode, too often the breakpoints are ignored by Rev. The script stops only if you put them on place again before running the script.

Hope someone can tell me if these are real bugs or my faults..
Regards
Trevix
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10104
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: virtual height, parsing text and some bug

Post by FourthWorld »

trevix wrote:Hi and thanks for answering
(rev 2.9 on OSX)
question 1:
if I modify trought script the virtual height of the card, the minimum height of a resizable stack does not change according to it. I think it should because in this way the user gets a strange behaviour when he try to resize...
I'm not sure I understand. Could I trouble you to elaborate?
question 2:
is there a fast text parsing command ? (for example to take off extra spaces on a space delimited list). Now I am doing a repeat with word extraction...
To trim the leading and trailing spaces from a string you can use a function like this:

function TrimSpaces s
return word 1 to (the number of words of s) of s
end TrimSpaces

[quote[Bug 1:
sometime a long script window keep scrolling by itself on mouse movements, as if I were keeping the mouse down on it (but I am not). It is rather annoying...
Bug 2:
On script debug mode, too often the breakpoints are ignored by Rev. The script stops only if you put them on place again before running the script.[/quote]I believe both are known bugs, but I haven't looked into the Rev Qualitty Control Center to verify. You can search the RQCC at:
http://quality.runrev.com/qacenter/
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
trevix
Posts: 1112
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

virtual height, parsing text and some bug

Post by trevix »

Question 1:
I have a resizable stack (both handling a "resizeStack" script and with automatic geometry) where, at the bottom, there is a fld that I want to show or hide having the heigth added to the stack changed.
I thought it was convenient to just change the Virtual height of the card :

Code: Select all

set the cREVGeneral["virtualHeight"] of card 1 of stack "X"  to 35
(hide)

Code: Select all

set the cREVGeneral["virtualHeight"] of card 1 of stack "X"  to 0
(show)

Of course I also have a minimum height for the stack, so that it does not get too small
Example:
The min height is 574
The virtual height of the card (cREVGeneral["virtualHeight"] is 35, hiding the fld) (by the way...height and width on Inspector are mixed up).
The height of the stack is 574
Then..I want to show the fld (add 0 to cREVGeneral["virtualHeight"])
The height of the stack becomes 609
If the user try then to reduce the height of the stack and then I add again 35 to virtual height (hiding the fld), the stack will be 539, smaller then the min height.

Hard to explain. The point is that I think the min height should keep trace of the added virtual height

question 2:
is there a way to parse also spaces in between (so that there is only 1 space between words) ?

Thanks for your time
Trevix
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10104
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Post by FourthWorld »

I'm unfamiliar with the concept of "virtualHeight", and have not delved into Rev's properties deeply enough to guess what it may do with such a thing.

What's the goal you want to achieve with that?

As for spaces, there are a couple ways to do that - here's one:

function TrimExtraSpaces s
put empty into tReturnVal
repeat for each word tWord in s
put tWord &space after tReturnVal
end repeat
delete last char of tReturnVal -- trailing space
return tReturnVal
end TrimExtraSpaces
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
trevix
Posts: 1112
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Post by trevix »

I resolved the VirtualHeight problem with a little cleaning of how things move when the user resize the stack.

As for the extraSpaceTrimming, you solution is what I was already using. I just tough that there was a parsing command that i could not find...

Thanks anyway for your help
Trevix
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10104
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Post by FourthWorld »

As for the extraSpaceTrimming, you solution is what I was already using. I just tough that there was a parsing command that i could not find...[/quote]

There might be some clever one-liner possible with regex, but it benchmarks so much slower than parsing with Transcript chunk expressions that I rarely bother with it.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark »

Trevix,

Q1: I don't agree: such dependencies will give you a hard time fixing things when you make tiny mistakes. Set the card size to an incorrect value, set it back and you'll have to reset stack height, background heights, object heights, etc.

Q2: "the repeat for" structure appears to be faster than doing all the stuff at once using an array, for example (see a recent discussion about sorting on the mail list).

B1: Yes, I agree, that's terrible, but I have never been able to reproduce this problem consistently. Can you?

B2: I think breakpoints are ignored if they are in front of a comment, an empty line, or a line that starts with "end". I have also noticed that breakpoints are sometimes ignored for no obvious reason.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
trevix
Posts: 1112
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Post by trevix »

Mark,
Q1
from the docs:
"Use this option to implement a layout that allows a section of
optional controls to be folded out."

You may be right but it seems to me that using the cREVGeneral["virtualHeight"], to hide and show section , the minimum height should be taken care by Revolution accordingly.
In my case I had to write a "set the min height to..." to temporary change the value so that the stack does not jump up and down when the user resize.

Trevix
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark »

Trevix, where in the docs did you find that?

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
trevix
Posts: 1112
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Post by trevix »

Mark
pag 99 of the RevolutionUsersGuide.pdf (v.2.9)

Trevix
Post Reply