Jump to content

JusJJ

Members
  • Content Count

    16
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. JusJJ

    Indy 10 android problem

    How to go through ip addresses between 192.168.1.1-192.168.1.42 are they available. If device[1].canconnect then deviceavailable[1] = true else deviceavailable[1] = false etc.
  2. JusJJ

    Indy 10 android problem

    It is an old, huge industrial compressed air system. It is divided into sectors with a total of 42 devices, valves, dryers, coolers etc. Some devices automatically go into sleep mode because whole system can only work at full power momentarily. Each device is controlled via an ethernet converter and, since it draws the operating voltage directly from the actuator in question, it is of course not possible to contact it. Now, if you need to adjust an individual device to change settings in some sector, it's easier to see directly which devices are in use than to go through them one by one.
  3. JusJJ

    Indy 10 android problem

    Thank you very much Remy! It seems to work that way. One more question : What would be the best and fastest way to initially check if the devices are connected between 192.168.1.1 - 192.168.1.42?
  4. I have a reconnection problem in an android application,using Indy TidTcpClient and TIdThreadComponent. I've tried both the Delphi bundled and the latest Indy version. At the beginning, the program goes through the IP addresses of the available devices. Read and write routines work without problems, but when you try to change the IP address, almost without exception the program freezes. Sometimes it takes a few seconds, sometimes a few minutes before the program responds and about every ten times the program stops responding completely. In Windows, changing the IP address works reasonably well, but sometimes it also freezes. Receiving works...: try StartChar := TCPSocket.IOHandler.ReadChar; if StartChar = '%' then begin Data := TCPSocket.IOHandler.ReadLn('&'); Payload := Data; TCPSocket.IOHandler.ReadBytes(ChecksumBytes, 4); ReceivedChecksum := BytesToString(ChecksumBytes); CalculatedChecksum := CRC16(Payload); if ReceivedChecksum = CalculatedChecksum then begin TThread.Queue(nil, procedure var i: Integer; begin HandleData; end); end else begin TThread.Queue(nil, procedure begin HandleChecksumError; end); end; end; except on E: Exception do begin TThread.Queue(nil, procedure begin HandleException; end); ReceiveThread.Terminate; end; ...but changing IP fails: procedure IpSelectF.IPBtnClick(Sender: TObject); Var Btn: TButton; NewIp: string; begin if Sender is TButton then begin Btn := TButton(Sender); if AvailableIP[Btn.Tag] then begin TTask.Run( procedure begin try if Assigned(MainF.ReceiveThread) and MainF.ReceiveThread.Active then begin MainF.ReceiveThread.Stop; MainF.ReceiveThread.WaitFor; end; if MainF.TCPSocket.Connected then MainF.TCPSocket.Disconnect; NewIp := '192.168.1.' + IntToStr(Btn.Tag); MainF.TCPSocket.Host := NewIp; try MainF.TCPSocket.ConnectTimeout := 3000; MainF.TCPSocket.Connect; if MainF.TCPSocket.Connected then begin TThread.Queue(nil, procedure begin MainF.ReceiveThread.Start; ShowAlertDialog('Connected to ' + NewIp); end ); end else begin TThread.Queue(nil, procedure begin ShowAlertDialog('Connection to ' + NewIp + ' failed.'); end ); end; except on E: Exception do begin TThread.Queue(nil, procedure begin ShowAlertDialog('Failed to connect to ' + NewIp + ': ' + E.Message); end ); end; end; except on E: Exception do begin TThread.Queue(nil, procedure begin ShowAlertDialog('Error during IP switch: ' + E.Message); end ); end; end; end ); end; end;
  5. JusJJ

    GridPanelLayout in android

    Hi, I have a problem with TGridPanelLayout in android. Instead of spanning 2 cols, TStringgrid span just 1 col. It works perfectly in windows but not in android. Delphi version is 11CE.
  6. JusJJ

    Wrong hex code

    Thank you Cristian! That did the trick.
  7. JusJJ

    Wrong hex code

    Clever! 👏You must be very proud of yourself.
  8. JusJJ

    Wrong hex code

    I try to receive hex data from serial port using AsyncPro. However, 0x80 returns 0x20AC. How to fix this?
  9. JusJJ

    Button with changing image

    I have an android app for which I would like two functions for one button. The button would be an image that changes according to the event. What would be the best way to do such a function?
  10. JusJJ

    Grid background color

    It works this way, but if you try to enlarge it, it doesn't work
  11. JusJJ

    Grid background color

    I found one problem. Changing background visible -> false it is impossible to change grid size and position at runtime.
  12. JusJJ

    Grid background color

    Thank you very much @programmerdelphi2k! It is easy when you know what to do.
  13. JusJJ

    Grid background color

    Is it somehow possible to change the background color and remove borders of the (string)grid in FMX? I would like to align the data in a 4 x 10 grid but only keep the text visible and hide background and borders.
  14. JusJJ

    Drawing on canvas

    Hi, Is there a way to prevent drawing outside the canvas? If, for example, I have a rectangular shape on which I draw an ellipse and I want to limit the drawing to the area of the shape. procedure TForm1.shapePaint(Sender: TObject; Canvas: TCanvas; const ARect: TRectF); var x,y :integer; circle : TRectF; begin x:=round(shape.Width/2); y:=round(shape.Width/2); circle:=TRectF.Create(x-190,y-190,x+100,y+100); shape.Canvas.Stroke.Color:=TAlphaColors.Black; shape.Canvas.DrawEllipse(circle,50); end; Now part of it is also drawn outside the shape.
  15. JusJJ

    Community edition form designer

    Thank you Uwe. Community edition is 10.4 and in this version you can get only code in a second edit window.
×