Author Topic: Selecting and editing Grid Cell  (Read 9988 times)

0 Members and 1 Guest are viewing this topic.

scottcd

  • Newt
  • Posts: 52
Selecting and editing Grid Cell
« on: October 19, 2006, 01:55:20 AM »
How do you select a grid cell and edit the contents

Is it somethind to do with the following...

Code: [Select]
(defun c:DclForm1_lotc_grid1_OnGridCellEdit (nRow nCol /)
  (Odcl_Grid_ShowTextBox lotc_DclForm1_lotc_grid1 nRow nCol 6)
)

How do I get the row and column number?

Cheers

Scott


edit:Added code tags
« Last Edit: October 19, 2006, 04:40:00 AM by jonesy »
AutoCAD Dos R9 - 2018 and BricCAD 18.2

Tramber

  • Guest
Re: Selecting and editing Grid Cell
« Reply #1 on: October 21, 2006, 01:41:16 PM »
Code: [Select]
(Odcl_Grid_SetItemText  lotc_DclForm1_lotc_grid1  Textvalue  nRow nCol)
The Col and Row number are given inside the function you just have to use them

scottcd

  • Newt
  • Posts: 52
Re: Selecting and editing Grid Cell
« Reply #2 on: October 21, 2006, 04:13:12 PM »
Sorry, I have been a bit vague in the way I have asked the question :ugly:

I have already created the table of a list of bearings and distances of a polyline segments.

I now want to be able to edit a cell and change a value.

How from a mouse pick on the cell do I retrieve the row and column number?

Cheers

Scott
AutoCAD Dos R9 - 2018 and BricCAD 18.2

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Selecting and editing Grid Cell
« Reply #3 on: October 21, 2006, 09:11:38 PM »
I now want to be able to edit a cell and change a value.

I haven't played with editing cells but just had a look at the GRID.LSP example and at the browser help.
Try using SetItemStyle when you initialise the grid.
Quote
Note:The style change only governs the behavior of the cell and what happens when the user clicks on the cell.

Quote
Method SetItemStyle
 
This method will set the editing style of a single cell. The styles that are available are as shown below.
   
    0 - Decide at run time
    1 - Check Boxes
    2 - Option Buttons
    3 - Switchable Icons
    4 - Ellipses Buttons
    5 - Pick Buttons   
    6 - Strings   
    7 - AngleUnits   
    8 - Integers   
    9 - Units      
   10 - UpperCase   
   11 - LowerCase   
   12 - Password   
   13 - MultiLine   
   14 - Currency   
   15 - Date      
   16 - Time      
   17 - Percentage   
   18 - DropDown
   19 - ArrowHeads
   20 - Acad Colors
   21 - TextStyle List
   22 - PlotStyle Names
   23 - PlotStyle Tables
   24 - Plotter List   
   25 - Fonts      
   26 - Drive List
   27 - Layer List   
   28 - DimStyle List
   29 - ImageDrop List
   30 - AcadColor Cell
   31 - TrueColor Cell
   32 - LineWeight Cell
   33 - Linetype Cell   
   34 - Directories
   35 - Files
   36 - Strings Combo
   37 - AngleUnits Combo
   38 - Integers Combo
   39 - Units Combo   
   40 - UpperCase Combo
   41 - LowerCase Combo

Note:For the style: 3 - Switchable Icons, the last two arguements (nData1 and nData2) that must be passed in, identify the two images from the image list that are to be used.

Note:For the style: 15 - Date, the last argument (nData1) that can be passed in is the identifying date format.  0 through 9 are the allowable arguments.

Note:For the style: 16 - Time, the last argument (nData1) that can be passed in is the identifying time format.  0 through 5 are the allowable arguments.

Note:For the style: 35 - Files Cell, the last argument (sString) that can be a string identifying the file extensions to look for. If not found, "dwg;dxf" will be assumed.

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 Odcl_Grid_AddString or Odcl_Grid_AddRow functions. The item may not be changed to correctly display one of the listed items.

For example if you set the style 38 - Integers Combo, all the items to be added to the drop list must be as strings. You are responcible to ensure the correct text is added. 
 
AutoLisp Syntax:
(Odcl_Grid_SetItemStyle grid2_DclForm2_Grid1 nRow [as Integer] nCol [as Integer] nStyle [as Integer] [Optional] nData1  [as Integer] [Optional] nData2  [as Integer] [Optional] sString  [as Integer])
« Last Edit: October 21, 2006, 09:17:27 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Selecting and editing Grid Cell
« Reply #4 on: October 21, 2006, 09:18:46 PM »
How from a mouse pick on the cell do I retrieve the row and column number?
Quote
Method GetCurSel
 
This method will return the current row and column indexes of the currently selected cell. If the column index is -1 and the row index is 0 or above, this indicates the entire row is selected. 
 
AutoLisp Syntax:
(Odcl_Grid_GetCurSel grid2_DclForm2_Grid1 nIndex [as Integer])

 
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Selecting and editing Grid Cell
« Reply #5 on: October 21, 2006, 09:31:49 PM »
Sample Piccy :-
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.