delphi-10-seattle

SaveTo StringHelper?

匆匆过客 提交于 2019-12-13 05:26:33
问题 I need a StringHelper which saves a string to a file: var s: string; begin s := 'Some text'; s.SaveTo('C:\MyText.txt'); end; Unfortunately, this is not possible. Is it possible to add such a StringHelper? 回答1: It is possible to add such a helper. For instance: type TMyStringHelper = record helper for string procedure SaveTo(const FileName: string); end; The downside to doing so is that this will replace the string helper that is provided by the RTL. If you don't use it, that won't matter. If

GB-IP Function not working correctly

故事扮演 提交于 2019-12-13 04:26:28
问题 I have a GP-IB card in my PC connected to a DMM via GP-IB. I have ran diagnostician on the card and confirms it is working. I am able to control it threw there software test. Now I am trying to create a program to do it, but when it sends the command it always gives error on DMM. I have 3 source files Master.pas, SubClass.pas, and ApiGpib.pas In master.pas I have this to send a command to the device. var Ret : DWORD; Yradr : DWORD; Srlen : DWORD; Cmd : array[0..31] of DWORD; csBuf : String;

How to check and hang-up/reject incoming/outgoing calls on Android in Delphi?

孤街醉人 提交于 2019-12-13 00:47:24
问题 Is there any solution to programmatically check and hang-up/reject incoming/outgoing calls on Android in Delphi? 回答1: First, you must have own BroadcastReceiver unit - you can download it from here. unit CSBroadcastReceiver; interface uses System.Classes ,System.SysUtils {$IFDEF ANDROID} ,Androidapi.JNI.Embarcadero ,Androidapi.JNI.GraphicsContentViewText ,Androidapi.Helpers ,Androidapi.JNIBridge ,Androidapi.JNI.JavaTypes ,Androidapi.JNI.App {$ENDIF} ; type {$IFNDEF ANDROID} JIntent = class

Isn't it dangerous to use the Longint count with the Int64 size in Stream.read?

孤街浪徒 提交于 2019-12-12 10:35:10
问题 I was examining the TMemoryStream class and found the following routine: procedure TMemoryStream.LoadFromStream(Stream: TStream); var Count: Longint; begin Stream.Position := 0; Count := Stream.Size; // <-- assigning Int64 to Longint SetSize(Count); if Count <> 0 then Stream.ReadBuffer(FMemory^, Count); end; I have seen this pattern a lot where an Int64 is assigned to a Longint. My understanding is that Longint is four bytes and Int64 is eight bytes in both 32-bit and 64-bit Windows, so if my

FMX form in VCL app via TFireMonkeyContainer - application freezing

萝らか妹 提交于 2019-12-12 03:36:42
问题 I'm using the TFireMonkeyContainer control to embed a Firemonkey form inside a VCL application. Initially, everything works fine. However, whenever I do something which triggers a TChangeTabAction (to slide back and forth between tabs in a TTabControl ), the entire application freezes up and stops responding. Even Windows is unable to detect that it's not responding - the title bar is even frozen as well, and I have to either terminate the process from the IDE or from the Task Manager. The

Delphi Seattle TCombobox Dropdowncount not working when using ownerdraw style

匆匆过客 提交于 2019-12-11 23:25:58
问题 I have an owner-drawn TComboBox in Delphi Seattle which ignores any settings to the DropDownCount property. The height of the individual items is 59 pixels and the width is 311 pixels. I have 5 entries in the Items stringlist. Setting a value below 8 results in no dropdown being shown at all, while any higher values result in only 1 item being shown in the dropdown along with a vertical scrollbar. I need to be able to show all 5 entries in the items list in the dropdown. Here's the DFM to

TTimer not working while iOS app in background

自作多情 提交于 2019-12-11 20:37:50
问题 I have an app that needs to perform some actions based on a TTimer. When the app becomes inactive (in background), the timer stops working. I could not find any relevant options for UIBackgroundModes. How can I make a timer keeps running? 回答1: iOS pauses your app automatically shortly after it goes into the background. You need to let iOS know that you are going to continue operating in the background. In Project > Options > Version Info you can add to the array key UIBackgroundModes the

WinSock: How send() a PByte type?

强颜欢笑 提交于 2019-12-11 13:44:49
问题 Firstly, i want know if the PByte type is equivalent to a BYTE* (byte pointer) in C++. In negative case, what's could be on Delphi that more near to BYTE* of C++? Well, suppose that i'm right about that PByte is BYTE* (C++), then based on following C++ code, how send() this data type ( PByte ) correctly using native WinSock? See: C++: SOCKET sock; BITMAPINFO bmpInfo; BYTE *bytes = NULL; BYTE *temp_bytes = NULL; DWORD workSpaceSize, fragmntWorkSpaceSize, size; RtlGetCompressionWorkSpaceSize

How to Connect Rad Studio 10 Seattle with Nox App Player

ぃ、小莉子 提交于 2019-12-11 05:13:51
问题 According to this official blog post (How to connect Android Studio with Nox App Player for Android development and debug) it is possible to connect Android Studio with Nox App Player . Now I can connect Android Studio with Nox App Player but this method does not work for Rad Studio . I contact Nox support team and ask them for a solution, they told me: You can connect to Rad Studio by integrating Android development plug-in. Then forward through the command port (nox_adb.exe connect 127.0.0

Has function initialization code changed from Seattle to Tokyo?

﹥>﹥吖頭↗ 提交于 2019-12-10 15:31:37
问题 I am in the process of upgrading code from Delphi 10 Seattle to Delphi 10.2 Tokyo and get a lot of H2077 hints Value assigned to ... never used on assignments. (Even in places where these were explicitly added in the past to get rid of 'may not have a value' warnings). These are all function initialized like: Result := 0; ... Or: Result := ftType1; // where ftType1 is an enumerated type ... Did the compiler get smarter in detecting these or has something changed regarding the initial return