How to make a Layers properties grid ?

Started by krunch, February 05, 2012, 12:39:21 PM

Previous topic - Next topic

krunch


Hi

I wondered if I could make a grid that would be the same as LayerState-Edit : http://exchange.autodesk.com/autocad/enu/online-help/search#WS73099cc142f4875513fb5cd10c4aa30d6b2cff.htm

But is it possible to make columns of 'color' 'lynetype' .. comboboxes (with style 43 ?) or cells must be buttons ?
Do i have to use SetColumnStyleList or Grid_SetCellStyle ?

Indeed I've never made grid .. can someone show me a similar example ?

Thanks in advance

Fred Tomke

Hi,

just have a look at the grid's SetStyle method.
There you can find the styles you can set to the grid's styles.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

krunch

#2
Hi

Thanks, but you meant SetCellStyle ?

And may be you see an approaching example ?

Fred Tomke

Yes, I meant SetCellStyle.
There is a sample in the OpenDCL samples which demonstrates the grid.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

krunch


krunch

#5
Hi

Something I can't understand (samples are using deprecated method) is how to manage a '3 - Switchable Image' column style.
I mean how do you set and toggle images :
- can't assign pictures from the picture folder using dcl_Grid_SetCellImages ?
- Alt. cell icon disabled ..


Is it possible to disable (greyed) 1 column ?

Is it possible to set a column (6-String) to read only ?

Another detail but I suppose it can't be changed : style 33 (LineType) doesn't provides a 'Other ...' option to open the LineType manager ?

Fred Tomke

Hi, you can't grey out any item. But you can set the cellstyle to 0.
The linetype droplist style only shows the list of loaded linetypes of the current drawing.
But you can add items to the list and call the (dcl_selectlinetype) function by your own if they're selected.

You can preset the images by calling
(dcl_Grid_SetCellStyle <CONTROL> intRow [als Long] intColumn [als Long] intStyle [als Integer] intData as integer)
intData is the imageindex for default

With using
(dcl_Grid_SetCellImages <CONTROL> intRow [als Long] intColumn [als Long] intImageIndex [als Integer] {intAltImageIndex [als Integer]}) you can change the images afterwards.

Using (dcl_Grid_GetCellCheckState <CONTROL> intRow [als Long] intColumn [als Long]) you can get the current state, using (dcl_Grid_SetCellCheckState <CONTROL> intRow [als Long] intColumn [als Long] intState [als Integer]) you can set the current state.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

krunch

Hi

QuoteBut you can add items to the list and call the (dcl_selectlinetype) function by your own if they're selected.

Good! but how can I add an item to a list (don't see any 'additem method) ? With SetCellDropList ?

About the style 3 column .. image doesn't come
I've just tried to get my 1st image (100), but the cell stays empty ...

Code (autolisp) Select
(defun c:Project_Form_OnInitialize (/)
    (dcl_Grid_SetCellStyle Project_Form_Grid 0 2 3 100) ; nrow 0
)
(defun c:Project_Form_Grid_OnBeginLabelEdit (Row Column /)
  (if (= Column 2) (dcl_Grid_SetCellImages Project_Form_Grid Row Column 100))
)



krunch

Hi

I've understood something important : images must be loaded in the grid's Image list (not in the picture folder) ... so now I can toggle the 2 images with the following trigger (I don't understand why but it toggles with '0')

(defun c:Project_Form_Grid_OnBeginLabelEdit (Row Column /)
  (if (= Column 2) (dcl_Grid_SetCellImages Project_Form_Grid Row Column 0))
)

But no way to display the image in the cell' on the form Initialize .. I've tried the following lines, with the column style set to 3, nothing works ..

        (dcl_Grid_SetCellCheckState Project_Form_Grid line 2 0)
        (dcl_Grid_SetCellImages Project_Form_Grid line 2 0)

        (dcl_Grid_SetCellStyle Project_Form_Grid line 2 3 0)

I think I miss something, where is the problem please ?
Thanks by advance

krunch

Ok ! so basically, a switchable images column (style 3) just requires :
- to load images in the grid's Image list (not in the picture folder)
- to set the initial picture with dcl_Grid_SetCellCheckState

it took me hours to find it, if it can serve to someone ..

Fred Tomke

Hi, good to know that it works now.
Quote from: krunch on February 14, 2012, 01:06:28 PM
- to load images in the grid's Image list (not in the picture folder)
ThatÃ,´is mentioned in the help.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]