Problem about opemdcl grid control

Started by dayange, January 14, 2008, 09:07:09 PM

Previous topic - Next topic

dayange

I am trying to use grid control, but I don't know how to get the value of a specified cell in gird control,
for example, if the cell type is set to AcadColor or Dropdown?

Would you please give me some example code?

And how to set default value for Dropdown cell in grid?

BazzaCAD

Hello dayange & welcome to the team.
First have a look at the "Examples" folder under your OpenDCL install folder (usually C:\Program Files\OpenDCL Studio\Examples).
Drag the "_MasterDemo.LSP" file into your Acad window for an easy walk through of all the project. Most importantly have a look at the "GRID" project. It will show you how to pre-load the control, I.E. your Dropdown cell.
Second, when you're in the editor right-click on the grid and select "Intelligent Help". This will give you all the properties & methods for that control.
Have a looks at:
(dcl_Grid_AddColumns)
(dcl_Grid_AddRow)
(dcl_Grid_AddString)

(dcl_Grid_GetItemText)
(dcl_Grid_GetRowItems)

Hope this helps & let us know how you're doing & if you need any more help.
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

Fred Tomke

Hello dayange,

I use opendcl grid control very often.
In some cases I use it in combination with a database.
The largest dialog I created with the grid control was a systemvariable manager - there are very different types of data. And all of them can be present in the grid.

The values you put in the grid, must be strings in any case, even the original values are numbers.
Maybe I can help furthermore when you give me more details.

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

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

dayange

Thanks Fred, and thanks BazzaCAD.
I have gotten a row's list by (dcl_Grid_GetRowItems).

Moreover, My quesstions are:
1. how to set default value for AcadColor cell in grid?
   I set "Red" or other integer number by dcl_Grid_AddString, but the control cannot
   display the correct color. What should I do?

2. When I add a ComboBox(type is Colors) in Form, without adding any code, the list program
   will shutdown my Autocad 2006 at runtime--No alert, no message. What happened? How to solve it?

Fred Tomke

Good catch, dayange,

1. I already know about color issues in grid control, I already send a list with grid issues (especially with colors) to Owen.

2. I don't know about issues in color combobox. Do you mean color combobox within the grid? Or as seperate combobox on the form?

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

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

BazzaCAD

#5
Quote from: dayange on January 15, 2008, 02:55:12 AM
Thanks Fred, and thanks BazzaCAD.
I have gotten a row's list by (dcl_Grid_GetRowItems).

Moreover, My quesstions are:
1. how to set default value for AcadColor cell in grid?
   I set "Red" or other integer number by dcl_Grid_AddString, but the control cannot
   display the correct color. What should I do?

2. When I add a ComboBox(type is Colors) in Form, without adding any code, the list program
   will shutdown my Autocad 2006 at runtime--No alert, no message. What happened? How to solve it?


#1 Try this:
(dcl_Grid_SetItemStyle Grid_Dcl-1_grid1
    nRow [as Integer]
    nCol [as Integer]
    nStyle [as Integer]
   {Optional} nData1  [as Integer]
   {Optional} nData2 [as Integer]
   {Optional} sString [as Integer])

See the Intelligent Help fro more info...
Note:The style change only governs the behavior of the cell and what happens when the user clicks on the cell.

For example if you set the style 33 - Linetype Cell, the current selection for the linetype must be correctly set in the dcl_Grid_AddString or dcl_Grid_AddRow functions. The item may not be changed to correctly display one of the listed items.


#2, Sound's like a bug, and when I just tried to load the Misc demo in 2006 it did crash (ran fine 2008). Bug reported:
https://sourceforge.net/tracker/index.php?func=detail&aid=1872452&group_id=187950&atid=923363

a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

owenwengerd

I don't have time to test right now, but you might try using (dcl_Grid_SetItemImage) function to set a color in the color dropdown.  Likewise, try (dcl_Grid_GetItemImage) to get the current selection.  I think this will work because the "image index" value is used as the current selection index for combo style cells. :)

JMack

Hi dayange,

BazzaCAD got it right with dcl_Grid_SetItemStyle.  This dcl function will allow you to set the colors when the form initializes.

When you add the row don't provide any data for the columns except the first one.
(setq iRowIndex (dcl_Grid_AddRow Project1_Form1_Grid1 "Row 1"))
Save the row index so you can setup the default values for the row with the proper data.

To add a an AcadColor index do this.
(dcl_Grid_SetItemStyle Project1_Form1_Grid1 iRowIndex iColumnIndex iCellStyleIndex iAcadColorIndex)

This will add a magenta cell to row 1 column 2:
(dcl_Grid_SetItemStyle Project1_Form1_Grid1 1 2 30 6)

Hope that helps you out when you work with AcadColor Cells.  I'm not sure about setting default data, but it could be related to dcl_Grid_SetItemStyle.

Cheers, JM





dayange