Page 1 of 1

Remember Details in assistent creator

Posted: Thu Sep 01, 2005 2:44 pm
by mavbaby
How can you rember the details in an assistent form, that when a bugreport is send again, details like name email adress are remembered?

I saw it in the movie on the site, but can't reproduce it ...

Posted: Thu Sep 01, 2005 5:21 pm
by madshi
The details in the contact form are stored in the registry, if you check the "remember me" checkbox. Internally this is realized by the "OnAction" event handler of the contact form.

Posted: Fri Sep 02, 2005 7:00 am
by mavbaby
I removed the button from the form and tried to include it again, does it have a special name/reference to do this?

Posted: Fri Sep 02, 2005 7:18 am
by madshi
Which button do you mean? Are you talking about the checkbox? The checkbox was originally named "MemCheck" with the text "remember me".

Posted: Fri Sep 02, 2005 7:24 am
by mavbaby
Yes. that one I was talking about, thx

Posted: Wed Sep 07, 2005 7:42 am
by mavbaby
How can I accomplish this from code?

Thought it was a nice feature to include in the bugreports, so a user doesn't have to fill in his details endlessly :crazy:

Posted: Wed Sep 07, 2005 9:08 am
by madshi
How do you accomplish what from code?

Posted: Wed Sep 07, 2005 9:28 am
by mavbaby
How can I remember a user's details in the contact form, how do I do this from code?

Posted: Wed Sep 07, 2005 9:39 am
by madshi
This is how madExcept is doing it:

Code: Select all

procedure HandleContactForm(form: INVForm; action: TNVAction; item: INVItem; exceptIntf: IMEException);
var s1, s2 : string;
    edit   : INVEdit;
    check  : INVCheckBox;
begin
  case action of
    nvaFormCreate : begin
                      s1 := RegReadStr(HKEY_CURRENT_USER, 'Software\madshi\ContactForm', 'RememberName');
                      s2 := RegReadStr(HKEY_CURRENT_USER, 'Software\madshi\ContactForm', 'RememberEmail');
                      if (s1 <> '') or (s2 <> '') then begin
                        edit := form.nvEdit('NameEdit');
                        if edit <> nil then
                          edit.Text := s1;
                        edit := form.nvEdit('EmailEdit');
                        if edit <> nil then
                          edit.Text := s2;
                        check := form.nvCheckBox('MemCheck');
                        if check <> nil then
                          check.Checked := true;
                        if form.ContinueButton.Enabled then
                          form.ActiveControl := form.ContinueButton.Name;
                      end;
                    end;
    nvaFormClose  : if form.ModalResult = nvmOk then begin
                      check := form.nvCheckBox('MemCheck');
                      if check <> nil then
                        if check.Checked then begin
                          edit := Form.nvEdit('NameEdit');
                          if edit <> nil then
                            RegWriteStr(HKEY_CURRENT_USER, 'Software\madshi\ContactForm', 'RememberName', edit.Text);
                          edit := Form.nvEdit('EmailEdit');
                          if edit <> nil then
                            RegWriteStr(HKEY_CURRENT_USER, 'Software\madshi\ContactForm', 'RememberEmail', edit.Text);
                        end else begin
                          RegDelVal(HKEY_CURRENT_USER, 'Software\madshi\ContactForm', 'RememberName');
                          RegDelVal(HKEY_CURRENT_USER, 'Software\madshi\ContactForm', 'RememberEmail');
                        end;
                      if exceptIntf <> nil then begin
                        edit := Form.nvEdit('NameEdit');
                        if edit <> nil then
                             s1 := edit.Text
                        else s1 := '';
                        edit := Form.nvEdit('EmailEdit');
                        if edit <> nil then
                             s2 := edit.Text
                        else s2 := '';
                        if s1 <> '' then
                          exceptIntf.MailFrom := s1 + ' ' + '<' + s2 + '>';
                      end;
                    end;
  end;
end;
This is by default the "OnAction" handler of the contact form.

Posted: Wed Sep 07, 2005 10:13 am
by mavbaby
Thank you, I get it know ... :crazy: :crazy: :crazy: