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

ComboBox?

edited October 2002 in General
Is it possible to put a drop-down ComboBox on a report ??

Or any other method of having data that is only displayed when a user clicks
on it?

Thanks,
Chris

Comments

  • edited October 2002
    The way to do this when running a report is to use the run time designer to
    change the data field that is assigned using the design workspace of the
    designer. This is the preferred way to do perform this as it really is as
    integral part of the design process in the reporting equation.

    However, one way to display data when the user clicks in the preview is to
    use a drill down subreport to show detail data for a given master. See the
    drill down subreport demos at the end of the installed main reports demo
    project.

    Since a combobox isn't natively supported in the preview, you can use the
    OnDrawCommandClick event to react to the user clicking on the draw command
    you create for the combobox. One way would be to use an image component to
    draw the appearance of an empty combo box. Then when the user clicks on it,
    you could show a list of data that they could pick from the current record
    in the dataset.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited October 2002
    Can you clarify this first method at all?

    to

    do you mean actually going to the .pas file and changing
    ppLabel1: TppLabel; to ppLabel1: TComboBox;

    and modifying it in the .dfm file as well?

    If this is what you meant, I attempted this and keep getting an error saying
    that ppLabel1 does not have a parent window. If this is not what you mean,
    could you please explain.

    Thanks.
    --Chris

    the
    to
    it,
  • edited October 2002
    Sorry, I meant that you should not use a label, but instead use a TppDBText
    and set it to be data aware for a particular field that the user would like
    to use by setting its data field property or by selecting a data field in
    teh combo box in the designer workspace.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited October 2002
    I'm sorry Jim, I'm not understanding how this will put a Combobox component
    on my report? If I use a TppDBText field and set it's data field to a
    particular datafield, it is just going to be populated by that field from
    the database??

    I may not have explained it clearly. I've got a String List component that
    I would like to use to populate a ComboBox... I'm not using any database
    fields for it. Maybe what I'm trying to do just isn't possible.

    The reason I'm trying to do this is because my report is generated after the
    user chooses any number of methods of filtering. I wanted to be able to
    display the filtering properties in the header on the report, but since the
    list could be extensive, I didn't want to use something like an autosizing
    memo field because it could end up taking up most of the page (if the user
    selected many items of filter criteria.

    So I was looking for something along the lines of a drop down box so that if
    the user wanted to view what the filter criteria was, they could simply
    click the a dropdown combobox field and scroll through the list of criteria.

    Thanks.
    --Chris


  • edited October 2002
    You could place a combo box in the preview form, not in the page of the
    report. The preview form is replaceable. There is a link at the bottom
    which shows how to replace the class which creates control on the form. You
    can override the TppPreview.CreateToolbarControls method and create a new
    combobox in the toolbar. See ppPreview to see the TppPreview interface.

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

    If you would rather use a memo to display this information, you could create
    a TppLabel in the report header which is blue, italic and underlined so it
    looks like a hyper link, indicating that it will show the user something
    when they click on it. Then you can use the OnDrawCommandCreate event of
    the label in order to show a popup form listing of the entire criteria they
    selected for this report inside of a memo control. Are you aware of the
    Report.GetAutosearchDescriptionLines method? There is an example of using
    it in the autosearch demos directory of your installation.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.