delphi-2010

Delphi 2010: How to save a whole record to a file?

你离开我真会死。 提交于 2020-02-09 01:09:09
问题 I have defined a record which has lots of fields with different types (integer, real , string, ... plus dynamic arrays in terms of "array of ..."). I want to save it as a whole to a file and then be able to load it back to my program. I don't want to go through saving each field's value individually. The file type (binary or ascii or ...) is not important as long Delphi could read it back to a record. Do you have any suggestions? 回答1: You can load and save the memory of a record directly to

Delphi 2010: How to save a whole record to a file?

白昼怎懂夜的黑 提交于 2020-02-09 01:08:57
问题 I have defined a record which has lots of fields with different types (integer, real , string, ... plus dynamic arrays in terms of "array of ..."). I want to save it as a whole to a file and then be able to load it back to my program. I don't want to go through saving each field's value individually. The file type (binary or ascii or ...) is not important as long Delphi could read it back to a record. Do you have any suggestions? 回答1: You can load and save the memory of a record directly to

Delphi: RTTI and TObjectList<TObject>

此生再无相见时 提交于 2020-02-02 04:07:56
问题 Based on one answer to an earlier post, I'm investigating the possibility of the following design TChildClass = class(TObject) private FField1: string; FField2: string; end; TMyClass = class(TObject) private FField1: TChildClass; FField2: TObjectList<TChildClass>; end; Now, in the real world, TMyClass will have 10 different lists like this, so I would like to be able to address these lists using RTTI. However, I'm not interested in the other fields of this class, so I need to check if a

Delphi: RTTI and TObjectList<TObject>

笑着哭i 提交于 2020-02-02 04:06:47
问题 Based on one answer to an earlier post, I'm investigating the possibility of the following design TChildClass = class(TObject) private FField1: string; FField2: string; end; TMyClass = class(TObject) private FField1: TChildClass; FField2: TObjectList<TChildClass>; end; Now, in the real world, TMyClass will have 10 different lists like this, so I would like to be able to address these lists using RTTI. However, I'm not interested in the other fields of this class, so I need to check if a

Controlling file downloads

假装没事ソ 提交于 2020-01-29 09:49:07
问题 I am building an updater for my program with the use of a TWebBrowser. OnCreate the TWebBrowser navigates to the given URL. To download the update, the user is required to click a link. When the link is clicked this popup appears: So I was wondering if it was possible to: Bypass that popup and allow for automatic download. Set a fixed path that the file would download to. 回答1: I would use Indy's TIdHTTP component for that, eg: uses ..., IdHTTP; var Url, LocalFile: String; Strm: TFileStream;

Delphi SVN integration that works with SVN 1.7?

。_饼干妹妹 提交于 2020-01-23 05:45:07
问题 I've just upgraded my SVN repository from 1.6 to 1.7. A major change to the repository format in 1.7 is that the ".svn" folders are no longer stored in each subdirectory; only in the root folder of the repository. Unfortunately this seems to confuse the JCL SVN integration I have been using. It seems to think my files are not under source control. Is there any Delphi SVN integration that works with 1.7 now or that has plans to support it in the near future? I am using Delphi 2010. UPDATE

Focus next control on enter - in overridden KeyUp

喜夏-厌秋 提交于 2020-01-20 03:24:25
问题 I have my custom class that extends TEdit: TMyTextEdit = class (TEdit) private fFocusNextOnEnter: Boolean; public procedure KeyUp(var Key: Word; Shift :TShiftState); override; published property FocusNextOnExnter: Boolean read fFocusNextOnEnter write fFocusNextOnEnter default false; end; In The KeyUp procedure I do: procedure TMyTextEdit.KeyUp(var Key: Word; Shift: TShiftState); begin inherited; if FocusNextOnExnter then if Key = VK_RETURN then SelectNext(Self as TWinControl, True, false);

Help with Delphi 7, ADO, & MS Access SQL Statement

老子叫甜甜 提交于 2020-01-16 18:26:09
问题 I have three tables (in a MS Access Database 2000 file *.mdb) Knowledge id question answer Knowledge_Keywords id knowledgeid keywordsid Keywords id keyword Need to get all the keywords for a knowledge Select distinct keyword from keywords KW Join knowledge_keywords KKW on KKW.keywordid = KW.id Join Knowledge K on K.id = KKW.knowledgeid Where k.id = 10 of course 10 is a example, i actually use a parameter there Where k.id = :AKnowId'; and fill it in in code qry.Parameters.ParamByName('AKnowId'

Notifying the Datasanap Server if the a client closed abnormal

浪子不回头ぞ 提交于 2020-01-15 05:33:07
问题 I am working on HTTP DataSnap project using Delphi 2010. How to Notify the server that an client is closed abnormal (Killing Proces for ex.)? more detail: I need my server to know if any client is disconnected, Its OK but the problem is raised when the client is closed by task manager using Kill process. 回答1: You don't notify the server that the client crashed. You generally can't because you have nothing to notify it with — your only connection to the server was the client, and the client

Altering ITEMINDEX of TComboBox does not trigger it's OnChange event

心不动则不痛 提交于 2020-01-15 03:13:11
问题 When programmatically changing the value of ItemIndex of a TComboBox component in Delphi, one would expect for the corresponding OnChange event to get triggered. Afterall, the visible value of the ComboBox get's changed as a result. Strangely it does not. Same behavior in Delphi6, Delphi 2010 and Delphi XE7. Is there any reason behind this behavior or it's just a pending bug? 回答1: From documentation: Occurs when the user changes the text displayed in the edit region. Write an OnChange event