Display of groups in Control Browser
Wouter
wouter.abraham at scarlet.be
Fri Nov 26 14:52:02 EST 2004
On 26 Nov 2004, at 11:37, metacard-request at lists.runrev.com wrote:
> Message: 2
> Date: Thu, 25 Nov 2004 10:13:49 -0800
> From: Richard Gaskin <ambassador at fourthworld.com>
> Subject: Re: Display of groups in Control Browser
> To: Discussions on Metacard <metacard at lists.runrev.com>
> Message-ID: <41A620DD.5000807 at fourthworld.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>
snip
>
> If it works reliably with earlier engine versions it may be an engine
> issue, or something specific to the way the MC IDE uses the engine to
> build that list.
>
> I've seen this myself, but haven't had time to look into it deeper.
>
> If any of you are able to correct this I'd happily tuck the fixed code
> into the next build.
>
> --
> Richard Gaskin
> Fourth World Media Corporation
>
Hi,
The problem is in the lines: subtract ... from last item of
groupcontrols
which the engine won't execute anymore (in this case) if there is only
1 item
Here is a work around which i use for the refresh handler in the
"control browser"
(### the changes)
on refresh
local l, pad, cname, groupcontrols, isvis, nopw, nlines
lock screen
set the defaultStack to the label of button "Stack Name"
put empty into l
put empty into pad
put 0 into groupcontrols
put the passkey of this stack is empty into nopw
repeat with i = 1 to the number of controls
if the visible of control i then put empty into isvis else put "+"
into isvis
if nopw then put the number of lines in the script of control i
into nlines
if nlines is 0 then put empty into nlines
put pad & line 1 of the name of control i into cname
if the length of cname > 30
then put "..." into char 28 to -1 of cname
put cname & tab & nlines & tab & isvis & return after l
if word 1 of the name of control i is "group" then
if pad is empty
then put the number of layers in control i into groupcontrols
else
--subtract the number of layers in control i from the last item
of groupcontrols ###
### the change
if the num of items in groupcontrols = 1 then subtract the
number of layers in control i from groupcontrols
else subtract the number of layers in control i from last item
of groupcontrols
###
put comma & the number of layers in control i after
groupcontrols
end if
put " " after pad
end if
if pad is not empty then
repeat while pad is not empty and last item of groupcontrols <= 0
delete last item of groupcontrols
delete char 1 to 2 of pad
end repeat
--if pad is not empty then subtract 1 from the last item of
groupcontrols ###
### the change
if pad is not empty then
if the num of items in groupcontrols = 1 then subtract 1 from
groupcontrols
else subtract 1 from last item of groupcontrols
end if
###
end if
end repeat
delete last char of l
put the id of this card into cardid
set the defaultStack to the owner of me
set the defaultStack to "Copy of Control Browser"
put l into field "Controls"
if the selObj is not empty
then get the name of the selObj
else get empty
if it is empty or word 1 of it is "stack" \
or (word 1 of it is "card" and (word 2 of it is "id" or char 1 of
word 2 of it is quote)) then
disablecontrols
set the hilitedLine of field "Controls" to empty
else
set the hilitedLine of field "Controls" to the layer of the selobj
enablecontrols
else
end if
unlock screen
end refresh
Beware of the mail line wraps when copy pasting
Greetings,
WA
More information about the metacard
mailing list