hwtk::chooseentitycolor
Opens an anonymous editor dialog to return a user-specified color. This function halts execution of the current thread until the editor is dismissed or a color is picked.
Format
hwtk::chooseentitycolor - pathName ?option value? …
Standard Options
- -clientdata
- Database name: clientData
Widget Specific Options
- -array
- Array to place hexadecimal, integer, and RGB value equivalents of user’s selected color into. Values are indexed with names hexa, integer, and rgb, respectively.
- -command
- Database name: command
- -initialcolor
- Sets the initially highlighted color in the editor.
- -parent
- Sets the parent widget of the editor. Defaults to root.
- -startindex
- Either 0 or 1, indicates the index of the first color value. For example, if the 3rd color is picked and -startindex is set to 0, then its integer value will be 2.
- -values
- A list of integer values that specifies what corresponding colors are visible when the widget appears.
- -x
- Sets the x value of the location that the editor initially appears at.
- -y
- Sets the u value of the location that the editor initially appears at.
Example
proc onColorSelect {colorInt colorRgg colorHex} {
puts "\nSelected Color:"
puts "RGB: $colorInt"
puts "Integer: $colorRgb"
puts "Hexadecimal: $colorHex"
return true
}
set curX [winfo pointerx .]
set curY [winfo pointery .]
set initColorVals [list 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31]
hwtk::chooseentitycolor -startindex 0 -values $initColorVals -initialcolor 15 -command {onColorSelect %I %R %H} -x $curX -y $curY