trichview.com

trichview.support




Re: Error with FillBlobFields in a grid


Return to index


Author

Message

Diogo

Posted: 05/15/2005 19:37:31


Hi Sergey

This problem persists, can you help me ?



"Diogo" <[email protected]> wrote:

>

>Hi,

>A error ocurrs when I use FillBlobFields.

>I use DBRIchViewEdit.

>I create 2 grids. in each one I insert a Blob field.

>When I Fill the fields, the first field blob inside of grid only receives

>value.

>Why?

>

>Ps.: when not use grid, I do not have problems with blob fields.

>

>code:

>

>procedure TFrm800R.FillBlobFields(RVData: TCustomRVFormattedData);

>var i,j: Integer;

>    Stream: TMemoryStream;

>    Dummy1: TColor;

>    Dummy2, Dummy3: Pointer;

>    ParaNo: Integer;

>    BR, ContinuePara: Boolean;

>    table: TRVTableItemInfo;

>    r,c: Integer;

>begin

>  Dummy1 := clNone;

>  Dummy2 := nil;

>  Dummy3 := nil;

>  for i := RVData.ItemCount-1 downto 0 do

>    case RVData.GetItemStyle(i) of

>    rvsTable:

>      begin

>        // recursive call for table cells

>        table := TRVTableItemInfo(RVData.GetItem(i));

>        for r := 0 to table.Rows.Count-1 do

>          for c := 0 to table.Rows[r].Count-1 do

>            if table.Cells[r,c]<>nil then

>              FillBlobFields(table.Cells[r,c]);

>      end;

>      else

>      begin

>        //  1: // the first text style is used for fields

>        if((RVData.GetItemStyle(i) >= 0)and

>           (rvprModifyProtect in RVData.GetRVStyle.TextStyles[RVData.GetItemStyle(i)].Protection))then

>        begin

>          // storing parameters of deleted items

>          ParaNo := RVData.GetItemPara(i);

>          BR     := RVData.GetItem(i).BR;

>          ContinuePara := RVData.GetItem(i).SameAsPrev;

>          // loading field value in the stream

>          Stream := LoadData(RVData.GetItemTextA(i));

>          if(Stream <> nil)then

>          begin

>            // deleting the field code

>            RVData.DeleteItems(i,1);

>            // inserting the field value

>            RVData.InsertRVFFromStream(Stream, i, Dummy1, Dummy2, Dummy3,

>False);

>            // applying stored parameters to the inserted items

>            for j := i to RVData.ItemCount-1 do

>            begin

>              if (i=j) then

>              begin

>                RVData.GetItem(j).SameAsPrev := ContinuePara;

>                if BR then

>                  RVData.GetItem(j).BR := True;

>              end;

>              if (j>i) and RVData.IsParaStart(j) then

>                break;

>              RVData.GetItem(j).ParaNo := ParaNo;

>            end;

>            Stream.Free;

>          end;

>        end;

>      end;

>    end;//case

>  RVData.Normalize;

>end;

>

>// Loading field code

>function TFrm800R.LoadData(const Code: String): TMemoryStream;

>begin

>  Result := nil;

>  RichView2.Clear;

>  if(Query1.FindField(Code) <> nil)then

>  begin

>    Result := TMemoryStream.Create;

>    TBlobField(Q.FieldByName(Code)).SaveToStream(Result);

>    Result.Position := 0;

>    RichView2.Clear;

>    RichView2.InsertRVFFromStream(Result, 0);

>    Result.Clear;

>    RichView2.SaveRVFToStream(Result, False);

>    Result.Position := 0;

>  end;

>end;

>

>

>thanks

>

>Ps.:mine another topic was still not answered:

>Re: Create Hypertext to call Forms

>

>

>





Powered by ABC Amber Outlook Express Converter