Remember Details in assistent creator

delphi package - automated exception handling
Post Reply
mavbaby
Posts: 8
Joined: Thu Sep 01, 2005 2:42 pm
Location: Delft, The Netherlands
Contact:

Remember Details in assistent creator

Post 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 ...
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post 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.
mavbaby
Posts: 8
Joined: Thu Sep 01, 2005 2:42 pm
Location: Delft, The Netherlands
Contact:

Post 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?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Which button do you mean? Are you talking about the checkbox? The checkbox was originally named "MemCheck" with the text "remember me".
mavbaby
Posts: 8
Joined: Thu Sep 01, 2005 2:42 pm
Location: Delft, The Netherlands
Contact:

Post by mavbaby »

Yes. that one I was talking about, thx
mavbaby
Posts: 8
Joined: Thu Sep 01, 2005 2:42 pm
Location: Delft, The Netherlands
Contact:

Post 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:
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

How do you accomplish what from code?
mavbaby
Posts: 8
Joined: Thu Sep 01, 2005 2:42 pm
Location: Delft, The Netherlands
Contact:

Post by mavbaby »

How can I remember a user's details in the contact form, how do I do this from code?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post 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.
mavbaby
Posts: 8
Joined: Thu Sep 01, 2005 2:42 pm
Location: Delft, The Netherlands
Contact:

Post by mavbaby »

Thank you, I get it know ... :crazy: :crazy: :crazy:
Post Reply