Photo Placement (OpenInsight 64-bit)
At 30 JAN 2020 11:49:17AM Richard Richter wrote:
Good Morning,
I'm trying to place either a JPG or GIF in a Bitmap property using the following lines I've always used:
Set_Property(@WINDOW:".PHOTO","IMAGE",pic)
Set_property(@WINDOW:".PHOTO", "VISIBLE",1)
I know it's been changed to Exec_Method and SetImage but I can't find any sample code and I've tried every combination I can think of. I'd appreciate any help.
Thanks
Richard Richter
At 30 JAN 2020 12:11PM Carl Pates wrote:
Hi Richard,
Bit of background - In v10 the old "BITMAP" property should still work for backwards compatibility, so you can still use that for the controls in v9 that supported it when you want to set file names.
However, most v10 controls that support images have "sub-objects" that provide access to the actual image properties. The most common one is the IMAGE sub-object, and you would refer to it like so:
@window : ".PHOTO.IMAGE"From there you can access it's properties and methods, so if you wished to set an image file you would do something like this:
imgName = "c:\temp\mypic.jpg" call set_Property( @window : ".PHOTO.IMAGE", "FILENAMES", imgName )The IMAGE sub-object has the following properties:
[list]
ALIGN
AUTOSCALE
COLORKEY
COUNT
FILENAME
FILENAMES
FRAMECOUNT
FRAMEINDEX
INDEX
OFFSET
ORIGIN
SIZE
STYLE
TRANSLUCENCY
[/list]
And the following methods:
[list]
SAVETOFILE
SETHBITMAP
SETIMAGE
[/list]
Other common image-based sub-objects are ".GLYPH" (for buttons) and ".IMAGELIST" (for list boxes) and so on.
Anyway, your example looks like it is using the old "IMAGE" property, which was removed in v10 mainly because the property API doesn't really play very nice with binary data values that could contain null chars, and it's functionality was moved to the SETIMAGE method instead (which is much happier with binary data). So what you need to do is something like this:
osRead imageBits from "c:\temp\mypic.jpg" call exec_Method( @window : ".PHOTO.IMAGE", "SETIMAGE", imageBits )
At 30 JAN 2020 12:12PM Carl Pates wrote:
Hi Richard,
Bit of background - In v10 the old "BITMAP" property should still work for backwards compatibility, so you can still use that for the controls in v9 that supported it when you want to set file names.
However, most v10 controls that support images have "sub-objects" that provide access to the actual image properties. The most common one is the IMAGE sub-object, and you would refer to it like so:
@window : ".PHOTO.IMAGE"From there you can access it's properties and methods, so if you wished to set an image file you would do something like this:
imgName = "c:\temp\mypic.jpg" call set_Property( @window : ".PHOTO.IMAGE", "FILENAMES", imgName )The IMAGE sub-object has the following properties:
[list]
ALIGN
AUTOSCALE
COLORKEY
COUNT
FILENAME
FILENAMES
FRAMECOUNT
FRAMEINDEX
INDEX
OFFSET
ORIGIN
SIZE
STYLE
TRANSLUCENCY
[/list]
And the following methods:
[list]
SAVETOFILE
SETHBITMAP
SETIMAGE
[/list]
Other common image-based sub-objects are ".GLYPH" (for buttons) and ".IMAGELIST" (for list boxes) and so on.
Anyway, your example looks like it is using the old "IMAGE" property, which was removed in v10 mainly because the property API doesn't really play very nice with binary data values that could contain null chars, and it's functionality was moved to the SETIMAGE method instead (which is much happier with binary data). So what you need to do is something like this:
osRead imageBits from "c:\temp\mypic.jpg" then call exec_Method( @window : ".PHOTO.IMAGE", "SETIMAGE", imageBits ) end