Home Component Writing
New Blog Post: Email: Multi-Service

Show checked or unchecked checkbox

edited December 2003 in Component Writing
Hi All,
i have a need to produce a report with many checkboxes not db related, which
the user can check/uncheck.
I can change the state of the checkbox to either checked or unchecked, but i
cant seem to refresh the checkbox with the new state.

Any pointers greatly appreciated.
TIA
Stuart

Comments

  • edited December 2003

    1. In the ReportDesigner, when you set the CheckBox.Checked property, the
    check box should be redrawn.

    2. To have a hot-clickable Checkbox in the Report Previewer, implement the
    CheckBox.OnDrawCommandClick event-handler as show below.

    uses
    ppDevice;

    procedure TForm1.myCheckBox1DrawCommandClick(Sender, aDrawCommand: TObject);
    begin

    myCheckBox1.Checked := not(myCheckBox1.Checked);
    TppDrawCommand(aDrawCommand).RedrawPage := True;

    end;




    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2003
    thanks Nard, thats exactly what i was after.
    Now for my next question. Is it possible to allow free text entry into
    either a memo or Richedit?
    i realize this is a big ask, but worth asking.

    thanks again for any assistance you can give.
    Stuart


  • edited December 2003

    Not sure whether this is possible, but you would use the same basic
    approach.

    1. Use the OnDrawCommandClick event to display an editor. Then assign the
    text to the control.

    2. I think you will need to call Viewer.RegenerateReport so that the report
    can be regenerated:

    uses
    ppViewr;

    TppViewer(Report.PreviewForm.Viewer).RegenerateReport;

    3. There is a built-in RichText editor you can use, it will display the
    editor and assign the rich text to the control when the users closes it.

    uses
    ppRichText, ppRichEd;

    myRichText.Edit;



    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2003
    Hi Nard,
    thanks once again for your help. Your solution works great!

    regards
    Stuart
This discussion has been closed.