FlexColorDialog: Using a single Picture Box for mutliple color swatches

Started by roy_043, February 11, 2013, 03:59:06 AM

Previous topic - Next topic

roy_043

When I started using ODCL I was playing around with color dialogs. I was trying to create a flexible color dialog where the color swatches are configurable and ACI and true colors can be mixed in the same dialog. I have named the result 'FlexColorDialog'. The FlexColorDialog can be a replacement for the default AutoCAD/BricsCAD color dialog if, for example, you want to offer a limited choice of colors.

The ODCL dialog uses a single control (a Picture Box). The Lisp code may be of interest for other projects where the clicked coordinates of a Picture Box need to be analysed.

Note: I use BricsCAD 13.

Edit 1:
RGUS has stumbled upon an error. The error may be caused by the fact (?) that the function (dcl_GetOLEColorValue) does not accept an RGB-list in AC 2013. In BricsCAD 13 this is not a problem. I have updated the Lisp file.

owenwengerd

Convert the first (dcl_GetOLEColorValue) argument to a (float) in order to avoid the DXF code problem.

roy_043

Owen do you mean this?
Code (autolisp) Select
(dcl_GetOLEColorValue (list (float (car rgbList)) (cadr rgbList) (caddr rgbList)))

owenwengerd



owenwengerd


roy_043

To show the flexibility of FlexColorDialog here is a sample that will display all ACI colors.

Code (autolisp) Select
(defun FlexColorDialog_FullAci ()
  (FlexColorDialog
    '(
      ( 18  28  38  48  58  68  78  88  98 108 118 128 138 148 158 168 178 188 198 208 218 228 238 248)
      ( 16  26  36  46  56  66  76  86  96 106 116 126 136 146 156 166 176 186 196 206 216 226 236 246)
      ( 14  24  34  44  54  64  74  84  94 104 114 124 134 144 154 164 174 184 194 204 214 224 234 244)
      ( 12  22  32  42  52  62  72  82  92 102 112 122 132 142 152 162 172 182 192 202 212 222 232 242)
      ( 10  20  30  40  50  60  70  80  90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240)
      ( 11  21  31  41  51  61  71  81  91 101 111 121 131 141 151 161 171 181 191 201 211 221 231 241)
      ( 13  23  33  43  53  63  73  83  90 103 113 123 133 143 153 163 173 183 193 203 213 223 233 243)
      ( 15  25  35  45  55  65  75  85  95 105 115 125 135 145 155 165 175 185 195 205 215 225 234 245)
      ( 17  27  37  47  57  67  77  87  97 107 117 127 137 147 157 167 177 187 197 207 217 227 237 247)
      ( 19  29  39  49  59  69  79  89  99 109 119 129 139 149 159 169 179 189 199 209 219 229 239 249)
      (  1   2   3   4   5   6   7   8   9 nil 250 251 252 253 254 255 nil nil nil nil nil nil   0 256)
    )
    nil
    T
  )
)