OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: mr nick on April 07, 2009, 08:57:00 AM

Title: dcl_Control_SetBackColor not working on slides
Post by: mr nick on April 07, 2009, 08:57:00 AM
I'm trying to change the background color of my slides when I select them but nothing is happening. If I use the highlight function, this works with no problems but it's just too subtle so I'd much prefer to change the entire background. If I set a color in the studio, the color shows correctly but if I try to alter it from code, nothing happens - no errors, no change.

Is this a bug or am I doing something wrong?
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: docsaintly on April 07, 2009, 01:25:41 PM
Please post the code you are using so we can take a look :)
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: mr nick on April 07, 2009, 05:30:10 PM
Here is a simple example. The dialog has a single slide with the background defined in the studio as green. Clicking the button should, if I'm doing things correctly, change the background to yellow but doesn't.

If anyone can point out the error of my ways or confirm it as a bug I'd be most appreciative.

Code (autolisp) Select


(defun c:slidex (/ slidedia )
  (setq slidedia
    '("YWt6AygMAACfU3xZBuKT6LUVbS9quMGqSMczXTy/ucyu9Ht3ugjkWNB6OzrTK33AbjztMCUT5Pb2"
    "szAJqIkwSVAixI53QIjQCplhnmFehqTHL2Wxx/cNGUDzu1xoumeYj8WJohGQnQJJJ60mEt4LWwKq"
    "T/9H4jx7QBx+IFv+EAcUi75W2JqyH3pgWJvg6J7C4lsHjdo/J7DKqvG0TVURBxqaYmzkzFNY+oxs"
    "GUGpLrtv97W1mzdVscgoo+KriBLSEQvMZuisyhYXYUws5O/RcPccMJAnCtw5O8u5XKK+ROZmRK5E"
    "2tQVWRRGUz2lfI18w6EVJF+Y3lb6cA2wNKed85bnJfbJTtihTyH3sWyJxIgJKpFLq7FtQQ2PiIUx"
    "9uFsQViAMgQLnFEQAqSuIj5c5mJjIQGltwTw0C495unvNuY/qe17x5JM0unp2uhyjUxadewnWRrv"
    "A2Ls2fGHSHWsf21yUMpm1epF/VCnDk2QlAlX0di/2fZhrBxB3LcHPo+J95FvoVsw7GAxH1ZH8Fah"
    "3oZ7rFVvYVgglYoKrLIAuZnr8S+CL5zluqn30W8hW8A8AueGbI87nH2qgZ0qwWayMbKwsXm5yLOF"
    "XrvkjxFXO0F4hLOGCT+MSQf+pBHagJINAiUHcecRUY9mjxAcyK5YJIHu25QWJzRtwTk1SM3bxDVG"
    "/VTIHTgIvVTYuyo1Z1Qa5j+bBjpOa+iUbZ/kBiiJfUwsAWclb4O7VryTYjuCps9cuBP3kH8bsjS3"
    "mqHJHUtEpE9qGup7l9tRg9S2hXDHMb3i2krVb7HHyoTaBZZSqyn2Ac9zEr4xyP/bErNIHWXT3hMY"
    "bsuzSIJ/pV5os+2bpFbbW5MT2sckyMeOZUjMbWDLL0JcyzKVRvuBqHePQRJjg21ryDBhKKBEBAJ9"
    "k6nsww==")
  );setq
  (dcl_Project_import slidedia nil nil)
  (dcl_Form_Show example_form1)
  (dcl_Project_Unload "example" t)
  (princ)
);defun

(defun c:example_Form1_btnChange_OnClicked (/)
  (dcl_Control_SetBackColor example_Form1_SlideView1 2)
)
(defun c:example_Form1_btnCancel_OnClicked (/)
  (dcl_Form_Close example_form1)
)

Title: Re: dcl_Control_SetBackColor not working on slides
Post by: owenwengerd on April 07, 2009, 06:27:19 PM
Thanks for the sample code.  It's a bug.  I've fixed it now for the next build.
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: mr nick on April 07, 2009, 06:51:24 PM
Quote from: owenwengerd on April 07, 2009, 06:27:19 PM
Thanks for the sample code.  It's a bug.  I've fixed it now for the next build.

Thanks Owen. Any ideas on an ETA for the next build?
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: Fred Tomke on April 08, 2009, 12:25:01 AM
Hi,

