delphi-10.1-berlin

TOAuth2Authenticator: How do i refresh an expired token?

一曲冷凌霜 提交于 2021-02-18 12:46:55
问题 I must be missing something here! I have been playing around trying to refresh an expired OAUTH2 token using the new ( new to me anyway, coming from delphi xe2 environment) TOAuth2Authenticator, TRESTClient, TRESTRequest, TRESTResponse components I have set the following authenticator properties with the existing known values for ClientID ClientSecret Scope AccessTokenEndPoint AuthorizationEndPoint RedirectionEndPoint AccessToken AccessTokenExpiry RefreshToken and can successful access

How to work with records using file stream I/O instead of the 'old' I/O

好久不见. 提交于 2021-02-11 12:03:05
问题 Never learnt to work with streams for reading / writing data, instead I'm using the old Pascal way. Now everybody says this is not efficient and I would like to learn the file stream way, but can't really work with the tutorials that are available. I am using Excel to create and manage datasets (big data tables with one or two headers). I save these as *.txt files (tab delimited). These files I read with Delphi to fill my records and arrays, etc. Below a simplified code example of what I am

Project version settings keep reverting back

醉酒当歌 提交于 2021-02-08 14:44:19
问题 I have a simple project in Delphi 10.1 Berlin. In the project settings, I have at one point checked on "Pre-Release". Now I have two things that no matter how many times I change them, I come back and it's not saved. These are: Pre-Release checkbox (gets re-checked again) Module Version's Release number (changes from 0 to 1 ) Note in the screenshot that the "File Version" down below shows the correct version number from when I saved it, 0.2.0 . But above, the Release number has changed to 1 .

Project version settings keep reverting back

核能气质少年 提交于 2021-02-08 14:41:48
问题 I have a simple project in Delphi 10.1 Berlin. In the project settings, I have at one point checked on "Pre-Release". Now I have two things that no matter how many times I change them, I come back and it's not saved. These are: Pre-Release checkbox (gets re-checked again) Module Version's Release number (changes from 0 to 1 ) Note in the screenshot that the "File Version" down below shows the correct version number from when I saved it, 0.2.0 . But above, the Release number has changed to 1 .

How to reliably detect RICHTEXT format on clipboard?

流过昼夜 提交于 2021-02-07 17:22:55
问题 Embarcadero RAD Studio VCL has the TClipboard.HasFormat Method, with a usage e.g. Clipboard.HasFormat(CF_TEXT) or Clipboard.HasFormat(CF_BITMAP) etc.. But I did not find any supported CF_RTF or CF_RICHTEXT format-descriptor which indicates a rich-text format in the clipboard. So I created some formatted text in Microsoft WordPad and copied it to the clipboard. Then I used a clipboard-spy program to inspect the formats on the clipboard: This lists 3 RichText formats with the format-descriptors

Async InputQuery doesn't handle Cancel button

孤街醉人 提交于 2021-02-07 14:31:21
问题 I'm using a simple call to TDialogServiceAsync.InputQuery() with a single input. It just ignores both the Cancel button and the window's X close button. But the Ok button works fine. This is my code: uses FMX.DialogService.Async; procedure TForm1.Button1Click(Sender: TObject); begin TDialogServiceAsync.InputQuery('Title', ['Insert value'], ['bla bla'], procedure(const AResult: TModalResult; const AValues: array of string) begin if Aresult = mrOk then ShowMessage('Ok!'); if Aresult = mrCancel

Async InputQuery doesn't handle Cancel button

我们两清 提交于 2021-02-07 14:29:19
问题 I'm using a simple call to TDialogServiceAsync.InputQuery() with a single input. It just ignores both the Cancel button and the window's X close button. But the Ok button works fine. This is my code: uses FMX.DialogService.Async; procedure TForm1.Button1Click(Sender: TObject); begin TDialogServiceAsync.InputQuery('Title', ['Insert value'], ['bla bla'], procedure(const AResult: TModalResult; const AValues: array of string) begin if Aresult = mrOk then ShowMessage('Ok!'); if Aresult = mrCancel

Is there a way to get GUID from a generic constraint type?

喜夏-厌秋 提交于 2021-01-28 06:42:38
问题 In the sample code below, the Run<T>() displays the values of GUID IFoo and IFoo<T> interfaces: type IBar = interface ['{992E6597-42F1-40F8-B678-C4A86864B030}'] end; IFoo = interface ['{0C589AF8-5727-4EAA-BB41-6D51D70B9D35}'] end; IFoo<T> = interface(IFoo) ['{8FF54F6B-0896-4EA3-85F8-66BA70F9D2DA}'] end; TTest = class public class procedure Run<T: IFoo>; end; class procedure TTest.Run<T>; var LContext: TRttiContext; IFoo_T_TypeInfo: PTypeInfo; IFooTypeInfo: PTypeInfo; begin IFoo_T_TypeInfo :=

How to change key mapping in Delphi 10.1 Berlin?

☆樱花仙子☆ 提交于 2020-07-18 07:56:05
问题 I want to change some shortcuts for speed settings in my processes. I know that there is an option to change it from Tools > Editor Options > Key Mappings menu but I want to re-assign some keys manually. Is it possible to assign them from Delphi IDE directly without using any third party? 回答1: Just putting @Rudy Velthuis' comment as a answer: Yes, you can remap keys, but only using a custom (partial) keybinding package, which you can easily write and install yourself. An example can be found

How to create a DataModule in Delphi 10.1

前提是你 提交于 2020-01-16 17:55:31
问题 I tried to create a DataModule for my non visible components in my multi-device-application, but the app won't compile giving me the following error: 回答1: Well, I hadn't been working on this app for very long so I started over and I was able to create and use the Datamodule just file. Not sure what the issue was, but thanks, guys. I actually thought I found a bug. Well, I did. It was me 来源: https://stackoverflow.com/questions/40011841/how-to-create-a-datamodule-in-delphi-10-1