Author Topic: setClip for user comfort ;)  (Read 94 times)

0 Members and 1 Guest are viewing this topic.

Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
  • Posts: 1216
  • ....... chut ! shh!
    • View Profile
setClip for user comfort ;)
« on: March 18, 2019, 01:44:14 PM »
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: 1875
    • View Profile
Re: setClip for user comfort ;)
« Reply #1 on: March 18, 2019, 05:12:03 PM »
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: 1216
  • ....... chut ! shh!
    • View Profile
Re: setClip for user comfort ;)
« Reply #2 on: March 18, 2019, 06:43:11 PM »
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.  :D

Édit:

Another solution would be to display the result in an InputQuery field or other component that allows copying.
« Last Edit: March 18, 2019, 07:27:09 PM by SilentPliz »