Mark Items in Input Field

MarkSelected is used to mark selected items in an input field. Given a field with an integer data component and a list of integer values, MarkSelected toggles the state of the corresponding "marked" component item - if a marked component exists in the input; otherwise a new "marked" component is created and initialized to indicate that nothing has yet been marked.

A demo of MarkSelected has been included. This uses Construct to create a grid of 25x25 quads with the a data component that is dependent on the connections array and contains the index of the quad. This then initializes a Get/Set pair, which will retain the state of this object as elements are marked and unmarked. Place the network in execute on change mode. It will display the grid, with each quad colored according to its index. Now enter Pick mode and pick a quad. The state of this quad will be toggled; since this is the first time MarkSelected has been run, that quad will be unmarked by default, and so it gets marked. When a pick has been made, the coloring of the quads show their marked state - marked quads will be red and unmarked quads will be blue, so the quad that was picked will be red, and the rest blue. The result of MarkSelected will be put into the cache. Now pick another quad. The result of the last MarkSelected will ge retrieved from the cache by Get, and the newly picked quad will be marked. The image will now show two red quads. Now pick one of the red quads - its state will be toggled, and it will return to the unmarked state.

MarkSelected is particularly useful in conjunction with Connected to allow connected components of a field to be interactively selected and deselected.

To make the executive, make dxexec.

To run the demo: dx -exec ./dxexec -mdf MarkSelected.mdf MarkSelected

Directory name: contrib/modules/markselected

Other files in this directory:

Return to Assorted Useful Modules

See license


[ Previous Page | Next Page | Table of Contents | DX Home Page ]
[ IBM home page | Order | Search | Contact IBM | Help | (C) | (TM) ]