Display of groups in Control Browser

Wouter wouter.abraham at scarlet.be
Sat Nov 27 00:40:03 EST 2004


Hi all,

The problem is in :    subtract ...  from last item of groupcontrols
which the engine won't execute anymore (in this case)  if there is only 
1 item in groupcontrols.
(sometimes it does, but I couldn't pinpoint the reason yet why it 
doesn't in this case)

Here is a work around for the "subtract from last item" problem, 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 "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

Greetings,
WA

PS My previous mails bounced because of an address change so I had to 
re-subscribe.
Sorry for all other mails I have sent for this thread.



More information about the metacard mailing list