Author Topic: Enable/disable DCL textbox with radio buttons  (Read 4858 times)

0 Members and 1 Guest are viewing this topic.

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Enable/disable DCL textbox with radio buttons
« on: December 01, 2011, 11:29:34 AM »
I'm venturing into my old stomping grounds and can't remember/figure out how to change the editable state of a text box when a radio button is selected.

I have 2 radio buttons (Yes & No).  When I click on No I want a text box to become enabled.  When I click on Yes I want the text box to become DISabled.  I know I need to use MODE_TILE = 1 or 0 but I can't remember how to put it to work.

A little help please?
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Enable/disable DCL textbox with radio buttons
« Reply #1 on: December 01, 2011, 11:33:08 AM »
It works counter to one's intuition, mode_tile 0 = enabled, 1 = disabled, e.g. (mode_tile "key" 0) ;; enabled.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Enable/disable DCL textbox with radio buttons
« Reply #2 on: December 01, 2011, 11:35:36 AM »
It works counter to one's intuition, mode_tile 0 = enabled, 1 = disabled, e.g. (mode_tile "key" 0) ;; enabled.
I know that much.  I just can't remember/figure out how to make it do what I want.  (OOCG thread)
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Enable/disable DCL textbox with radio buttons
« Reply #3 on: December 01, 2011, 11:37:35 AM »
Apply those mode_tile expressions within the action_tile statements for your radio_buttons.

i.e.
Code: [Select]
(action_tile "radio_button_1" "(mode_tile \"text_box_1\" (atoi $value))")
Or
Code: [Select]
(action_tile "radio_button_1" "(mode_tile \"text_box_1\" (- 1 (atoi $value)))")
Depending on the behaviour you are looking for...

It works counter to one's intuition...

Made all the more confusing since set_tile is the 'right' way around..

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Enable/disable DCL textbox with radio buttons
« Reply #4 on: December 01, 2011, 11:48:46 AM »
Also consider
Code: [Select]
(action_tile "radio_button_ON" "(mode_tile \"text_box_1\" 0)")
(action_tile "radio_button_OFF" "(mode_tile \"text_box_1\" 1)")
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Enable/disable DCL textbox with radio buttons
« Reply #5 on: December 01, 2011, 01:07:27 PM »
Thanks everyone!
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Enable/disable DCL textbox with radio buttons
« Reply #6 on: December 01, 2011, 02:06:21 PM »
For the record... here's what I ended up doing.

Code: [Select]
(action_tile "optYes" "(setq strYes 1) (UpdateTextBoxes))")
(action_tile "optNo"  "(setq strYes 0) (UpdateTextBoxes))")

Code: [Select]
(defun UpdateTextBoxes ( / )
   (if (= strYes 1)
      (progn
         (mode_tile "txtLength" 1)
         (mode_tile "txtWidth" 1)
      )
      (progn
         (mode_tile "txtLength" 0)
         (mode_tile "txtWidth" 0)
      )
   )
)
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Enable/disable DCL textbox with radio buttons
« Reply #7 on: December 01, 2011, 02:09:30 PM »
Sans the global:

Code: [Select]
(action_tile "optYes" "(UpdateTextBoxes 1)")
(action_tile "optNo"  "(UpdateTextBoxes 0)")

Code: [Select]
(defun UpdateTextBoxes ( strYes )
    (mode_tile "txtLength" strYes )
    (mode_tile "txtWidth" strYes )
)

PS: Ib4 Lee.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Enable/disable DCL textbox with radio buttons
« Reply #8 on: December 01, 2011, 02:10:41 PM »
Good catch.   :oops:


I haven't done LSP in what seems like years.  Thanks again!
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Enable/disable DCL textbox with radio buttons
« Reply #9 on: December 01, 2011, 04:00:24 PM »
If it's a Yes/No usually a check box is used. Just the way I usually do it. 8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Enable/disable DCL textbox with radio buttons
« Reply #10 on: December 01, 2011, 04:24:02 PM »