OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: PrWork1 on March 09, 2010, 01:03:47 AM

Title: PictureBox at Palette: Enable clear control
Post by: PrWork1 on March 09, 2010, 01:03:47 AM
I am having trouble writing the code for the following situation:
I have paintBox on Palette

;;;1st paint box
(dcl_PictureBox_DrawSolidRect UI02_dclToolBox_pbMatColor (List (list 0 0 50 50 2)  )))
;;; 2nd enabe control
(dcl_Control_SetEnabled 02_dclToolBox_pbMatColor T)

When I enable control, my solidrect clear.
When I comment line  (dcl_Control_SetEnabled 02_dclToolBox_pbMatColor T) all OK/

Why?




Title: Re: PictureBox at Palette: Enable clear control
Post by: Fred Tomke on March 09, 2010, 01:51:04 AM
Hi, PrWork1,

I do not know much about the events and your code at all.
I recommend you to enable the picturebox's OnPaint event. Then write the line
Code (autolisp) Select
(dcl_PictureBox_DrawSolidRect UI02_dclToolBox_pbMatColor (List (list 0 0 50 50 2)  )))
into this event.

In some situations a picture box gets repainted. So you have to make sure that you either redraw the picturebox's content after repainting (using the OnPaint event) OR (and now I hope Owen will have a look at my post to correct me) you do not activate OnPaint event but you will store the image. But I do not have any experience in that:

Code (autolisp) Select

;;;1st paint box
(dcl_PictureBox_DrawSolidRect UI02_dclToolBox_pbMatColor (List (list 0 0 50 50 2)  )))
;;; 2nd store the content
(dcl_PictureBox_StoreImage UI02_dclToolBox_pbMatColor)
;;; 3rd enable control
(dcl_Control_SetEnabled 02_dclToolBox_pbMatColor T)


Have a look at StoreImage (http://www.opendcl.com/HelpFiles/index.php?page=Reference/Method/PictureBox/StoreImage.htm) method and please give it a try and let me know.

Regards,
Fred
Title: Re: PictureBox at Palette: Enable clear control
Post by: PrWork1 on March 09, 2010, 03:18:23 AM
Many thanks to rapid and complete answer.
I call the SaveImage Method, all OK!