Sorry for my silly question, but - what is an ETA?

Fred
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: owenwengerd on April 08, 2009, 05:50:04 AM
ETA = "Estimated Time of Arrival"

In this case, ETA is April 13.
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: Fred Tomke on April 08, 2009, 05:56:40 AM
Aaah, ok, thanks, Owen.

Fred
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: mr nick on April 13, 2009, 12:53:31 AM
Just downloaded the updated arx and the slide backgrounds now work as expected. Thanks Owen.
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: Danner on April 23, 2009, 03:49:26 AM
Hi,

I've just noticed exactly the same issue with BlockViews too.  Works with highlight, but not background colour.

Cheers
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: owenwengerd on April 23, 2009, 07:20:56 PM
The BlockView should not have a background color property, because the background color is determined by AutoCAD and cannot be set. I will remove that property for the next build and correct the documentation.
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: Fred Tomke on April 23, 2009, 10:33:56 PM
Hello,

Quotethe background color is determined by AutoCAD

that is new to me. In ObjectDCL I could set the BackColor to -16 so a drawn preview block could be placed on the form as if it was drawn directly on the form.
It would be very unfortunate to me, if this wouldn't work any longer (see attachment BlockView.png).

What I don't understand is that the backcolor property work in OpenDCL as you can see in the attachment BlockLin.png. So why should this be removed?

Fred
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: Danner on April 24, 2009, 01:05:08 AM
Owen,  I don't want to seem churlish, because I am so indebted to you.  However,  I was setting Background colour in BlockViews worked quite happily in v4, so why not v5?
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: owenwengerd on April 24, 2009, 05:04:43 AM
No problem to correct me when I'm wrong. I'll see if I can figure out why this would have changed.
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: owenwengerd on April 25, 2009, 07:37:46 AM
After some further testing, I see that the block view (and hatch) controls do use the background color that is set at design time, but they apparently cache that background color and repaint with the original background color at runtime. This means that even though the new background color is actually painted, it then gets painted over with the cached original background color. This presents a bit of a dilemma, because caching the displayed graphics is a performance improvement. Those controls use AutoCAD AcGsView control internally, and while I could force that control to be recreated every time the background color changes, it would cause a noticeable delay at runtime.

How important is it to you guys to be able to change the background color of block view and hatch controls at runtime? Is it worth the performance penalty?
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: velasquez on April 25, 2009, 11:25:17 AM
This penalty until today it didn't harm my work, and I believe that nobody has noticed this.

Velasquez
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: Danner on April 26, 2009, 02:36:27 AM
I would take the perfomance penalty too, (assuming its just for this control and function). I never noticed the issue in v4.  I use SetBackColor as a quick and  easy way to denote a selected Blockview "control".  For me SetHighlight is just not noticable enough, especially when you have several blockviews on one form.


Title: Re: dcl_Control_SetBackColor not working on slides
Post by: Fred Tomke on April 26, 2009, 11:16:40 PM
Hello Owen,

To answer your question I will say that when I use SetBackColor at runtime then only to highlight one of nine blockview controls.

Quoteit would cause a noticeable delay at runtime
The question is how long would this be and how stable is the recreation of the control. Does the recreation mean that the block has to be reloaded? That would cause that main delay, I fear. I think of the sample of Danner and me using SetBackColor for selecting a block. If the user clicks 3 different blockview in a second AutoCAD shouldn't crash.

These are some thoughts about this.

Fred
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: Fred Tomke on April 26, 2009, 11:32:34 PM
Hello Owen,

another thought of mine:

QuoteThis presents a bit of a dilemma, because caching the displayed graphics is a performance improvement. Those controls use AutoCAD AcGsView control internally,...

Caching the displayed graphics is a new feature from you or does the AutoCAD AcGsView control do this automatically?
I just had the idea of a design time property UseCache. If this is set to true the the displayed graphics will be cached and all performance improvements are available. If UseCache is set to No the graphics will not be cached but SetBackColor can be set at runtime (as an example).

Fred
Title: Re: dcl_Control_SetBackColor not working on slides
Post by: owenwengerd on April 27, 2009, 06:07:28 AM
Fred, the graphics cache is part of AutoCAD AcGsView. I'm too busy right now to do much work on this, but I will investigate this problem in more depth when I have some time.