Livecode Wiki
Advertisement

Two segmented control widgets

A segmented control is a horizontal control that is made up of multiple segments, where each segment functions as a discrete button. Each segment can either show a label or an icon.

One or more of the segments can be highlighted by clicking on them. By default, only one segment at a time can be highlighted, but it is possible to allow multiple segments to be highlighted.

The segmented control is great for:

  • displaying a set of different options in a settings window (for example, it is used to display text alignment in the LiveCode property inspector)
  • switching between different cards in a stack
  • displaying a set of toggleable settings

Properties[]

  • backColor
  • BorderColor
  • foreColor
  • HiliteColor
  • hilitedItemIcons: A comma-delimited list of icon names for the segments, you can get a list of available predefined path names by IconNames function.
  • hilitedItemNames: A comma-delimited list of segment names. If the multipleHilites is false when setting the hilitedItemNames, then the first name in the hilitedItemNames determines which segment is highlighted, and the remainder of the hilitedItemNames are ignored.
  • hilitedItems: The segment numbers of the highlighted segments of the control. If the multipleHilites is false when setting the hilitedItems, then the first index in the hilitedItems determines which segment is highlighted, and the remainder of the hilitedItems are ignored.
  • hilitedTextColor: The label or icon color for highlighted segments
  • itemcount: it's the number of segments shown, The itemCount property can be used to obtain or to set the number of segments shown by the segmented control. When you set the itemCount to a number larger than the current number of segments in the control, new segments are added to the end of the control with unique names and labels. When you set the itemCount to a number smaller than the current number of segments in the control, segments are discarded from the end of the control. If this results in discarding a segment that's currently highlighted, the hiliteChanged message may be sent. The segmented control must always have at least one segment.
  • itemIcons: A comma-delimited list of icon names for the segments.
  • itemLabels: A comma-delimited list of labels for the segments.
  • itemWidthMins: A comma-delimited list of positive numbers. These numbers represents the minimum width of each cell. When the widget is resized, the cell will not be smaller than that width; however all the cell outside the widget rect will not be displayed. When you set the itemMinWidths to a string that has fewer than itemCount numbers in it, the remaining segments are given a minimum a width of 0. When you set the itemMinWidths to a string that has more than itemCount numbers in it, the extra numbers are ignored.
  • itemNames: A comma-delimited list of names for the segments. The itemNames can be a more convenient way to identify the segments than by their positions. You are recommended to use a non-empty, unique name for each segment. When you set the itemNames to a string that has fewer names than the itemCount, the remaining segments' names are set to empty. When you set the itemNames to a string that that has more names than the itemCount, the extra names are ignored.
  • itemStyle: The way that segments are displayed: "icons" or "text"
  • multipleHilites: When the multipleHilites property is true, more than one segemnt can be highlighted at once. If it is false, then highlighting a segment removes the highlight from all other segments. If the multipleHilites is set to false while there is more than one segment highlighted, then all segments are immediately dehighlighted and the hiliteChanged message is sent.
  • ShowBorder

Messages[]

  • hiliteChanged: Sent when the hilite of the segmented control widget changes by user click.
Advertisement