news
About Elegant Chaos
info
About me and my friends
people
Software from Elegant Chaos
software
Other stuff...
stuff

DL_ShowHide

Revision 2
Revised on 19/03/95 19:29

Description

Show (or hide) invisible fields and buttons. Takes a boolean value - true to show the fields, false to hide them.

This routine can be used to hide or show any card or background buttons and fields that have the line "-- should be hidden" in their scripts. As long as you remember to put the line in to the script of these objects, it allows you to find them all again later!

The boolean parameter can be omitted. In this case, the field looks at the state of the first invisible object that it comes to. If the object is currently hidden, then all the objects are shown. If it is currently visible, all objects are hidden. Thus calling DL_ShowHide without a parameter effectively toggles the state of all the invisible objects on the card.


Code

on DL_ShowHide state
  put "card field,card button,bkgnd field,bkgnd button" into objs
  repeat with o = 1 to the number of items in objs
    put item o of objs into object
    repeat with n = 1 to value("the number of " & object & "s")
      set cursor to busy
      if the script of (object && n) contains "Should Be Hidden" then
        if state is empty then
          put not the visible of (object && n) into state
        end if
        set the visible of (object && n) to state
      end if
    end repeat
  end repeat
end DL_ShowHide