Recent Posts

Pages: [1] 2 3 ... 10
General / Re: ShowModal disables form minimise
« Last post by lucamar on Today at 09:59:23 pm »
Well, I tested it on Linux-gtk/x86_64 (Xubuntu 18,04), so it doesn't seem to be "Windows-only". It might depend on specific versions of some libs, though, so some Linuxen show and other don't show this behaviour.
Beginners / Re: Message methods
« Last post by ASerge on Today at 09:57:08 pm »
Dispatch will recognize On the message number through the first 32 bits of the register which is usually of type Cardinal, the literal string type is also allowed with DispatchStr. Is what I understood correct?"
TObject.Dispatch will interpret the structure of the record as if it starts with a 32-bit number. For TObject.DispatchStr - as if there is a ShortString at the beginning.
Code: Pascal  [Select][+][-]
  1. procedure TObject.Dispatch(var message);
  2. ...
  3. begin
  4.   index:=dword(message);
  5. ...
Code: Pascal  [Select][+][-]
  1. procedure TObject.DispatchStr(var message);
  2. ...
  3. begin
  4.   name:=pshortstring(@message)^;
  5. ...
Packages and Libraries / Re: RichMemo no longer compiles
« Last post by JD on Today at 09:49:29 pm »
on linux you must define RMLCLTRUNK for richmemopackage.lpk and richmemo_design.lpk (Options > Compiler Options > Custom Options > Define ...)
on windows compile for me.
Windows 10 x64, Lazarus trunk r65116 and FPC 3.2.0 32-bit
Debian 10 x64, Lazarus trunk r65116 and FPC 3.2.0 x64

Thanks a lot for the tip. It now compiles in Linux.  :D

However it still does not compile in Windows.


General / Re: algorithms: which method or operator must i use??
« Last post by winni on Today at 09:46:20 pm »

Think about this:

Use the angle from the Center and center of a cirle.
Compute the length between those 2 points.
Add or subtract the radius of the circle.
There you are at the tangential point.


I agree that UDP's a good bet subject to a very thin ack/nak protocol layer. Remember that it's a connectionless protocol, so what you need is something like

