Picture Box showing a picture for an established number of seconds only?

Started by Iulian, January 17, 2012, 07:35:06 AM

Previous topic - Next topic

Iulian

Hi, I need to know if the Picture Box instrument has some option which can be used to show a picture for an established number of seconds (for example 5 sec.)

Thanks in advance.




Fred Tomke

Hi, Iulian, do you mean that it should disappear after a while?
In a modeless form I can imagine that dcl_delayedinvoke would help. Just create a method that would be called by dcl_delayedinvoke after the given time. Not sure if it also works in modal forms.
Otherwise you remove the picture when your progress has been finished.

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

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

Iulian

Hi Fred, I tried to do what yo said but, it doesn't work...the code used is the following:


(defun delete_curent_picture ( / ) ;erase the current picture and sets the picture which should remain for 5 sec.
  (dcl_PictureBox_Clear project_Form4_PictureBox2)
  (dcl_Control_SetPicture project_Form4_PictureBox2 PictureID_current)
)

(defun c:project_Form4_CheckBox1_OnClicked (Value /)   ; checkbox which triggers the function above
  (setq PictureID_current (dcl_Control_GetPicture project_Form4_PictureBox2)) ; in PictureID_current  is saved the ID of current picture
  (dcl_DelayedInvoke DelayMilliseconds 5000 delete_curent_picture) ; there is triggered the delete_curent_picture above mentioned.
)

This is the error code returned by the AutoCAD prompter command:

Command: ; error: invalid data type or data overflow: #<USUBR @099fbdd4
delete_curent_picture>


I must mention that I use a modal form and, between the two actions (appearance and disappearance of the picture) I don't have any other action.


Thank you
Iulian.

roy_043

The approach that Fred suggested does not work for a modal form.
The code below does work but during the delay your program will be suspended.
Code (autolisp) Select

(command "_.OPENDCL")
(dcl_Project_Load "DelayedErase" 'T)

(defun delete_curent_picture ( / )
  (princ "\nNow we wait... ")
  ; (sleep 5000) ; Bricscad has the built-in (sleep) function.
  (command "_.delay" 5000)
  (dcl_PictureBox_Clear DelayedErase_Form1_PictureBox1)
)

(defun c:DelayedErase_Form1_TextButton1_OnClicked (/)
  (delete_curent_picture)
  ; (dcl_DelayedInvoke 5000 "delete_curent_picture") ; Does not work for a modal form.
)

(defun c:DelayedErase ()
  (dcl_Form_Show DelayedErase_Form1)
)


An alternative could be to use an animated gif image. But note:
Quote from: owenwengerd on June 03, 2010, 08:37:56 AM
You should be able to use the HTML control to display a gif, but there is no .gif support in native OpenDCL code (because .gif support requires a license from CompuServe).

BTW: Your call to (dcl_DelayedInvoke) did indeed have wrong arguments.

Iulian