Recent

Author Topic: DMS - String conversion  (Read 829 times)

Alexandr R

  • New Member
  • *
  • Posts: 24
DMS - String conversion
« on: February 16, 2024, 11:08:17 am »
String conversion
Good day.   :)  I decided to post a unit for converting decimal degrees minutes and seconds specified in the format ±D°MM'SS.d(d)" into decimal degrees or radians and vice versa. Perhaps it will be useful to someone.

https://disk.yandex.ru/d/6ZRsjbOTEFSmag
007 - archive password

CM630

  • Hero Member
  • *****
  • Posts: 1090
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: DMS - String conversion
« Reply #1 on: February 16, 2024, 10:53:27 pm »
Thanks for sharing, there is a Third Party section of the forum for threada like this.
https://forum.lazarus.freepascal.org/index.php/board,19.0.html
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

Alexandr R

  • New Member
  • *
  • Posts: 24
Re: DMS - String conversion
« Reply #2 on: February 20, 2024, 01:23:26 pm »
Good day.
Well, yes, I posted it in the wrong section. I'll be more careful. In addition, I forgot to add one unit to the archive. Here he is.

unit msg_Hint;

{$mode ObjFPC}{$H+}

interface

uses
  Classes, SysUtils, LazUtf8, Forms, Controls;

type
 TMsgHint = Class(THintWindow)
  public
   constructor Create(aOwner: TComponent); override;
   destructor  Destroy; override;
   {Устанавливает над компонентом aControl Нint c c сообщением aMsg. Внимание:
    компонент aControl должен иметь родителя.                                  }
   procedure SetScope(aControl: TControl; aMsg: string);
 end;

implementation

constructor TMsgHint.Create(aOwner: TComponent);
begin
 inherited Create(aOwner);
 Self.HideInterval:= 4000; //время показа сообщения 4с.
 Self.AutoHide:= True;
 Self.Color     := $00B3FFFF; //слоновая кость
 Self.Font.Color:= $000404FF; //красно-коричневый
 Self.Alignment:= taRightJustify;
end;

destructor  TMsgHint.Destroy;
begin
 inherited Destroy;
end;

procedure TMsgHint.SetScope(aControl: TControl; aMsg: string);
var
 Rect : TRect;
 pnt  : TPoint;
begin
 Rect:= Self.CalcHintRect(0, aMsg, nil);
 if aControl.Width> Rect.Right then
  Rect.Right:= aControl.Width;
 pnt:= aControl.ClientOrigin;
 Rect.Left:= pnt.X-2;             Rect.Top   := pnt.Y-Rect.Bottom;
 Rect.Right:= pnt.X+Rect.Right-2; Rect.Bottom:= pnt.Y;
 Self.ActivateHint(Rect, aMsg);
end;

end.               

PascalDragon

  • Hero Member
  • *****
  • Posts: 5469
  • Compiler Developer
Re: DMS - String conversion
« Reply #3 on: February 20, 2024, 09:32:39 pm »
Well, yes, I posted it in the wrong section. I'll be more careful. In addition, I forgot to add one unit to the archive. Here he is.

Please use [code=pascal][/code]-tags so that the forum software doesn't try to interpret the code and so that it's easier viewable.

 

TinyPortal © 2005-2018