Code: Pascal  [Select][+][-]
  1. (* The result of this may be subsequently retrieved using InetDomainSocket().
  2.   Assume that any existing socket was deleted when its owner terminated. Create
  3.   a fresh Inet Domain socket and save the handle, on failure save an error code.
  4.   Both success and failure are silent.
  5. *)
  6. procedure CreateInetDomainSocket(port: integer);
  8. var
  9.   sockAddr: TSockAddr;
  11. begin
  13. // TODO : This could usefully announce what IP addresses are being listened on.
  15. // Scenario: the host computer is restarted, and comes up with a DHCP-allocated
  16. // address which no longer corresponds to that being assumed by other WatchP0x
  17. // instances assuming it's the supervisor.
  19.   Write(StdErr, 'Creating new Internet domain socket (UDP, port ', port, ')... ');
  20.   inetDomainSocketHandle := fpSocket(PF_INET, SOCK_DGRAM, 0);
  21.   try
  22.     sockAddr.sin_family:= AF_INET;
  23.     sockAddr.sin_port:= hToNS(port);
  24.     sockAddr.sin_addr.s_addr:= 0;
  25.     FillChar(sockAddr.sin_zero[0], SIZEOF(sockAddr.sin_zero), #0);
  26.     if fpBind(inetDomainSocketHandle, @sockAddr, SIZEOF(sockAddr)) = 0 then
  27.       WriteLn(StdErr, 'OK')
  28.     else begin
  29.       WriteLn(StdErr, 'failed, might need CAP_DAC_OVERRIDE,CAP_NET_BIND_SERVICE,CAP_NET_RAW=p+e');
  30.       inetDomainSocketHandle := -Abs(ErrNo)
  31.     end
  32.   except
  33.     WriteLn(StdErr, 'failed, might need CAP_DAC_OVERRIDE,CAP_NET_BIND_SERVICE,CAP_NET_RAW=p+e');
  34.     inetDomainSocketHandle := -Abs(ErrNo)
  35.   end
  37. (* Assume that this will be deleted automatically at program termination.       *)
  39. end { CreateInetDomainSocket } ;

from which you can then read using something like

Code: Pascal  [Select][+][-]
  1.   FillByte(recvBuffer, SizeOf(recvBuffer), 0);
  2.     FillByte(sa, SizeOf(sa), 0);
  3.     saLength := SizeOf(sa);
  4.     messageLength := fpRecvFrom(socket, @recvBuffer, SizeOf(recvBuffer), 0, @sa, @saLength)
  5.     sender := NetAddrToStr(sa.sin_addr) + ':' + IntToStr(NToHS(sa.sin_port));

which will normally be inside a thread, or given a timeout using fpSelect().

Beginners / Re: Message methods
« Last post by pascal111 on Today at 09:44:41 pm »
google translate:

"Does "m.Id" need to be equal to "OM_DataChange" to call "OnDataChange"?"


OM_DataChange is just a number such as LM_USER + 1. For this program I name the message ids and methods using this convention which is helpful for me. The leading "O" designates the application, just my convention.


وكذلكـ لديكـ أُسلوب برمجة جيّد.

أظنّني يُمكنني أنْ أقول تقريباً أنّ هذا الموضوع قد حُل إلّا أنّني أرغب في سماع إضافاتٍ وأقوالٍ أخرى في هذه القضيّة (الموضوع ،فأنا أتخيّل هذه المرّة الموضوع كقضيّة قانونيّة).

google translate:


Also, you have a good programming style.

I think I can almost say that this issue "topic" has been resolved, but I would like to hear additional additions and other statements in this case (the topic, I am this time imagining the subject as a "case of law" legal issue)."
General / Re: ShowModal disables form minimise
« Last post by winni on Today at 09:39:13 pm »

Just tested:

Lin64/gtk2 : No Problems
Win7/64 : No Problems

So I think it is again a Win10 problem.

Dont use that rubbish!

I think it got mangled - I have attached a zip version.

Try it with just a small test program.

Thank you for your message and for your adaptation of the Advanced unit.

I had to modify this line to compile the code. I don't know if my modification has sense.

Code: Pascal  [Select][+][-]
  1.      if biton(j,mPlane[i]) then // <---

After that the program can be compiled but here, it crashes.

Loading ...An unhandled exception occurred at $0000000000422608:
EAccessViolation: Access violation
$0000000000474991  BLOAD,  line 155 of advanced.pas

Did you manage, on your side, to run the program?

ASAP I will try to use your code for the little test program, which is made for displaying a single (strawberry) image.



Come on old chap. You've been knocking around industry for long enough to know that roughly 50% of the software (and much hardware) in circulation is stuff knocked together on those terms, which somebody (else) has then pressed into service where it's publicly visible.

Amusing story.  But really - all I want is the simplest of procedures or functions that I can use to listen to the other machine and talk to it over UDP.

This is what I have for the Pi to get going that allegedly works (it compiles and is threaded ... whether anything is getting to the Mac... not sure).

What I can't figure out is an equivalent for the Mac side...

Code: Pascal  [Select][+][-]
  1. procedure BasicUDP(p:pointer);
  2. const
  3.  i:integer=0;
  4. var
  5.  buf:string;
  6.  IPAddress:string;
  7.  Winsock2UDPClient:TWinsock2UDPClient;
  9. begin
  10. Winsock2UDPClient:=TWinsock2UDPClient.Create;
  11. repeat  IPAddress:=Winsock2UDPClient.LocalAddress; sleep(1000) until ipaddress<>'';
  13. Winsock2UDPClient.RemoteHost := '';
  14. Winsock2UDPClient.RemotePort := StrToInt('61013');
  15. Winsock2UDPClient.Connect;
  16. repeat
  17.   i:=i+1;
  18.   buf:='Test string '+inttostr(i);
  19.   Winsock2UDPClient.SendData(PChar(buf), Length(buf));
  20.   sleep(1000);
  21. until false;
  22. end;
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018