Page 1 of 1

Insert a photo

PostPosted: Tue Nov 06, 2018 2:08 pm
by Natter
Hi, all !

There is an object of type TXImage. I need to insert a photo from the Clipboard into it. How could I possibly do that ?

Re: Insert a photo

PostPosted: Tue Nov 06, 2018 6:42 pm
by cnavarro
Assign data lCanPaste := .T., and press button right over control TXImage

Code: Select all  Expand view


   @ 300, 300 XIMAGE oImage SIZE 300, 300 ;
      OF oWnd SOURCE "ejemplo.png" NOBORDER

   oImage:lCanPaste := .T.

 

Re: Insert a photo

PostPosted: Tue Nov 06, 2018 7:06 pm
by Natter
Thank you for your help !

Can I save an image from TXImage to a variable ?

Re: Insert a photo

PostPosted: Tue Nov 06, 2018 7:26 pm
by cnavarro
I do not understand well
Please, explain better

Re: Insert a photo

PostPosted: Tue Nov 06, 2018 8:44 pm
by Natter
The TXImage class has a Save method that allows you to save the image only to a file. I need to save the image to a variable

Re: Insert a photo

PostPosted: Thu Nov 08, 2018 1:15 pm
by nageswaragunupudi
hBitmap := oImage:GetHBitmap()

Re: Insert a photo

PostPosted: Fri Nov 09, 2018 7:09 am
by Natter
the GetHBitmap() function will return the handle of the picture.
I need the text of picture

Re: Insert a photo

PostPosted: Fri Nov 09, 2018 7:29 am
by nageswaragunupudi
text of picture?

Re: Insert a photo

PostPosted: Fri Nov 09, 2018 8:55 am
by Natter
I need to save the picture to BLOB. I can do this
buf=memoread ("my.jpg")
blobdirectput(0, buf)

But is it possible to do so ?
blobdirectput(0, image:GetHBitmap() )

Re: Insert a photo

PostPosted: Sun Nov 11, 2018 5:21 pm
by nageswaragunupudi
BmpToStr( oImage:GetHBitmap() )

Re: Insert a photo

PostPosted: Wed Jun 12, 2019 1:10 am
by Mulyadi
Mr Nages,

Can you post here sample how to handle the Paste Image..?

Thanks.

Re: Insert a photo

PostPosted: Wed Jun 12, 2019 2:05 am
by nageswaragunupudi
Please set
Code: Select all  Expand view

oImage:lCanPaste := .t.
 

if you want the user to paste images into the XImage control.

Then the user can
1. Copy an image from any source
2. Select the ximage by clicking on it
3) (a) Press Ctrl-V
OR
(b) Right-click on ximage and select "Paste" option from the context menu

Image

If you want to paste thorugh program, you can use oImage:Paste() even if oImage:lCanPaste is not set to .t.

Re: Insert a photo

PostPosted: Wed Jun 12, 2019 2:33 am
by Mulyadi
Thanks Mr Nages.
Best Regard..