Jump to content

Need help with proper spacing in a dialog box


drafter_joe

Recommended Posts

Looks great, Lee! Thank you!

 

You're welcome!

 

Yes, I have a question, or two, about the section of code below.

(mapcar 'mode_tile '("ed1""ed2""ed3""ed4""ed5""ed6""ed7")
               (cadr
                   (assoc key
                      '(   ("sl1" (0 0 1 1 1 1 1))
                           ("sl2" (0 0 1 1 0 1 1))
                           ("sl3" (1 1 1 1 1 0 1))
                           ("sl4" (1 1 1 1 1 0 0))
                           ("sl5" (0 0 0 0 1 0 1))
                       )
                   )
               )
           )

I think I can see overall what is happening here, this what makes the edit boxes available or not available?

 

Could you kindly explain the "1's" and the "0's", please?

 

You are correct that this mapcar expression controls the enabling & disabling of the edit box tiles in the dialog, dependent upon which radio button is selected.

 

Here, the argument 'key' represents the selected radio button tile; the value of this argument is queried against an association list in which each item contains the tile key and an accompanying list of integers.

 

The mode_tile function controls whether a DCL tile is enabled or disabled: supplied with a DCL tile key and a second argument equal to 1 results in the tile being disabled; a second argument equal to 0 results in the tile being enabled.

 

As described by my tutorial on the subject, the mapcar function will evaluate a supplied function with arguments sourced from one or more supplied lists.

 

In this case, the mapcar function is supplied with the mode_tile function, a list of DCL tile keys, and a list of integers equal to 1 or 0, e.g. if the radio button "sl1" is selected:

(mapcar 'mode_tile
  '("ed1""ed2""ed3""ed4""ed5""ed6""ed7")
  '(0 0 1 1 1 1 1)
)

As described by my tutorial, this expression is equivalent to:

(mode_tile "ed1" 0)
(mode_tile "ed2" 0)
(mode_tile "ed3" 1)
(mode_tile "ed4" 1)
(mode_tile "ed5" 1)
(mode_tile "ed6" 1)
(mode_tile "ed7" 1)

Link to comment
Share on other sites

You're welcome!

 

 

 

You are correct that this mapcar expression controls the enabling & disabling of the edit box tiles in the dialog, dependent upon which radio button is selected.

 

Here, the argument 'key' represents the selected radio button tile; the value of this argument is queried against an association list in which each item contains the tile key and an accompanying list of integers.

 

The mode_tile function controls whether a DCL tile is enabled or disabled: supplied with a DCL tile key and a second argument equal to 1 results in the tile being disabled; a second argument equal to 0 results in the tile being enabled.

 

As described by my tutorial on the subject, the mapcar function will evaluate a supplied function with arguments sourced from one or more supplied lists.

 

In this case, the mapcar function is supplied with the mode_tile function, a list of DCL tile keys, and a list of integers equal to 1 or 0, e.g. if the radio button "sl1" is selected:

(mapcar 'mode_tile
  '("ed1""ed2""ed3""ed4""ed5""ed6""ed7")
  '(0 0 1 1 1 1 1)
)

As described by my tutorial, this expression is equivalent to:

(mode_tile "ed1" 0)
(mode_tile "ed2" 0)
(mode_tile "ed3" 1)
(mode_tile "ed4" 1)
(mode_tile "ed5" 1)
(mode_tile "ed6" 1)
(mode_tile "ed7" 1)

 

Great job on the explanation, Lee! :thumbsup:

 

I'm sure I'll understand this better now when I more carefully read through the code. I'll be looking into your tutorial for sure, now that the 'mapcar' function is starting to make sense. I can see that I will be incorporating it more once I understand it better.

 

I can bet as I continue on with this routine I'm building, I'll be in need of assistance along the way. I very much appreciate the help from you and BIGAL so far! :D

 

On a curious note, how did you acquire your knowledge of LISP and such? Academic schooling or self taught through trial and error?

Link to comment
Share on other sites

Great job on the explanation, Lee! :thumbsup:

 

Thanks!

 

On a curious note, how did you acquire your knowledge of LISP and such? Academic schooling or self taught through trial and error?

 

I'm entirely self-taught.

Link to comment
Share on other sites

I'm entirely self-taught.

 

That's quite an accomplishment, Lee! :thumbsup:

 

 

FYI: After a couple of days of experimenting with your code, I'm going to have a few questions. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...