Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How Do I store image data in PictureVal
Message
From
18/10/2005 07:43:06
 
 
To
17/10/2005 20:33:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01057389
Message ID:
01059870
Views:
80
>Hi Fabio
>
>Thank you for the sample code.
>
>I have some questions about this.
>
>1. PictureVal = 0h42.....etc
>Does this mean that you store the value into PictureVal directly and NOT as a string?
>

The value is a binary literals stored into the prg file,
when VFP load the class template into the VFP environment
then the binary literal it is copied into PictureVal,
when the image is painted the PictureVal value is
loaded into the VFP's graphic resources.
_SCREEN.AddObject("OneImage","staticImage")

_SCREEN.OneImage.Visible = .T.	&& only now VFP check PictureVal

_SCREEN.RemoveObject("OneImage")

DEFINE CLASS staticImage AS Image
	PictureVal = 0h000000 && a invalid picture

	PROCEDURE Init
		DEBUGOUT PROGRAM(),this.PictureVal

	PROCEDURE Destroy
		DEBUGOUT PROGRAM(),this.PictureVal
		
ENDDEFINE
>2. How did you convert the picture into a series of Hex bytes?
>
_CLIPTEXT = TRANSFORM(0h+FILETOSTR(GETPICT()))
* CTRL+V / menu Paste
>3. Since the limit of PictureVal = 255 chrs,
>Is it possible in a vcx to create a custom property and assign to PictureVal at runtime?
>eg. This.Picture1 = 0h42fd1123..... > 255 chrs.
>
>and in init of class
>
>This.Pictureval = This.Picture
>

The problem is not specific of PictureVal.
VFP9 class designer is not made well,
a property can support a string of greater length of 255 characters
but a binary cannot directly be inserted,
because VFP doesn't interpret a value 0h00 as a binary, but as a string '0h00'

This is a consequence of as the field Properties of the table VCX is formatted.

The only possible way is that to define the PicturVal as an single line expression:
=0h424D7E01000000000000760000002800000018000000160000000100040000000000000000000000000000000000000000000000000000000000000080000080+0h00000080800080000000800080008080000080808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF0080000000000000000000+0h00080777777777777777777777700F77777777777777777777700F88888888888888888887700F88888888888888888887700F88888808888888888887700F88+0h888800888888888887700F8888880F088888888887700F8888880FF00008888887700F888800FFFFFFF0088887700F8880FFFFFFFFFFF08887700F880FFFFFFF+0hFFFFFF0887700F880FFFFFFFFFFFFF0887700F880FFFFFFFFFFFFF0887700F880FFFFFFFFFFFFF0887700F8880FFFFFFFFFFF08887700F888800FFFFFFF00888+0h87700F88888800000008888887700F88888888888888888887700F88888888888888888887700FFFFFFFFFFFFFFFFFFFFF70800000000000000000000008
Then,
you can:
modify class VCXimageclass
* on command execute
_CLIPTEXT = TRANSFORM(0h+FILETOSTR(GETPICT()))
* open Zoom -PictureVal window
* paste the clipboard
* add "=0h" prefix 
* and add all the "+0h" necessary for split the binary literal
* (practically every 255*2 characters)
Remember the 8192 expression bound.

With _Memberdata is possible write a PictureVal builder.

>I await your reply.
>
>Bernard
>
>>within a prg you can do this,
>>inside a VCX it is not possible because PictureVal propertiy
>>supports at the most 255 bytes:
>>
>>
>>_SCREEN.AddObject("OneImage","staticImage")
>>_SCREEN.OneImage.Visible = .T.
>>
>>DEFINE CLASS staticImage AS Image
>>PictureVal = 0h424D7E01000000000000760000002800000018000000160000000100040000000000000000000000000000000000000000000000000000000000000080000080;
>>+	 0h00000080800080000000800080008080000080808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF0080000000000000000000;
>>+	 0h00080777777777777777777777700F77777777777777777777700F88888888888888888887700F88888888888888888887700F88888808888888888887700F88;
>>+	 0h888800888888888887700F8888880F088888888887700F8888880FF00008888887700F888800FFFFFFF0088887700F8880FFFFFFFFFFF08887700F880FFFFFFF;
>>+	 0hFFFFFF0887700F880FFFFFFFFFFFFF0887700F880FFFFFFFFFFFFF0887700F880FFFFFFFFFFFFF0887700F8880FFFFFFFFFFF08887700F888800FFFFFFF00888;
>>+	 0h87700F88888800000008888887700F88888888888888888887700F88888888888888888887700FFFFFFFFFFFFFFFFFFFFF70800000000000000000000008
>>
>>ENDDEFINE
>>
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform