formattedtext and formattedrect in a substack

Michael Doub mikedoub at gmail.com
Thu Feb 11 16:04:35 EST 2016


I recently discovered an interesting bug: 
http://quality.livecode.com/show_bug.cgi?id=16881

formattedrec and formattedtext do not work properly it their target is 
in a stack that has not been opened.
So if you have a main stack A with a checkbox on the cd 1 and stack B is 
a substack of stack A with fld 1 on its first card.  Execute the 
following code in the stack script of stack A:

open a fresh copy of livecode, and open stack A
execute the following:
put "Hello world" into fld 1 of cd 1 of stack "B"  - works as expected
get the formattedrect of line 1 of fld 1 of cd 1 of stack "B" - fails 
and returns 0,0,0,0 <======
answer the hilite of btn 1

As long a stack B has not been opened you will get bad results.

Now open substack B and close it.
execute the following again...
put "Hello world" into fld 1 of cd 1 of stack "B"  - works as expected
get the formattedrect of line 1 of fld 1 of cd 1 of stack "B" - returns 
58,42,114,56
answer the hilite of btn 1

So now open a fresh copy and livecode and open stack A
now execute the followng:

go invisible to stack "B"
put "Hello world" into fld 1 of cd 1 of stack "B"  - works as expected
get the formattedrect of line 1 of fld 1 of cd 1 of stack "B" - fails 
and returns 58,42,114,56
answer the hilite of btn 1 <==== gets a runtime error here because there 
is no bnt 1 on cd 1 of stack "B"

So, how do you get the context set back to stack A?

Regards,
   Mike






More information about the Use-livecode mailing list