Author Topic: [ GRID Control ] Populate grid drop-down list  (Read 3821 times)

0 Members and 1 Guest are viewing this topic.

Guest

  • Guest
[ GRID Control ] Populate grid drop-down list
« on: July 20, 2007, 11:28:29 AM »
How does one go about populating a drop-down list for column of the grid control?

I'm starting to get my feet damp with DBX and was thinking about writing a program that would allow the user to select multiple drawings.  Using DBX, each drawing would be read to determine what layout tabs are in each drawing.  The drawing names would be in one column of the grid control with their respective layouts listed in drop down boxes in another column.  I only see where you can set the Drop List Contents as design time (unless I'm missing something painfully obvious).

owenwengerd

  • Bull Frog
  • Posts: 451
Re: [ GRID Control ] Populate grid drop-down list
« Reply #1 on: July 20, 2007, 11:57:59 AM »
I think you're right Matt. The grid control dropdowns are designed for a preset list of options, and there is no way to address them at runtime in order to change the contents.

Guest

  • Guest
Re: [ GRID Control ] Populate grid drop-down list
« Reply #2 on: July 20, 2007, 12:05:54 PM »
Awww shucks... Now I need to rethink my strategy.

Thanks, Owen!

tlindell

  • Guest
Re: [ GRID Control ] Populate grid drop-down list
« Reply #3 on: August 03, 2007, 11:57:36 PM »
From what I've found, you can't fill the contents of a dropdown list at runtime if the grid cell column's style is set at design time, crashing AutoCAD has been the result from this for me.  By leaving it set to "decide at runtime", you can set the cell's style to dropdown list (or imagelist) and then fill it, all at run time.  I.e.

(dcl_Grid_Clear Project1_Form1_Grid1)
(setq dwglist (list "drawing1.dwg" "drawing2.dwg" "drawing3.dwg"))
(setq nRow 0)
(foreach dl dwglist
  (dcl_Grid_AddRow Project1_Form1_Grid1 (list dl ""))
  (dcl_Grid_SetItemStyle Project1_Form1_Grid1 nRow 1 18)
  (dcl_Grid_SetItemDropList Project1_Form1_Grid1 nRow 1 (list "Item1" Item2" "Item3")
  (dcl_Grid_SetItemText Project1_Form1_Grid1 nRow 1 "Item1")
  (setq nRow (+ nRow 1))
)

I realize my foreach example is setting the same droplist.  You can easily change the list to something of an association list or maybe find out what the list should be during each loop.  Either way, I am simply trying to demonstrate the set-then-fill-it idea.

Hope that's what you're after.
« Last Edit: August 04, 2007, 09:41:51 AM by tlindell »