Solution: Display of groups in Control Browser

Wilhelm Sanke sanke at hrz.uni-kassel.de
Mon Nov 29 23:54:05 EST 2004


On Mon, 29 Nov 2004, Richard Gaskin wrote:

> I appreciate all the good work on this issue, but to be honest I'm 
> still catching up on my In Box and have more than a dozen emails on 
> this thread that contain code.
>
> Which one of them contains a solution which will work both with engine 
> v2.6.1 and earlier engines back to v2.5? Is there one?
>
> I'd be happy to fold that script into the master build once I can get 
> a final solution. Thanks in advance -
>
> --
>  Richard Gaskin
>  Fourth World Media Corporation


and WA (Wouter) wrote:

> My bad.
> Disregard my two latest mailings.
> (snip)
> both
> (snip)
>
> are not doing what they should do in the script of the refresh handler 
> in the latest engine version.
>
> Sorry,
>
> WA



Hi WA and Richard,

Seems to be really a complex problem - maybe partly because of 
"subtracting" and  at the same time of "layer" bugs in the engine. The 
latest - newest as of today - engine 2.6.2A3 is no different in this 
respect.

As usual, probably there is more than one solution, i.e. also in the 
direction of the proposals of WA.

Anyway, my solution seems to work both with old and new engines on 
WindowXP. As I am really pressed by a couple of urgent issues I need to 
respond to, I did not  have the time to test this on MacOS.

My latest version of the proposed "refresh" script even improves the 
speed of the Control Browser compared to the original MC-version. 
Displaying the values of 3000 (three thousand) controls in the Control 
Browser on WindowsXP, 2 GigaHtz, takes only 1.5 (one and a half) second. 
In the Revolution IDE it would take a very much longer time to achieve 
that (test ist for yourself) and the Revolution IDE would break down 
completely - try the "Revolution test stack" from my website 
<www.sanke.org>, page "stacks and samples for development".

Here is the proposed "refresh" script:

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
     if "group" is in LID then
       delete word 1 to 4 of LID
       put 0 into wordcount
       repeat for each word w in LID
         if w 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
     end if
     #===========================================
     put cname & tab & nlines & tab & isvis & return after l
#=====the following commented lines are no longer needed===============
     # 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" \'5C
       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
<www.sanke.org>



More information about the metacard mailing list