Delphi

Delphi: better design to avoid circular unit reference?

时间秒杀一切 提交于 2020-07-19 01:59:27
问题 I have a triangular mesh structure in Delphi 10. For performance reasons I store the data of the mesh's vertices, triangle faces, etc. in descendants of TList. I let the TLists do the calculations for every member of the list. For these calculations I need access to some fields of the TMesh structure. Therefore during the creation of TMesh and subsequently the creation of the lists I assign the parent TMesh to the lists. I use a forward declaration of TMesh to do so. Please see the following

Delphi: better design to avoid circular unit reference?

我怕爱的太早我们不能终老 提交于 2020-07-19 01:57:29
问题 I have a triangular mesh structure in Delphi 10. For performance reasons I store the data of the mesh's vertices, triangle faces, etc. in descendants of TList. I let the TLists do the calculations for every member of the list. For these calculations I need access to some fields of the TMesh structure. Therefore during the creation of TMesh and subsequently the creation of the lists I assign the parent TMesh to the lists. I use a forward declaration of TMesh to do so. Please see the following

Delphi: better design to avoid circular unit reference?

喜欢而已 提交于 2020-07-19 01:57:28
问题 I have a triangular mesh structure in Delphi 10. For performance reasons I store the data of the mesh's vertices, triangle faces, etc. in descendants of TList. I let the TLists do the calculations for every member of the list. For these calculations I need access to some fields of the TMesh structure. Therefore during the creation of TMesh and subsequently the creation of the lists I assign the parent TMesh to the lists. I use a forward declaration of TMesh to do so. Please see the following

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

What are the implications of using Canvas.TextOut?

谁说我不能喝 提交于 2020-07-17 09:30:16
问题 Introduction My question comes from a rather interesting problem I have been dealing with for the past few days. I recently asked a question regarding Writing a custom property inspector - How to handle inplace editor focus when validating values? I have since made some nice progress with my control such as adding a divider in the middle to separate between Name and Value rows, and importantly the divider can be used to resize the two columns. Here is where my problems started, having the

Delphi - form within form

℡╲_俬逩灬. 提交于 2020-07-17 07:49:05
问题 For aesthetic reasons, I want to show a form on top of another form, just as if it were a component, say like a TPanel. It should resize with the parent, move around as the parent is dragged by its title bar, etc. ----------------------------- | main form component 1 | ----------------------------- | main | the 'embedded' | | form | form goes here | |comp 2| | ----------------------------- can I do that? If so how? I am now leaning towards MDI... 回答1: Put a panel where you want your embedded

Delphi - Access violation while creating a TList of UnicodeString

会有一股神秘感。 提交于 2020-07-10 12:23:44
问题 I'm writing a Delphi package with RAD Studio XE7. I recently faced a strange access violation, and I cannot figure out why it happened. The context was that I was trying to maintain a list of font names. So I declared the following type: ICustomFontList = TList<UnicodeString>; Inside one of my classes, I declared a variable as follow: m_pCustomFontList: ICustomFontList; Then, in the constructor, I tried to instantiate this variable like that: m_pCustomFontList := ICustomFontList.Create; I

Delphi - Access violation while creating a TList of UnicodeString

旧巷老猫 提交于 2020-07-10 12:10:13
问题 I'm writing a Delphi package with RAD Studio XE7. I recently faced a strange access violation, and I cannot figure out why it happened. The context was that I was trying to maintain a list of font names. So I declared the following type: ICustomFontList = TList<UnicodeString>; Inside one of my classes, I declared a variable as follow: m_pCustomFontList: ICustomFontList; Then, in the constructor, I tried to instantiate this variable like that: m_pCustomFontList := ICustomFontList.Create; I

Setting a value in a Nullable<T> record with RTTI

旧时模样 提交于 2020-07-09 17:13:24
问题 I'm working with Serialization/Deserialization using NEON library from Paolo Rossi. i'm trying to populate this class using RTTI, with data that i get from a database. The properties on the class have the same name of the fields in the database. In the library, i have this Nullable Record : unit Neon.Core.Nullables; interface uses System.SysUtils, System.Variants, System.Classes, System.Generics.Defaults, System.Rtti, System.TypInfo, System.JSON; type ENullableException = class(Exception); {

How do do things during Delphi form startup

ぐ巨炮叔叔 提交于 2020-07-09 13:25:31
问题 I have a form one which I want to show a file open dialog box before the full form opens. I already found that I can't do UI related stuff in FormShow, but it seems that I can in FormActivate (which I protect from being called a second time...) However, if the user cancels out of the file open dialog, I want to close the form without proceeding. But, a form close in the activate event handler generates an error that I can't change the visibility of the form. So how does one do some UI related