newbie questions

Started by vladimirzm, February 18, 2009, 01:01:25 PM

Previous topic - Next topic

vladimirzm

hello
i'm absolutely new in ODCL and i have some questions:

1º i'm trying to create a modal dialog with just one button (Pick button) and a label. Clic in Pick button must hides the dialog and select objects, when selection finishes the dialog must shows it and the label text changed to something like "10 objects selected". that's all, but "FORM_HIDE" method locks up autocad (as it says in the help), i thougth "FORM_SHOW" will unlocks autocad but i can't even select objects. so, how can i "restore" the show status of a modal dialog?

(defun c:sslength_Form1_GraphicButton1_OnClicked (/)
  (dcl_Form_Hide sslength_Form1 t) 
  (setq objs (ssget))
  (DCL_FORM_SHOW alttext_FORM1)
  ...
)


2º in the same dialog and when there's not objects selected, the label must display a help text (not as tooltip) when move the mouse over pick button, but i really don't understand how mouse_move works, when i try to load in vlisp editor: ; error: bad element in arguments list: 0
(defun c:sslength_Form1_GraphicButton1_OnMouseMove 0 0 0 /)
  (dcl_Control_SetCaption sslength_Form1_Label1 "This button allows you select objects")
)


3º i have some problems with ESM (spanish version), the translation is not full and is a little confusing. so i decided to install ENU version and i have this error (three times downloaded and three times the same):


thnx



owenwengerd

1) You need to put your (dcl_Form_Show) inside a while loop and re-show the form after the selection is made (with a flag to exit the while loop when the dialog should not be redisplayed). Take a look at the Selections sample for one way to do this.

2) Your c:sslength_Form1_GraphicButton1_OnMouseMove function is missing a left parenthesis after the "(defun c:sslength_Form1_GraphicButton1_OnMouseMove".

3) Try clearing your temporary files, then download the ENU version again.
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

Hello, vladimirzm,

to the first point of Owens reply I can send you a code snippet. It is part of the German help:


(defun c:proj_form_OnInitialize ()
  (princ "Hier wird der komplette Dialog mit Inhalt gefüllt.")
);  c:proj_form_OnInitialize

(defun c:proj_form_pb_accept ()
  (dcl_form_close proj_form 0)
); c:proj_form_pb_accept

(defun c:proj_form_pb_select ()
  (dcl_form_close proj_form 1)
); c:proj_form_pb_select

(defun c:proj_form_pb_cancel ()
  (dcl_form_close proj_form 2)
); c:proj_form_pb_cancel

(setq isSchleife T)
(while isSchleife
  (setq isSchleife nil) ;; um Endlosschleife bei ESC zu vermeiden
  (setq intErgebnis (dcl_form_show proj_form))
  (cond
    ((= intErgebnis 0) (princ "Hier passiert was."))
    ((= intErgebnis 1) (princ "Hier wird ein Objekt oder Punkt gewählt.") (setq isSchleife T))
    ((= intErgebnis 2) (princ "Hier passiert nichts."))
  ); cond
); while


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

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

vladimirzm

Quote2) Your c:sslength_Form1_GraphicButton1_OnMouseMove function is missing a left parenthesis after the "(defun c:sslength_Form1_GraphicButton1_OnMouseMove".
well obviously that's just here, in vlisp everything is ok:




thnx i'll try your answers

Fred Tomke

Hi, vladimirzm, do some symbols into the list behind the function name


(defun c:sslength_Form1_GraphicButton1_OnMouseMove (intFlags intX intY /)
  (dcl_Control_SetCaption sslength_Form1_Label1 "This button allows you select objects")
); c:sslength_Form1_GraphicButton1_OnMouseMove


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

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

vladimirzm

yes, it works.
anyway this isn't normal  :-\

owenwengerd

Quote from: vladimirzm on February 18, 2009, 02:59:56 PM
anyway this isn't normal  :-\

Why do you think that?

By the way, if you want to do this in the MouseMove event, I highly recommend to do it only the first time that your event handler executes, otherwise you will waste a lot of CPU cycles. For example:

(defun c:sslength_Form1_GraphicButton1_OnMouseMove (intFlags intX intY /)
  (if (not *AlreadyChangedCaption) (dcl_Control_SetCaption sslength_Form1_Label1 "This button allows you select objects"))
  (setq *AlreadyChangedCaption T)
); c:sslength_Form1_GraphicButton1_OnMouseMove
Owen Wengerd (Outside The Box) / ManuSoft