Fold Container. A fold container (fold) is a comb-widget that is used as a container. It provides a multi-page folder to host various widgets of a graphic user interface. Each fold widget is referred to by a pathname specified at the creation. Pages in a fold widget can be created simultaneously with the fold widget or added into after the fold widget is created. A page in a fold widget is referred by a pagepath, which may be retrieved with a page's label, or directly returned after a new page is added into a fold widget. In addition to a pagepath, a page can also be referred to by a pageID that is uniquely assigned in creation of the page. Like any other widgets, a page can be deleted too. A page is a container (i.e., a comb-widget) that hosts various application items (widgets). An item is referred to by an itemID. An item can be bound with procedures, added into or deleted from a page as needed. EXAMPLE: The following example creates a fold of three pages: Palette, Editor and Buttons, and adds a pal widget into Palette, a text widget into Editor, and two gbtn widgets into Buttons. It then adds into the fold widget another page Fold in which an inside fold widget of four pages is added. At last, it adds a num widget into Page0 of the inside fold widget. This example shows how a complicated widget tree can be created using the container fold. catch "destroy .f" A palette widget within fold
A text widget within a page of fold
Two gbtn widgets are added into a page of fold
An inside fold is added into a page of fold. The numeric
CLASS NAME: fold COMB-WIDGET OPTIONS -labels pageLabelList It specifies a list of text labels for every page in a fold widget. Each item in this list defines a page in the fold widget. -fwidth initFoldWidth This is an integer to specify the initial width of the fold widget. -fheight initFoldHeight This is an integer to specify the initial height of the fold widget. -fclr frontColor It defines a color value for the front page label text. A defaulted value is black. -bclr backColor It defines a color value for the back page label text. A defaulted value is gray50. -x startx This is an integer to specify the x coordinate of a page start point. -y starty This is an integer to specify the y coordinate of a page start point. -dx labelWidth This is an integer to specify the minimum width of a label. -dy labelHeight This is an integer to specify the height of a label. -maxdx maxLabelWidth This is an integer to specify the maximum width of a label. -wx windowx This is an integer to specify the x coordinate of the upleft of the item window within a folder page. -wy windowy This is an integer to specify the y coordinate of the upleft of the item window within a folder page. User-defined options: an option may be defined by a user after a widget is added into a fold widget.WIDGET API fold.create pathname ?options? This command create a fold widget with the options. It returns the pathname if the fold widget is successfully created. Otherwise it return an empty string. fold.add pathname label update This command adds a new page into a fold widget referred to by pathname. The newly added page will have a text label as specified by label. If the update is specified with a non-empty string, the fold widget's display will be updated immediately. A pagepath will be returned if the procedure is successfully completed. Otherwise an empty string is returned. fold.addFoldItem pagepath itemID creator ?options? This command adds an item (a sub-widget) into a fold page referred to by pagepath. An itemID is a -varName variable that uniquely identifies the corresponding sub-widget. The creator is a commad that creates the sub-widget. The ?options? is a list of options for the sub-widget configuration during its creation. fold.addItem pathname label itemID creator ?options? This command adds an item into a page referred to by a label of a fold widget, pathname. This command is similar to fold.addFoldItem. The difference is that it uses pathname and label to identify the pagepath. fold.bindPage pathname event cmd label This command binds a page referred to by a label to a command cmd for an event event. fold.delete pathname label update This command deletes a page referred to by a label from a fold widget referred to by pathname. If the update is not empty, the fold widget's display will be updated immediately. fold.deleteItem pathname label itemID This command deletes an item referred to by an itemID from a page referred to by a label from a fold widget referred to by a pathname. fold.disableItem pathname label itemID This command disables an item referred to by an itemID of a page referred to by a label of a fold widget referred to by a pathname. fold.enableItem pathname label itemID This command enables an item referred to by an itemID of a page referred to by a label of a fold widget referred to by a pathname. fold.get pathname label This command retrieves a pagepath of a page referred to by a label of a fold widget referred to by a pathname. fold.getPID pathname label This command retrieves a pageID of a page referred to by a label of a fold widget referred to by a pathname. fold.rename pathname label newLabel update This command renames a page referred to by a label to a new label referred to by newLabel. If the update variable is not empty, the fold widget's display will be updated immediately. fold.winconfig pathname width height This command reconfigures the window of the fold widget with a new width and height.RELATED PROCEDURES The followings are procedures used in fold widget implementation and test. A user may access to these procedures through the fold widget API, and should never use these procedures directly in an application program. fold.draw pathname id x y wd ht offset dx dy label. |