Option List Clear Problem

Started by Kerry, July 16, 2008, 04:08:13 PM

Previous topic - Next topic

Kerry

I'm having problems clearing and replacing the Strings in an Option List.
The Clear Method  only works if I select (give focus to) the Option Control first, then select the button.
The AddString Method works as expected.
The DeleteString Method appears to not work.
The AddList Method works as expected

Note the Row count displays as if the items were removed :-)

This option is probably not used much, but I'd like to have the options dynamic, dependant on run-time conditions.

Any ideas ?


Code (autolisp) Select


;;;----------------------------------------------------------------------------
(defun c:doit () (clearoptionstest) (princ))
;;--------------------

(defun clearoptionstest ()
  (dcl_project_load "ClearOptionsTest.odcl" t)
  (dcl_form_show clearoptionstest_form1)
  (princ)
)
;;;----------------------------------------------------------------------------
(defun _setcountlabel ()
  (dcl_control_setcaption
    clearoptionstest_form1_countlabel
    (strcat
      "Row Count is "
      (itoa
        (dcl_optionlist_getcount clearoptionstest_form1_optionlist1)
      )
    )
  )
)

;;;----------------------------------------------------------------------------
;;; API EVENTS
;;;----------------------------------------------------------------------------
(defun c:clearoptionstest_form1_oninitialize (/)
  (dcl_optionlist_clear clearoptionstest_form1_optionlist1)
  (dcl_optionlist_addlist clearoptionstest_form1_optionlist1
                          (list "1" "2" "3")
  )
  (_setcountlabel)
)
;;--------------------
(defun c:clearoptionstest_form1_addstringbtn_onclicked (/)
  (dcl_optionlist_addstring clearoptionstest_form1_optionlist1
                            "Roses are Red, Violets are Blue ... "
  )
  (_setcountlabel)
)
;;--------------------
(defun c:clearoptionstest_form1_removefirstbtn_onclicked (/)
  (dcl_optionlist_deletestring clearoptionstest_form1_optionlist1 0)
  (_setcountlabel)
)
;;--------------------
(defun c:clearoptionstest_form1_clearbtn_onclicked (/)
  (dcl_optionlist_clear clearoptionstest_form1_optionlist1)
  (_setcountlabel)
)
;;--------------------
(defun c:clearoptionstest_form1_addlistbtn_onclicked (/)
  (dcl_optionlist_clear clearoptionstest_form1_optionlist1)
  (dcl_optionlist_addlist clearoptionstest_form1_optionlist1
                          (list "First Option Field"
                                "Second Option Field"
                                "Third Option Field"
                          )
  )
  (_setcountlabel)
)

;;;----------------------------------------------------------------------------
Perfection is not optional.
My other home is TheSwamp

BazzaCAD

Welcome back, long time no see. :)
I'm guessing bug, maybe Owen will confirm.
You're on the latest build right?
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

Kerry

Hi Barry

Build 5.0.0.19


I've been flat out busy ... hardly been able to find time to scratch myself  ;)
Perfection is not optional.
My other home is TheSwamp

Kerry


Addendum:
I've tried the SetFocus Method for the OptionList Programmatically ..
and tried the ForceUpdateNow Method

it may be a buglet.
Perfection is not optional.
My other home is TheSwamp

owenwengerd

This should be fixed in Alpha 20.  BTW, it would help me keep organized if you could add bug reports to the bug tracker on SourceForge.

Kerry


Hi Owen

It was added to SourceForge .. just a bit late 'cause I couldn't remember my access details :(

The optionlist_DeleteString does not work in Alpha 20 ;
The optionlist_Clear works as expected now.

regards
Kerry
Perfection is not optional.
My other home is TheSwamp

Kerry

QuoteSee if you have better luck after changing
"Drag/Drop Allow Begin" to False for the [Remove first] button.

Yes, that did the trick!

Thanks

Perfection is not optional.
My other home is TheSwamp