rejetto forum

setClip for user comfort ;)

0 Members and 1 Guest are viewing this topic.

Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile
Hi ! :)

Two procedures where we could usefully to add setClip() (with or without notifications).
I know, it's a detail; but it's more comfortable for HFS users.


procedure TmainFrm.Viewhttprequest1Click(Sender: TObject);
var
  cd: TconnData;
begin
cd:=selectedConnection();
if cd = NIL then exit;
msgDlg(first([cd.conn.request.full, cd.conn.getBuffer(), '(empty)']), MB_OK, 'HTTP Request ');
setClip(first([cd.conn.request.full, cd.conn.getBuffer(), '(empty)']));
tray.balloon('The http request is copied to the clipboard.', 7);

end;

******************************************************************************

procedure TmainFrm.Findexternaladdress1Click(Sender: TObject);
const
  MSG = 'Can''t find external address'#13'( %s )';
var
  service: string;
begin
// this is a manual request, try twice
if not getExternalAddress(externalIP, @service)
and not getExternalAddress(externalIP, @service) then
  begin
  msgDlg(format(MSG, [service]), MB_ICONERROR);
  exit;
  end;
setDefaultIP(externalIP);
msgDlg(externalIP);
setClip(externalIP);
tray.balloon('The IP address is copied to the clipboard.', 7);

end;
« Last Edit: March 18, 2019, 04:22:25 PM by SilentPliz »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2062
    • View Profile
I always resisted this forced way to put a value in the clipboard because it leaves no choice to the user

 I often happened to lose important data from the clipboard between two applications because of a passage Stealth by hfs to check information, and that changed the content.

it would be wiser to put a dialog box with two buttons, one to recover the value, the other to ignore it to preserve its clipboard


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile
You're right ... I did not think about this possible problem.
Personally, this has not yet happened to me.

Not being able to copy what is displayed is also boring for user.

Otherwise, you know there are programs that can store entire lists of "copy" in the clipboard.  :)
« Last Edit: September 13, 2019, 09:50:17 PM by SilentPliz »


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile
Done ! ;)

Code: [Select]
procedure TmainFrm.Viewhttprequest1Click(Sender: TObject);
var
  cd: TconnData;
begin
cd:=selectedConnection();
if cd = NIL then exit;
case msgDlg('Do you want to copy the following HTTP request?'+#13#10+#13#10+first([cd.conn.request.full, cd.conn.getBuffer(), '(empty)']), MB_ICONQUESTION+MB_YESNO, 'HTTP request') of
IDYES:begin setClip(first([cd.conn.request.full, cd.conn.getBuffer(), '(empty)']));
tray.balloon('The HTTP request is copied to the clipboard.', 7) end;
IDNO: ;
  end;
end;

@rejetto,

It does not matter if the possibility of copying the IP address does not seem to you be relevant, but the first part of the following 'procedure' mod seems to me very useful.

Currently, when the user starts the search and the address is not found, he may think that there is no possibility to restart the search with an another service (no information).
If he knows the possibility of launching a new search; he must return to the main menu ... and as many times as necessary ... it's not practical!

With my proposal mod, he can restart the search from the 'error' dialog box.  :)

Code: [Select]
procedure TmainFrm.Findexternaladdress1Click(Sender: TObject);
var
  service: string;
begin
// this is a manual request, try twice
if not getExternalAddress(externalIP, @service)
and not getExternalAddress(externalIP, @service) then
  begin
case msgDlg(format('Can''t find external address with:'#13#10#13#10'( %s )'+#13#10#13#10+'Would you like to re-check with an another search service?', [service]), MB_ICONERROR+MB_YESNO, 'ERROR') of
IDYES:begin getExternalAddress(externalIP, @service) end;
IDNO: exit;
  end;
end;
setDefaultIP(externalIP);
if (externalIP) = '' then getExternalAddress(externalIP, @service);
case msgDlg('Do you want to copy the following IP address?'+#13#10#13#10+'Your IP address: '+(externalIP), MB_ICONQUESTION+MB_YESNO, 'IP Address') of
IDYES:begin setClip(externalIP);
tray.balloon('The IP address is copied to the clipboard.', 7) end;
IDNO: ;
  end;
end;

 :)
« Last Edit: October 04, 2019, 09:46:29 PM by SilentPliz »