Author Topic: Help Needed with Grey Out.  (Read 2950 times)

0 Members and 1 Guest are viewing this topic.

MvdP

  • Guest
Help Needed with Grey Out.
« on: November 06, 2006, 02:33:18 AM »
I need some help with this piece of code.And this is what i am trying to achieve.
I want the AL_lagen button greyed out when i select 1:1000 or 1:2000  in my list_schaal popup_list.
But it ain't working what am i doing wrong here. I am getting a to many arguments error.

DCL Code


Code: [Select]
:popup_list { key = "list_schaal"; allow_accept = true; width = 13 ; fixed_width = true; height=14;}
:radio_button { label = "Alle Lagen"     ; mnemonic = "A"; key = "Al_lagen"; width = 8;}

LSP Code

Code: [Select]

 (start_list "list_schaal")
  (setq displistschaal
(list
   "   1:1                    00"
   "   1:2                    01"
   "   1:5                    02"
   "   1:10                   03"
   "   1:20                   04"
   "   1:50                   05"
   "   1:100                  06"
   "   1:200                  07"
   "   1:500                  08"
   "   1:1000                 09"
   "   1:2000                 10"
   "   1:5000                 11"
   "   1:10000                12"
  )
  )
  (mapcar 'add_list displistschaal)
  (end_list)

(action_tile "Al_lagen"     "(progn (setq Milagen 1)(setq Stlagen 1)(setq Allagen 1))"  )
(action_tile "list_schaal" "(setq schaalecht (nth (atoi $value) displistschaal))(schaalid)"
"(if
(or
(= (atoi $value) (vl-position \"   1:500                  08\" list_schaal))
(= (atoi $value) (vl-position \"   1:1000                 09\" list_schaal))
(= (atoi $value) (vl-position \"   1:2000                 10\" list_schaal))
(= (atoi $value) (vl-position \"   1:5000                 11\" list_schaal))
(= (atoi $value) (vl-position \"   1:10000                12\" list_schaal))
)
(mode_tile \"Al_lagen\" 1) (mode_tile \"Al_lagen\" 0)
)"
)



« Last Edit: November 06, 2006, 02:40:37 AM by MvdP »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Help Needed with Grey Out.
« Reply #1 on: November 06, 2006, 02:54:35 AM »
Can you provide a "working" version of the code and DCL. ?  That may make problem solving a little more attractive proposition.

The first thing I would do is write all the code you have in the action_tiles into callable routines.

Quote
I am getting a to many arguments error.

Have you tried to trace the error in the VLIDE ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MvdP

  • Guest
Re: Help Needed with Grey Out.
« Reply #2 on: November 06, 2006, 03:15:31 AM »
I can provide a working dcl and lsp but most of it is in Dutch.And the only thing i added in my code it this piece.

Code: [Select]
"(if
(or
(= (atoi $value) (vl-position \"   1:500                  08\" list_schaal))
(= (atoi $value) (vl-position \"   1:1000                 09\" list_schaal))
(= (atoi $value) (vl-position \"   1:2000                 10\" list_schaal))
(= (atoi $value) (vl-position \"   1:5000                 11\" list_schaal))
(= (atoi $value) (vl-position \"   1:10000                12\" list_schaal))
)
(mode_tile \"Al_lagen\" 1) (mode_tile \"Al_lagen\" 0)
)"

After adding this in my working code i am getting the to manny arguments error as mentioned before.

And what do you mean with this 
Quote
write all the code you have in the action_tiles into callable routines" .?
And no i did not tried the Trace in visual lisp.becasuse i don't know how this works.!!!

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Help Needed with Grey Out.
« Reply #3 on: November 06, 2006, 03:28:16 AM »
Please post your code, I'll have a look
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Help Needed with Grey Out.
« Reply #4 on: November 06, 2006, 03:29:55 AM »
And you MUST learn to debug from the VLisp Editor ... it will teach you a lot about coding.


The help file has all the information you need to get started.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Help Needed with Grey Out.
« Reply #5 on: November 06, 2006, 03:35:00 AM »
Try this perhaps < PROGN added > ..
Code: [Select]
(ACTION_TILE
  "list_schaal"
  (PROGN
    "(setq schaalecht (nth (atoi $value) displistschaal))(schaalid)"
    "(if
(or
(= (atoi $value) (vl-position \"   1:500                  08\" list_schaal))
(= (atoi $value) (vl-position \"   1:1000                 09\" list_schaal))
(= (atoi $value) (vl-position \"   1:2000                 10\" list_schaal))
(= (atoi $value) (vl-position \"   1:5000                 11\" list_schaal))
(= (atoi $value) (vl-position \"   1:10000                12\" list_schaal))
)
(mode_tile \"Al_lagen\" 1) (mode_tile \"Al_lagen\" 0)
)")
)


BUT it looks like the or statement is faulty ...
« Last Edit: November 06, 2006, 03:38:49 AM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MvdP

  • Guest
Re: Help Needed with Grey Out.
« Reply #6 on: November 06, 2006, 03:38:00 AM »
Kerry here is the code.
(Not all the files that are needed with this code are attached.)

MvdP

  • Guest
Re: Help Needed with Grey Out.
« Reply #7 on: November 06, 2006, 03:45:36 AM »
Kerry i added your code and the to manny arguments error is gone but the button is not grey-ed out and the variables in this line

Code: [Select]
"(setq schaalecht (nth (atoi $value) displistschaal))(schaalid)"are not set.
And i sure will take a look in the help file about debugging.
« Last Edit: November 06, 2006, 03:55:56 AM by MvdP »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Help Needed with Grey Out.
« Reply #8 on: November 06, 2006, 04:11:03 AM »
Marcel, Try this for an idea ..
Code: [Select]
opzet_1 :dialog {

label = "Test for MvdP";

:popup_list {
key = "list_schaal";
allow_accept = true;
width = 30 ;
fixed_width = true;
height=14;
}
:radio_button {
label = "Alle Lagen"     ;
mnemonic = "A";
key = "Al_lagen";
width = 8;
}
ok_cancel_help;
}
Code: [Select]
(DEFUN c:opzet_1 (/)
  ;;
  ;;
  (DEFUN list_schaal_action (v)   
    (IF (MEMBER v '("9" "10"))
      (MODE_TILE "Al_lagen" 1)
      (MODE_TILE "Al_lagen" 0)
    )
  )
  ;;
  ;;
  (SETQ dcl_id (LOAD_DIALOG "opzet_1.dcl"))
  (IF (NOT (NEW_DIALOG "opzet_1" dcl_id))
    (EXIT)
  )
  (START_LIST "list_schaal")
  (SETQ displistschaal (LIST
                         "   1:1"
                         "   1:2"
                         "   1:5"
                         "   1:10"
                         "   1:20"
                         "   1:50"
                         "   1:100"
                         "   1:200"
                         "   1:500"
                         "   1:1000"
                         "   1:2000"
                         "   1:5000"
                         "   1:10000"
                        )
  )
  (MAPCAR 'ADD_LIST displistschaal)
  (END_LIST)
  ;;
  ;;
  (ACTION_TILE "list_schaal" "( list_schaal_action $value )")
  (SETQ what_next (START_DIALOG))
)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Help Needed with Grey Out.
« Reply #9 on: November 06, 2006, 04:25:44 AM »
I've left the variables open for testing.

If you don't understand what I've done with the code changes, just ask .

the
(DEFUN list_schaal_action (v)
is what I meant by 'move code you have in the action_tiles into callable routines '
« Last Edit: November 06, 2006, 04:26:55 AM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MvdP

  • Guest
Re: Help Needed with Grey Out.
« Reply #10 on: November 06, 2006, 04:39:35 AM »
Thanks Kerry i added list_schaal_action to my code and it is working great .
Thank you very much for your trime.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Help Needed with Grey Out.
« Reply #11 on: November 06, 2006, 04:50:55 AM »
My pleasure.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

sinc

  • Guest
Re: Help Needed with Grey Out.
« Reply #12 on: November 07, 2006, 09:44:08 PM »
And you MUST learn to debug from the VLisp Editor ... it will teach you a lot about coding.

Most definitely.  A debugger is a programmer's best friend.