2017-05-25 12:58 UTC
Can you please show an example to work with dcl-ImageList-SetAt?
Thanks.
Thanks.
author=roy_043 link=topic=2509.msg12491#msg12491 date=1495830433 wrote:
Try adding a new button to the Grid sample (C:\Program Files\OpenDCL Studio\ENU\Samples\):
(defun c:Grid/Dcl-1/YourButton#OnClicked ( / nme)
(setq nme "D:\\YourPath\\YourImage.bmp")
(dcl-ImageList-SetAt (dcl-Control-GetImageList Grid/Dcl-1/grid1) 0 nme)
(dcl-ImageList-SetAt (dcl-Control-GetImageList Grid/Dcl-1/IC-ColImages) 0 nme)
(dcl-ImageList-SetAt (dcl-Control-GetImageList Grid/Dcl-1/IC-Images) 0 nme)
)
author=roy_043 link=topic=2509.msg12491#msg12491 date=1495830433 wrote:
Try adding a new button to the Grid sample (C:\Program Files\OpenDCL Studio\ENU\Samples\):
(defun c:Grid/Dcl-1/YourButton#OnClicked ( / nme)
(setq nme "D:\\YourPath\\YourImage.bmp")
(dcl-ImageList-SetAt (dcl-Control-GetImageList Grid/Dcl-1/grid1) 0 nme)
(dcl-ImageList-SetAt (dcl-Control-GetImageList Grid/Dcl-1/IC-ColImages) 0 nme)
(dcl-ImageList-SetAt (dcl-Control-GetImageList Grid/Dcl-1/IC-Images) 0 nme)
)
author=roy_043 link=topic=2509.msg13147#msg13147 date=1552204427 wrote:
I can confirm that issue: dcl-ImageList-SetAt does not work if the image list of a control is empty. Seems like a bug to me.
author=owenwengerd link=topic=2509.msg13148#msg13148 date=1552272261 wrote:
The (dcl-ImageList-SetAt) function should return an error when you pass NIL for the imagelist argument. I've fixed that now for the next build. However, otherwise the function is working as intended. The reason: creating an image list requires size of individual images, and that information is not available to (dcl-Control-GetImageList).
I could add a new (dcl-Control-CreateImageList) function, but I don't think it's much trouble to just add an arbitrary image to the control at design time so that the control will already have an imagelist at runtime.
author=owenwengerd link=topic=2509.msg13152#msg13152 date=1552355064 wrote:
That is correct, once an image list is added, the image size is fixed and cannot be changed. You must add the first image with correct size.