Author Topic: Disabling list box in DCL dialog  (Read 9716 times)

0 Members and 1 Guest are viewing this topic.

vicoco

  • Mosquito
  • Posts: 6
Disabling list box in DCL dialog
« on: May 12, 2021, 11:27:07 AM »
I'm sure it'll be so simple, but I can't do it...

Can I enable/disable a list box in a dialog box depending on a toggle is off/on?
Can I disable a list box using mode_tile? I'm not successful...

I think that the appended example is enough to understand that I want to do:
- if toggle button ("None") is True -> element list will be disabled to avoid selecting items;
- if toggle button is False -> element list will be enabled.


roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Disabling list box in DCL dialog
« Reply #1 on: May 12, 2021, 01:30:59 PM »
This should work:
Code: [Select]
(mode_tile "tileKey" 1) ; Disable.
(mode_tile "tileKey" 0) ; Enable.

vicoco

  • Mosquito
  • Posts: 6
Re: Disabling list box in DCL dialog
« Reply #2 on: May 14, 2021, 06:17:24 AM »
This should work:
Code: [Select]
(mode_tile "tileKey" 1) ; Disable.
(mode_tile "tileKey" 0) ; Enable.

It should work, but how??

I use something like this:

Code: [Select]
(if (= (get_tile "togglekey") True)
(mode_tile "listboxkey" 1)
(mode_tile "listboxkey" 0))

I tried to do it directly in the main function.

I tried to defun a new function in this way:
Code: [Select]
(defun DisableList ()
  (if
    (= (get_tile "togglekey") True)
    (mode_tile "listboxkey" 1)
    (mode_tile "listboxkey" 0)
  )
)

and adding the next line in the main function:
Code: [Select]
(action_tile "togglekey" "(DisableList)")
I know that something escapes me, but I can't find the failure (my knowledge is still very low).

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Disabling list box in DCL dialog
« Reply #3 on: May 14, 2021, 07:10:40 AM »
The get_tile function returns a string. In the case of a toggle either "0" or "1".
Code - Auto/Visual Lisp: [Select]
  1. (defun DisableList ()
  2.   (if (= (get_tile "togglekey") "1")
  3.     (mode_tile "listboxkey" 1)
  4.     (mode_tile "listboxkey" 0)
  5.   )
  6. )

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: Disabling list box in DCL dialog
« Reply #4 on: May 15, 2021, 07:13:19 PM »
Alternatively, you could use this:
Code - Auto/Visual Lisp: [Select]
  1. (action_tile "togglekey" "(mode_tile \"listboxkey\" (atoi $value))")

vicoco

  • Mosquito
  • Posts: 6
Re: Disabling list box in DCL dialog
« Reply #5 on: May 18, 2021, 11:05:58 AM »
The get_tile function returns a string. In the case of a toggle either "0" or "1".
Code - Auto/Visual Lisp: [Select]
  1. (defun DisableList ()
  2.   (if (= (get_tile "togglekey") "1")
  3.     (mode_tile "listboxkey" 1)
  4.     (mode_tile "listboxkey" 0)
  5.   )
  6. )

The solution was so easy that I feel stupid  :-(

Alternatively, you could use this:
Code - Auto/Visual Lisp: [Select]
  1. (action_tile "togglekey" "(mode_tile \"listboxkey\" (atoi $value))")

Thank you very much, both solutions work perfectly.