PDA

View Full Version : how to show message in popup menu [lisp]


Harry
04-06-2005, 04:39 AM
I like to use a little popup menu that shows a message for me. After pressing [OK], the menu will dissapear.

I started with this...


(defun show_msg (&key msg)
;function: show message in window
;date : 11-03-2005
;----------------------------------------------------------------------
;input : msg [string], message to show
;output: -

(SD-CREATE-MENU "test_harry"
:title "Attention!"
:controlButtons :ok-cancel-help
:contents

)

; (SD-CALL-DIALOG "test_harry"
; :parent-shell nil
; :attachment :bottomleft
; :x-offset 0
; :y-offset 0
; )
);defun



But instead of three buttons [OK][CANCEL][HELP], I like to have one [OK] button. Has some else made this very generic code before?

Best regards,

Harry

Andy Poulsen
04-06-2005, 06:46 AM
Hi Harry,

I think you're making it too difficult for yourself -- see the documentation for the function sd-display-message and see if it does what you're looking for...

For example, you could just have
(sd-display-message "Hello Harry")
which would pop up a box with "Hello Harry" in it.

Enjoy!

andy

Harry
04-08-2005, 05:03 AM
Thanks, that was exactly what I needed. So simple.....


Best regards Harry

jkramer
04-11-2005, 10:29 PM
Hi,

is there a way of making a "sd-display-message"-message appear as soon as someone clicks on the macro in the toolbox?
For instance, I made a small Lisp routine with a "calculator" for bend reliefs. When people use it, I want a message to appear that explains the meaning of the variables BEFORE they start filling them in...

Thanks!
Regards,
Jaap

dorothea
04-11-2005, 11:07 PM
Hi Jaap,

You could try it with the following keyword of sd-defdialog:
:precondition {LISP-form [nil]}
The documentation says:
"This form will be executed before the dialog appears on the screen. If the form is supplied and does not return :OK, the dialog will be cancelled (see Preconditions)."

Dorothea

Andy Poulsen
04-11-2005, 11:34 PM
Hello Jaap,

If you want a single message box to describe all the variables, Dorothea's suggestion is one way to do it. Another is to use the ":after-initialization" keyword as part of your dialog definition.

If you want a separate message for each variable, a couple of ways you can do it are to use the ":before-input" or ":show-input-tool" keywords as part of each variable's definition. This will allow you to display your message when the user clicks on the button of the variable to enter the data, or when the focus automatically moves to that variable (and can give you other flexibility as well).

Good luck!

andy

jkramer
04-11-2005, 11:42 PM
Hi,

thanks for the answers!
:before-input does the trick for me.

regards,
Jaap