Problems with VPicture

Steve Albin steve at steve-albin.com
Fri Jul 17 17:24:08 CDT 2009


Hi Ruslan,

First of all, no one should read Valentina List while on vacation.  It is a bad sign...  :-)

Here is what I've found out:

In the examples, Field_Picture in the API_WAY folder does not work for me.  Field_Picture in the SQL_WAY folder does work for me.   I am using RB 2009r2.1 and V4RB 4.1.  I can't explain why the API_way example does not work for me.

I have gotten my project to accept a picture.  Here is the code I use:

Sub AddImageFromProject(pnIssueId As Integer, pnOrder As integer, pnIssuePtr As integer, pmpicNotes As string, pcCaption As string) 

  dim pic As Picture
  dim fld As VPicture
  pic = DSC_0281 // this is pic stored in project
  
  cursor.SetBlank()
  fld = cursor.PictureField("pCoverPic")
  
  nNextNid = nNextNid + 1
  cursor.ULongField(2).Value = nNextNid
  cursor.ULongField(3).Value = pnIssueId
  cursor.ULongField(4).Value = pnIssuePtr
  fld.WritePictureAs( pic, EVPictType.kJPG, 90 )
  'cursor.PictureField(5).WritePictureAs(pic, EVPictType.kJPG, 50)
  cursor.TextField(7).Value = pmpicNotes
  cursor.VarCharField(8).Value = pcCaption
  cursor.ULongField(9).Value = pnOrder
  
  
  
  call cursor.AddRecord()
  app.DBfile.Flush
  
  
 The commented line is the line I was using unsuccessfully before.  You may wonder if the index number on the commented line is incorrect.  That is not the case and just to be sure, I tried the same way, but using the field name instead. 
 
 I don't understand why one or the other should make a difference.  I will submit the project to Mantis.

Steve

--
Steve Albin - Montclair, NJ  - USA
http://www.jazzdiscography.com/
http://www.steve-albin.com/ 

  



On Friday, July 17, 2009 ruslan at paradigmasoft.com (Ruslan Zasukhin) wrote:

>On 7/17/09 1:09 AM, "Steve Albin" <steve at steve-albin.com> wrote:
>
>Hi Steve,
>
>I am sorry, I cannot test this right now,
>Because on vacation, week yet.
>
>But please report this with simple project to Mantis,
>So Kirill ill try reproduce it.
>
>> I am running V4RB 4.1 on a Mac creating a standalone app.  For the life of me,
>> I cannot get a picture inserted into a database.
>> 
>> I've tried both Field_Picture examples with success.  Then, I make a simple
>> project on my own trying to replicate the procedure and no matter what I do it
>> will not load a picture.
>> 
>> Here is my code for adding a picture.  The pic is a picture I've added to the
>> RB project.  It is located in the same folder as the project and the built
>> project.
>> 
>> Here is the code I am using to add the picture.  I couldn't be simpler, but it
>> doesn't work.
>> 
>> Sub Action() 
>>     dim pic As Picture
>>     pic = DSC_0281 // a picture contained in the project folder
>> 
>>     vcImages = app.vDB.SQLSelect("Select Recid, *  from Images where false  ",
>>         EVCursorLocation.kServerSide, EVLockType.kNoLocks,
>> EVCursorDirection.kRandom)
>> 
>>     vcImages.SetBlank
>>     'vcImages.PictureField("pCoverPic").WritePictureAs(pic) // tried this call
>> both ways 
>>     vcImages.PictureField("pCoverPic").WritePictureAs(pic, EVPictType.kJPG,
>> 50) 
>>   
>>     call vcImages.AddRecord()
>>     app.vDB.Flush
>
>Strange.
>
>I am sure that example API Field_Picture, do exactly this ...
>No ?
>
>It assign picture stored in the project ...
>Also note there is no big sense add into db picture from PROJECT, yes?
>Usually you add them from RAM or Disk ...
>
>I remember that in the past, was many posts on this list,
>That some pictures start work only after past them to clipboard using RB
>code .. It was just 2-3 extra lines of code .. You can try search list
>archive to find that letter. Use "clipboard +picture +REALbasic" as key word
>for search. 
>
>>  I look at the log after running this and there is no indication of a problem.
>> There is no warnings file generated and I have it turned on.
>
>> Can anyone give me any pointers on a "gotcha" that I may have overlooked?  I
>> have no problem adding VarChar, ULong, VText, VBoolean, and VDate fields to
>> this database.  Just VPicture.
>
>But you told example work for you, right ?
>


More information about the Valentina mailing list