Boards /
Runtime/AutoLISP /
Topic 703
dcl_Control_SetBackColor not working on slides
Started by mr nick ·
2009-04-07 15:57 UTC ·
19 replies · SMF topic #703
mr nick
2009-04-07 15:57 UTC
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?
docsaintly
2009-04-07 20:25 UTC
Please post the code you are using so we can take a look :)
mr nick
2009-04-08 00:30 UTC
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.
(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)
)
owenwengerd
2009-04-08 01:27 UTC
Thanks for the sample code. It's a bug. I've fixed it now for the next build.
mr nick
2009-04-08 01:51 UTC
author=owenwengerd link=topic=703.msg3419#msg3419 date=1239154039 wrote:
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?
fred_tomke
2009-04-08 07:25 UTC
Hi,
Sorry for my silly question, but - what is an ETA?
Fred
owenwengerd
2009-04-08 12:50 UTC
ETA = "Estimated Time of Arrival"
In this case, ETA is April 13.
fred_tomke
2009-04-08 12:56 UTC
Aaah, ok, thanks, Owen.
Fred
mr nick
2009-04-13 07:53 UTC
Just downloaded the updated arx and the slide backgrounds now work as expected. Thanks Owen.
DanW
2009-04-23 10:49 UTC
Hi,
I've just noticed exactly the same issue with BlockViews too. Works with highlight, but not background colour.
Cheers
owenwengerd
2009-04-24 02:20 UTC
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.
fred_tomke
2009-04-24 05:33 UTC
Hello,
the 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
DanW
2009-04-24 08:05 UTC
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?
owenwengerd
2009-04-24 12:04 UTC
No problem to correct me when I'm wrong. I'll see if I can figure out why this would have changed.
owenwengerd
2009-04-25 14:37 UTC
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?
velasquez
2009-04-25 18:25 UTC
This penalty until today it didn't harm my work, and I believe that nobody has noticed this.
Velasquez
DanW
2009-04-26 09:36 UTC
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.
fred_tomke
2009-04-27 06:16 UTC
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.
it 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
fred_tomke
2009-04-27 06:32 UTC
Hello Owen,
another thought of mine:
This 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
owenwengerd
2009-04-27 13:07 UTC
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.