Grid Control Droplist

Started by AutoKAD, May 27, 2009, 04:12:32 PM

Previous topic - Next topic

AutoKAD

I'm fairly new to OpenDCL.  This is my first post and just want to say to the developers of OpenDCL that it is an awesome tool!

I am having the exact same trouble as the person in the thread below:

http://www.opendcl.com/forum/index.php?topic=139.0

Here is the procedure I have set up:


(defun c:project1_Form1_Grid1_OnEndLabelEdit (Row Column /)
  (dcl_Grid_CancelCellEdit project1_Form1_Grid1)
  (setq a (dcl_Grid_GetCellText project1_Form1_Grid1 Row Column))
)


What am I doing wrong?  I get the same result as the person in the thread above: The value of the item selected in the droplist does not get applied until I select another cell or I click on a scroll bar of the control.  I need it to update right after changing the value from the droplist.

Thanks~AutoKAD

owenwengerd

Try removing the call to (dcl_Grid_CancelCellEdit).

AutoKAD

Nope, didn't work.  'a' is set to "".  What occurs when I select from a cell droplist is that the cell remains looking like a droplist and the value doesn't apply to the cell.  If I select another cell, then the selected value is set to 'a' and the cell changes back to looking like a normal cell.

I'm working under Windows Vista...if that helps any. :-\

Thanks~AutoKAD

owenwengerd

Sorry, I thought you were just trying to get the new value in your OnEndLabelEdit handler.

The cell value does not update until the cell editor control is destroyed, and that is by design. Also, there is no event fired when a different value is chosen in the combo. Just selecting a new value does not end cell editing. The OnEndLabelEdit event is not fired until after the cell editor control is destroyed and the cell is updated, but it is always guaranteed to be fired if the user makes a change to the cell value.

Hopefully this helps explain how it is designed to work. If you could describe the problem you're trying to solve, someone may be able to suggest alternative approaches.

AutoKAD

Ok, I see.  Thanks for the explanation.  What are the different ways of destroying the cell editor control?

For now, I decided I'll just use a right click on the control to end editing and call the operations I need.

(defun c:project1_Form1_Grid1_OnMouseDown (Button Flags X Y / Row Column)
  (if (= Button 2)
    (progn
      (setq Row (nth 0 (dcl_Grid_GetCurCell project1_Form1_Grid1))
       Column (nth 1 (dcl_Grid_GetCurCell project1_Form1_Grid1)))
      (setq a (dcl_Grid_GetCellText project1_Form1_Grid1 Row Column))
      )
    )
)

Thanks!~AutoKAD

Fred Tomke

Hm, have you already tested if pressing ENTER after selecting a new value from the drop list may end the cell edit state?
I didn't test yet but it could work.

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

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

AutoKAD

Yup.  Tried pressing ENTER, but this closes the form.  Not sure why this occurs.  Focus isn't even set on the ok or cancel button on the form and there is no (dcl_Form_Close) associated with the grid control.

Thanks!~AutoKAD

owenwengerd

Quote from: AutoKAD on May 27, 2009, 10:17:49 PM
What are the different ways of destroying the cell editor control?

It gets destroyed as soon as it loses input focus (by clicking the mouse somewhere else, for example). I think Fred's idea of using the [Enter] key to force an update should work as long as you handle the form's OnCancelClose event and prevent the form from closing in that case.

AutoKAD

Quote from: owenwengerd on May 28, 2009, 07:25:29 AM
Quote from: AutoKAD on May 27, 2009, 10:17:49 PM
What are the different ways of destroying the cell editor control?

It gets destroyed as soon as it loses input focus (by clicking the mouse somewhere else, for example). I think Fred's idea of using the [Enter] key to force an update should work as long as you handle the form's OnCancelClose event and prevent the form from closing in that case.

Ahhh.  Ok, I'll have to try that out when I get a chance.

Thanks!~AutoKAD

Fred Tomke

Hi,

Quote from: owenwengerd on May 28, 2009, 07:25:29 AM
I think Fred's idea of using the [Enter] key to force an update should work as long as you handle the form's OnCancelClose event and prevent the form from closing in that case.

additionally, I add a link with an example: link.

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

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

AutoKAD

Thanks for the link Fred!

AutoKAD