Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

GraphicType

edited November 2006 in General
Hi,

I need to know how I can to set the GraphicType when I preview a
report. Do you know any procedure to this case?

Thanks in advance,

Leonardo Vitor da Silva



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited November 2006
    Hi Leonardo,

    When and where are you trying to set the GraphicType of the DBImage? The
    GraphicType can be set at runtime using the popup menu or object inspector
    in the designer or at runtime before the image is printed using the
    DBImage.GraphicType property.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2006
    Hi Nico Cizik,

    I'm sorry, because I didn't show my problem correctly.
    My report file already was created. My data base has many image files
    with bmp, jpg and wmf type. Then I need to modify the image type in
    runtime. My data base has two fields: Image(Blob) and Type
    ("jpg","bmp","metafile").

    Thanks in advance,

    Leonardo Vitor da Silva.



    --- posted by geoForum on http://delphi.newswhat.com
  • edited November 2006
    Hi Leonardo,

    If you know the graphic type of each record, all you should need to do is
    check this value before the image prints and change the GraphicType property
    accordingly. The DetailBand.BeforePrint event would be an ideal place to do
    this.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2009
    Hello,

    I'm storing jpg-images in our database. When adding DBImages to the report,
    an error occurs, since the GraphicType is set to 'Bitmap' by default.
    I wanted to set it to 'JPEG' instead and tried to use
    ppDesigner.OnCreateComponent for that.

    If I add the DBImage from the palette and then assign the data field, it
    works, but if I add the DBImage via drag & drop from the DataTreeWindow, the
    event OnCreateComponent fires to late, so the error occurs first, then the
    GraphicType gets changed.

    Is there a way to solve that? Another event or maybe something to define
    'JPEG' as default GraphicType for all DBImages? The error occurs within IDE
    only, but still not ok, I think.

    Also another question: how do I access the popupmenu of the DBImage? I would
    like to remove the items for changing of the GraphicType.


  • edited November 2009
    Hi Mark,

    This is not a feature of the Data Tree. It is currently up to the user to
    know which type of image is being used and assign the GraphicType
    accordingly. It is also possible to completely replace the Data Tree if you
    would like to add this functionality (see my response to your question on
    10/28/2009).

    Take a look at the following example on accessing the popup menu.

    http://www.digital-metaphors.com/tips/Designer10_PopupMenuAccess.zip


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2009
    Hi Nico,

    thanks for the tip about the designer menus. I will take a look into it.

    As for the other issue:
    I believe you misunderstood me :)

    I know that that's not a featire of the DataTree. I decided to make
    available JPEGs only. Because of that I would like to set the GraphicType to
    'JPEG' automatically by code, so the end user doesn't have to do so and also
    to avoid the error inside IDE. It's just that the default value is 'Bitmap'
    and I would like to change it, since I know what GraphicFormat is being
    used.

    By adding of the DBImage form the palette no graphic is assigned (no
    datafield ebtter to say), so my change by code happens in time. By adding of
    the DBImage via drag and drop from the DataTree the datafield is assigned
    already. And seemingly it is being loaded too early, i.e. before the
    OnComponentCreate event, which leads to the error inside the IDE. For the
    end user it's fine in the end, since the correct GraphicType is selected
    after adding the DBImage.

    So all I hoped to find is a way to be able to set the GraphicType *before*
    the graphic is loaded.

    Hope it's explained better now and that there is a way to accomplish that.

    Mark

  • edited April 2010
    Hello,
    just realized, that this issue is not solved in my application yet and that
    here was no reply since my last message, so I wanted to ask, if there is
    something I can do about it?

    Regards,
    Mark

    [...]
    [...]
  • edited April 2010
    Hi Mark,

    Sorry for not responding, I must have lost track of this thread.

    If the OnComponentCreate event fires too late to make this change, it may
    not be possible to work around this issue with an event. One option may be
    to create a custom DBImage descendent that assigns the image type to JPEG as
    a default and replaces the current DBImage object.

    It is highly likely that the DBImage will automatically detect the image
    type for the next major release of ReportBuilder.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2010
    Hi Nico,

    no problem, somehow I've lost track of this thread either and just realized
    it yesterday by accident :)

    Thanks for your reply. For now I've changed the default GraphicType to
    'JPEG' in ppCtrls.pas and it works fine.

    The likely implementation of an automatic detection in the next major
    release sounds greate. I'm looking forward to use it :)

    Regards,
    Mark


This discussion has been closed.