Prompt in the command line.

Started by velasquez, August 15, 2007, 10:44:40 AM

Previous topic - Next topic

velasquez

I used the function of error of Selections.lsp of the examples of OpenDcl to show my problem. 
I need to play a message in the line of command of AutoCAD, when the user presses ESC. 
Attention cannot use DCL_MESSAGEBOX. 
I need to use (princ "FUNÇÃO CANCELADA PELO USUÁRIO ") or similar thing.
The message is always hidden of the user it can only be seen with the key F2. 
Does anybody can me to say because this happens? 

Thanks


;;Standard error trap
(DEFUN *error* (msg)
        (WHILE (< 0 (GETVAR "cmdactive")) (COMMAND))
        (COND
            ((NOT msg))                           ; no error, do nothing
            ((VL-POSITION
                 (STRCASE msg T)                  ; cancel
                 '("console break" "function cancelled" "quit / exit abort")
             )
;; just for the Demo ...
;;;(DCL_MESSAGEBOX ".... Quit/Exit/Abort/*Cancelled*"
;;;"Inside Error Handler" ; Form Caption
;;;2                    ; OK Button Only
;;;1                    ; exclamation point icon is displayed in the message box.
;;;             )
;;;MY MESSAGE
             (princ "FUNÇÃO CANCELADA PELO USUÁRIO")
            )
            ((PRINC (STRCAT "\nApplication Error: " (GETVAR "errno") " :- " msg)
             )
            )
        )
        (SETVAR "errno" 0)
        ;;
        ;;       
        (SETQ bflag nil)
        (DCL_FORM_CLOSE Selections_Form)
        (SETVAR "BLIPMODE" blipper)
        (VL-CMDF "._REGEN")
        (SETVAR "CMDECHO" echo)
        (PRINC)
    )


owenwengerd

Quote from: velasquez on August 15, 2007, 10:44:40 AM
The message is always hidden of the user it can only be seen with the key F2. 

The REGEN command causes it. You'll need to either print the message after the regen command is executed, or remove the regen command from the code.

velasquez

Hi Owen, 
 
I made the changes that you suggested, I eliminated the command REGEN and the whole rest but the problem continues. 
I posted a video please showing this it accesses in
http://www.easycad.com.br/opendcl/prompt-commandline.zip 
See that in some situation the problem doesn't appear. 
Why does this happen? 
Thanks

Fred Tomke

Hi, velasquez,

is it necessary to send the message to the commandline? Could a odcl_messagebox help?
Can you upload the lisp and odcl file for testing?

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

velasquez

Hi Fred, 

I need to place several messages for this reason for the user I need them in the command line. 
odcl_messagebox is excellent but it doesn't help me in this case. 
 
Thanks for the help

Fred Tomke

Hi velasquez,

hm, I've attached an example, maybe it will help. It will show you how do I solve that normally.

Regards, Fred

P.S. I'm not familiar with the new kind of storing projects in lspfiles. So I use the good old odcl files.

[attachment deleted by admin]
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Quote from: velasquez on August 16, 2007, 06:26:23 AM
I made the changes that you suggested, I eliminated the command REGEN and the whole rest but the problem continues.

I don't have time to track down the reason. It can happen any time a modeless operation calls acedPostCommandPrompt(), which is the case when a modeless OpenDCL form calls an event handler. That may be the case here.

velasquez

Hi Fred, 
Thank you very much for your file, very good. 
The problem with the command line happens when the function is finished by an ESC. 

I think OpenDcl prints a clean prompt. 


Regards, Velasquez

P.S I created the problem in your file for you to see.

[attachment deleted by admin]

Fred Tomke

#8
Hi,

it's not a problem of OpenDCL, I think. Substitute the while()-condition (don't know the right word) with the following:


  (while continue
    (setq continue "select")
;;;    (dcl_form_show vela_vela)
    (cond
      ((= continue "cancel") (princ "\nNothing will happen, you pressed Cancel!") (setq continue nil))
      ((= continue "accept") (princ "\nSomething will happen, you pressed OK!") (setq continue nil))
      ((= continue "select") (while (selpoint)))
    ); cond
  ); while



You can see, no form is shown. But an additional command-line is added nevertheless. We tell our customers to use 3 commandlines at least. 2 are too less.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

I had a final test with sysvar NOMUTT=1 - but an additional commandline was added. Use 3 commandlines  ;D
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

velasquez

I tested Selections.lsp in AutoCAD 2006 with the change in the function *error * and any problem didn't happen with the command line.   
The message was not hidden even with (VL-CMDF " ._REGEN ").
I didn't test in 2008
Perhaps this can help to discover the track

Thanks