Solution: Display of groups in Control Browser
Wilhelm Sanke
sanke at hrz.uni-kassel.de
Fri Nov 26 18:25:01 EST 2004
The problem - on our side - is located in the "refresh" handler of the
card script of the Control Browser. Presumeably the engine now treats
the number of layers in groups somewhat differently since version 2.6.1
(Metacard reading).
I tested the contents of all instances of the local variable
"groupcontrols" (that is responsible for the width of the "pad"), and
the results with engines before 2.6.1 differ markedly from those after;
see the commented part of the script below
I commented the offending part of the script and added a new "indenting
routine", which could possibly be scripted still more elegantly.
Substitute the script below for the present "refresh" script of the
Control Browser, and groups and sub-groups will then show properly
indented as they should - with engine versions before and after 2.6.1.
All other functions of the Control Browser work as before after that change.
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
#===========new indenting routine================
put the long ID of control i into LID
delete word 1 to 4 of LID
put 0 into wordcount
put the number of words of LID into LIDnumber
repeat with j = 1 to LIDnumber
if word j of LID is "group" then add 1 to wordcount
end repeat
if wordcount <> 0 then
repeat with h = 1 to wordcount
put Space before cname
end repeat
end if
#===========================================
put cname & tab & nlines & tab & isvis & return after l
#==the following lines concerning "pads" must be disabled=========
# 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
# 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 last item of groupcontrols
# 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 "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
Best regards,
Wilhelm Sanke
More information about the metacard
mailing list