TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Brick_top on October 08, 2014, 04:38:17 AM
-
Hi there I have a popup_list and an edit_box.
and I would like to disable the edit_box when a certain popup_list item is selected.
problem is I can't figure out the way to do it.
I know it is related to the (mode_tile) function
thanks
-
(mode_tile <Key> 0) ;; enables <Key> control
(mode_tile <Key> 1) ;; disables <Key> control
What the question is? You can't write callback function? Please show your code and dcl
-
I start the list in the popup list with this
(start_list "info_lst" 3)
(mapcar 'add_list info_lst)
(end_list)
the list might contain different number of items
("Nova" "Info 1" "Info 2")
I also have an edit_box with the key "inf2"
I want to have it greyed out whenever I don't have the item "Nova" in the popup_list selected.
-
I tried doing this but with no luck
(defun greyt (info_lstr)
(if (= "0" info_lstr)
(mode_tile "inf2" 0)
(mode_tile "inf2" 1)
);if
);defun greyt
(action_tile "info_lst" "(greyt info_lstr)")
(defun greyt (info_lstr)
(setq info_lstr (get_tile "info_lst"))
(if (= "0" info_lstr)
(mode_tile "inf2" 0)
(mode_tile "inf2" 1)
);if
);defun greyt
(action_tile "info_lst" "(greyt info_lstr)")
I think I solved it! this line was missing -> (setq info_lstr (get_tile "info_lst"))
-
Brick_top.
< .. > Please show your code and dcl
This sort of request is not made because we like typing .. there is a reason for it !!
7 times out of 10 putting together and testing a succinct sample to demonstrate the problem will help resolve the issue even before you post your question..
Not doing so makes us ( well, me anyway) wonder why we should bother helping someone who won't help themselves.
succinct:
(especially of something written or spoken) briefly and clearly expressed.
Characterized by clear, precise expression in few words;
-
thanks kerry, I understand that.
I guess I wrongly assumed that my request was something standard so I didn't need to post my code.
-
thanks kerry, I understand that.
I guess I wrongly assumed that my request was something standard so I didn't need to post my code.
I know what you are saying ; but you will find you'll get a better quality of response if you are seen to make the effort. AS it was 'someone' ( well, several someones) would need to build their own sample to test and prove a solution.
Regarding your solution:
I can't see how that setq will resolve your problem as originally posted ... mainly because I can't imagine what your code looked like.
Nor can anyone else who potentially finds this thread while searching for a similar issue.
Regards,
-
This should accomplish the same:
(defun greyt ()
(mode_tile "inf2" (if (= "0" (get_tile "info_lst")) 0 1))
)
(action_tile "info_lst" "(greyt)")
And this:
(defun greyt ()
(mode_tile "inf2" (if (= "0" $value) 0 1))
)
(action_tile "info_lst" "(greyt)")
-
I know what you are saying ; but you will find you'll get a better quality of response if you are seen to make the effort. AS it was 'someone' ( well, several someones) would need to build their own sample to test and prove a solution.
thanks! fortunately that makes perfect sense, I'll keep that in mind whenever I post.
Regarding your solution:
I can't see how that setq will resolve your problem as originally posted ... mainly because I can't imagine what your code looked like.
Nor can anyone else who potentially finds this thread while searching for a similar issue.
Regards,
I tried many things from some webpages but don't remember right now as I deleted them.
I'm going to try to explain my last effort and what I think that setq line solved.
;;; this is the version of code I thought would work
;here I wanted to enable the edit_box "inf2"
;whenever the item "0" of the popup_list "info_lst" was selected
(defun greyt (info_lstr)
(if (= "0" info_lstr) ;info_lstr was defined before in the code in this function:
; (defun ad2 ()
;>>>>>>>(setq info_lstr (get_tile "info_lst")) "info_lst" is the key of the popup list
; );ad2
(mode_tile "inf2" 0)
(mode_tile "inf2" 1)
);if
);defun greyt
(action_tile "info_lst" "(greyt info_lstr)")
;as I understand it the problem with this ideia was that the value of the popup list
;to be checked for disabling the edit_box was only retrieved when exiting the dialog
;in this line bellow, so the function greyt couldn't check the value.
(action_tile "accept" "(setq ddiag 2)(ad2)(done_dialog)");note the call for the (ad2) function
;that is why I added the (setq info_lstr (get_tile "info_lst")) to the greyt function
(defun greyt (info_lstr)
(setq info_lstr (get_tile "info_lst")) ;<- <- <- <- <-
(if (= "0" info_lstr)
(mode_tile "inf2" 0)
(mode_tile "inf2" 1)
);if
);defun greyt
;so that whenever I use the "info_lst" popup_list the function greyt is
;called to check which item is selected to disable or enable the edit_box
(action_tile "info_lst" "(greyt info_lstr)")
I hope this can help someone, I tried to be as succint as I could. At least I tried my best
-
This should accomplish the same:
(defun greyt ()
(mode_tile "inf2" (if (= "0" (get_tile "info_lst")) 0 1))
)
(action_tile "info_lst" "(greyt)")
And this:
(defun greyt ()
(mode_tile "inf2" (if (= "0" $value) 0 1))
)
(action_tile "info_lst" "(greyt)")
thanks roy your solution is much more elegant