Jump to content

UnimDBListGrid1 FieldImage and FieldImageURL not working


M.Ammar

Recommended Posts

hi 

I cannot get UnimDBListGrid1 to display images Column image Visible := True

 

procedure TMainmForm.UnimDBListGrid1FieldImage(
  const Column: TunimDBListGridColumn; const AField: TField;
  var OutImage: TGraphic; var DoNotDispose: Boolean;
  var ATransparent: TUniTransparentOption);
begin
if SameText(AField.FieldName, 'isDirty') then
  begin
    if AField.AsBoolean then
      OutImage := UniImage1.Picture.Graphic
    else
      OutImage := UniImage2.Picture.Graphic;
  end;
end;

procedure TMainmForm.UnimDBListGrid1FieldImageURL(
  const Column: TunimDBListGridColumn; const AField: TField;
  var OutImageURL: string);
begin
   if SameText(AField.FieldName, 'isDirty') then
   begin
      if AField.AsBoolean then
         OutImageURL := 'files/Dirty.png'
      else
         OutImageURL := 'files/check.png';
   end
end;

Code is copied from the example and working with unimdbgrid but I need to replace it for many reasons.

any suggestions 

Best regards

Link to comment
Share on other sites

On 9/5/2019 at 7:32 PM, Hayri ASLAN said:

Hello

Can you please create a test case?



Hi 

Thank you for reply

you can use the demo as a test case because my db is SQL Server and I don't know how to make without

C:\Program Files (x86)\FMSoft\Framework\uniGUI\Demos\Touch\DBListGrid

add the flowing code and enable image visible for the column

procedure TMainmForm.UnimDBListGrid1FieldImage(
  const Column: TunimDBListGridColumn; const AField: TField;
  var OutImage: TGraphic; var DoNotDispose: Boolean;
  var ATransparent: TUniTransparentOption);
begin
  if SameText(AField.FieldName, 'Length (cm)') then
  begin
    if True then
      OutImage := UniImage1.Picture.Graphic
    else
      OutImage := UniImage2.Picture.Graphic;
  end;
end

you will find that the code is never called , unlike if you use UnimDBGrid you find that the code is called normally

Regards

Link to comment
Share on other sites

  • 11 months later...
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...