ListView SetCurSel Method not working as expected!!!

Started by renencon, June 28, 2009, 06:47:35 AM

Previous topic - Next topic

renencon

I am using SetCurSel method on a ListView control but does not work as expected.
During initialization of the form I populate the control with data arranged in three columns and use the SetCurSel method to set the initial selection on the 10th row of the list.
However when the form is displayed if you press the arrow keys on the keyboard up or down you will notice that the current selection although shows to be on item 10 is actually on item 0 and as soon as the down arrow on the keyboard is pressed the selection moves to item 1 second selection on the list.

I think this could be a bug in the SetCurSel Method of the ListView control.
Is there something else that could be wrong?

I am new to OpenDCL, using it for only a few days.
You have created an excellent tool and you have given AutoLisp the power to create user friendly interfaces extremely fast. Congratulations!!!!

Thanks!!!

I have attached the related LV.odcl file and following is the AutoLisp Code that I've used with AutoCAD 2010 plain vanilla.

(defun c:LV ( / )
  (or LoadRunTime (load "_OpenDclUtils.lsp") (exit))
  (LoadRunTime)
  (dcl_Project_Load "LV.odcl" T)
  (dcl_FORM_SHOW LV_Form1)
  ;; The Event handlers manage the form here.
  (princ)
)

(defun c:LV_Form1_OnInitialize ( / Row)
  (dcl_ListView_AddColumns LV_Form1_ListView1 '(("A") ("B") ("C")))
  (dcl_ListView_SetColumnWidth LV_Form1_ListView1 0 100)
  (dcl_ListView_SetColumnWidth LV_Form1_ListView1 1 150)
  (dcl_ListView_SetColumnWidth LV_Form1_ListView1 2 200)
  (setq Row 1)
  (repeat 100
    (setq Row (+ (dcl_ListView_AddString LV_Form1_ListView1 (strcat  (itoa Row) "\t123\t" "ABC")) 2))
    )
  ;; I think the following function SetCurSel does not work as expected
  (dcl_ListView_SetCurSel LV_Form1_ListView1 10)
)

PLEASE NOTE! Same behavior on the 5.0.2.4 release and AutoCAD 2009.

BazzaCAD

Hi renencon, welcome to the team.

Ya I can confirm this on "5.1.1.6" also.
The down arrow jumps to the top of the ListView.
I don't think it's a bug with the "SetCurSel" function, but Owen will correct be if I'm wrong.
You should report the bug here: https://sourceforge.net/tracker/?atid=923363&group_id=187950&func=browse
so we can track it.
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom