Author Topic: Slide View BackColor Help  (Read 8822 times)

0 Members and 1 Guest are viewing this topic.

mr_nick

  • Guest
Slide View BackColor Help
« on: July 23, 2013, 06:42:40 AM »
I have a dialog with multiple slide view boxes on it but I can't get the backcolor control to operate the way I want.

If I use a fixed variable name then it works OK but I have a loop that clears the color and highlighting etc so I have to build the variable name on the fly. This works as expected on the highlight setting but the backcolor control is seemingly ignored. Below is a code snippet showing the way I'm doing it.

Code: [Select]
(dcl_Control_SetBackColor (eval (read (strcat " slides_dialog_sld" (itoa (+ 1 mysel))))) 25 )
(dcl_SlideView_SetHighlight (eval (read (strcat " slides_dialog_sld" (itoa (+ 1 mysel))))) 1 )

I've been puzzling on this one for a while but can't figure out what I'm doing wrong - is anybody able to assist?

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Slide View BackColor Help
« Reply #1 on: July 23, 2013, 09:08:45 AM »
I'm sure someone here can help, but you'll need to identify the problem. Which part of your code fails? What did you expect the function to return, and what did it actually return?

mr_nick

  • Guest
Re: Slide View BackColor Help
« Reply #2 on: July 23, 2013, 09:16:58 AM »
As stated in the original post, it is the line that changes the backcolor that is failing - it's not giving an error, it simply isn't doing anything. For example, if I were to set the mysel variable to 22 and then run these two lines of code, slides_dialog_sld23 should be given a backcolor of 25 and a highlight of 1 but all I'm getting is the highlight - the backcolor is staying as defined in the original dialog code.

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Slide View BackColor Help
« Reply #3 on: July 23, 2013, 09:36:22 AM »
Does the background color appear correctly if you comment out the call to (dcl_SlideView_SetHighlight)? Is there a slide being shown at the time of the call? If you think it's a problem in the OpenDCL code, it would be helpful if you could add a simple project that I can use to reproduce the problem.

mr_nick

  • Guest
Re: Slide View BackColor Help
« Reply #4 on: July 23, 2013, 10:30:54 AM »
OK, here is a simple dialog with 4 slide view controls on it.

When the dialog initialises, the slides have their backcolor set to 251 which proves that the control works at this point. However, when you click any of the slides which triggers a new event, the slide should get a red highlight and green background but instead only the highlight appears and the background stays grey.

I'm not sure if it makes any difference but I'm using v7.0.0.4 on Windows7 64bit with AutoCAD Architecture 2012.

Code: [Select]
(defun c:slide_test ( / )
(defun c:slide_test_Form1_OnInitialize (/)
  (dcl_Control_SetBackColor slide_test_Form1_SlideView1 251)
  (dcl_Control_SetBackColor slide_test_Form1_SlideView2 251)
  (dcl_Control_SetBackColor slide_test_Form1_SlideView3 251)
  (dcl_Control_SetBackColor slide_test_Form1_SlideView4 251)
)
(defun c:slide_test_Form1_SlideView1_OnClicked (/)
  (dcl_SlideView_SetHighlight slide_test_Form1_SlideView1 1)
  (dcl_Control_SetBackColor slide_test_Form1_SlideView1 3)
)
(defun c:slide_test_Form1_SlideView2_OnClicked (/)
  (dcl_SlideView_SetHighlight slide_test_Form1_SlideView2 1)
  (dcl_Control_SetBackColor slide_test_Form1_SlideView2 3)
)
(defun c:slide_test_Form1_SlideView3_OnClicked (/)
  (dcl_SlideView_SetHighlight slide_test_Form1_SlideView3 1)
  (dcl_Control_SetBackColor slide_test_Form1_SlideView3 3)
)
(defun c:slide_test_Form1_SlideView4_OnClicked (/)
  (dcl_SlideView_SetHighlight slide_test_Form1_SlideView4 1)
  (dcl_Control_SetBackColor slide_test_Form1_SlideView4 3)
)
(setq slidedia
'("YWt6A2sRAADzQDORBuKT6rUVbS9quMFXMwUzJfr8quP868R3qjfkOin8XsCVfWo7NrPa/94ozxz1"
"ZenAC9llaVAjhnohNQ/bRelQgn26iSwuZbHn57Ljh/ZKdWlYs3KNhqORog2Rog3BJyAh1l3CrM1G"
"8GRU5jh3GZpAVQl5vqUAHudCSxZK8fz6xmbp/osMGM5/OzJ2Ge791KQIaiuv9YyYd2k64+4ZIND0"
"okP3innTFbjUFtCKjtoxILDy7ojQhGd1DBfg3PKd31IRpCzoMtDhWVVDCzgb2k7eNwu4F+OTdvL9"
"YPr5NtdTRvetRl8DsxGK+/zd47ITnM260VoDtgRNkTfhNY5UcWWvEkc1zg1WH2xNplgpM+rkAvm4"
"4e02rZlazYHar5j3IR3Gj+OfeeUDljuSTpn995WPP6ijciWA34QNtQCCLZwZujH2AaePKk5prqGe"
"xPDJmNHbBu0uHqinsi2MmGkLeh8vDSKqioAW53G2DWQN5A1Ozz4d0+vdJ9jeNuUDu71PF9O+cq+M"
"2dYicTfBMYL+hqBc5dMyhDuc/bqp9lFvoVzAPALrhkyPC5xluvn2cW1hX4BsK0qe+xZRR4AghBSn"
"IfGxr6B0BuqEAfUILt5JzzlxMt1XEPPxxCsF3ZuJvbPaq5FWQVwVQ9jT4VjwJ9PWAu2Kaygh18K5"
"jCgHTQVTZZsxGubLKCHTT8VTwS2gPyijN8L1BkVPZQrymGFNkli6ckXeU9NmqBPZbDNfJ1wu9yCc"
"gVGvwYRBxKOBHXmCYV29cFTLHKYSRWeIUOz4A//aH5nPCnLlk2TI7XJF2qr0Hw2TGqaRNmSIauz4"
"Y7msTxLQFaZwTtJgAX4BYPRo")
)
(dcl_project_import slidedia nil nil)
(dcl_Form_Show slide_test_form1)
(princ)
)

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Slide View BackColor Help
« Reply #5 on: July 23, 2013, 12:22:37 PM »
Excellent sample code, thanks! I have fixed the OpenDCL code for the next build. In the meantime, you can force a repaint by calling (dcl_SlideView_Clear) or (dcl_SlideView_SlideImage) immediately after the call to (dcl_Control_SetBackCOlor).

mr_nick

  • Guest
Re: Slide View BackColor Help
« Reply #6 on: July 24, 2013, 10:26:42 AM »
Owen, thanks for the reponse.

Do you have any kind of ETA for the next release of ODCL? I have implemented your suggested workaround but it's not quite ideal as it means I have to clear and then refill my slides which gives the effect of all my slides (there is a 7x7 grid of them) 'flashing' each time one is clicked which is possibly more distracting than not having the backgrounds change at all.

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Slide View BackColor Help
« Reply #7 on: July 24, 2013, 10:38:43 AM »
Does it flash even if you don't clear, but just reload the slide? My best guess on the new build is sometime in the first half of August, but that's highly dependent on circumstances.

mr_nick

  • Guest
Re: Slide View BackColor Help
« Reply #8 on: July 24, 2013, 10:49:23 AM »
Yes, I still get the flash (actually more of a flicker) when reloading the slide without the clear.

mr_nick

  • Guest
Re: Slide View BackColor Help
« Reply #9 on: July 25, 2013, 06:22:28 AM »
Can anybody give me an insight of how the dcl_SlideView_EndImage command works? I'm unsure what it does and how it is used and whether it may help in this scenario.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Slide View BackColor Help
« Reply #10 on: July 25, 2013, 06:39:39 AM »
mr_nick, the docs are pretty clear on the method.

Function Name   dcl_SlideView_EndImage
Syntax               (dcl_SlideView_EndImage <CONTROL>)
Return Type       Boolean (T if successful; otherwise NIL)
Applies To Slide View

This method takes a screen snapshot of what is displayed inside the picture box and saves the snapshot so that temporary graphics do not disappear when the control is repainted.

Something old of mine from the OpenDCL forum  . .. http://www.opendcl.com/forum/index.php?topic=1008.0
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Slide View BackColor Help
« Reply #11 on: July 25, 2013, 10:22:30 AM »
Can anybody give me an insight of how the dcl_SlideView_EndImage command works?

It's the equivalent of the AutoLISP (end_image) function for DCL dialogs. As Kerry said, it takes a snapshot of what has been drawn. The snapshot is saved for use whenever the control needs to be repainted.