delphi-2010

TEdit onclick select all?

≡放荡痞女 提交于 2019-12-05 22:07:31
How to select all text of a TEdit1 whenever user click on it or click to select some text of it How to select all text of a TEdit1 whenever user click on it Select Edit1 in the VCL editor and double-click on the OnClick event: procedure TForm13.Edit1Click(Sender: TObject); begin Edit1.SelectAll; end; You can also link this event to another control like a button. Select the button, choose and click on the V arrow to select an event you want to link. Now both Edit1.OnClick and Button1.OnClick link to the same event. It can be quite dangerous to do anything beyond the default behaviour of the

JclMapi mapi general failure

无人久伴 提交于 2019-12-05 18:27:42
I have the code: procedure TfrmMain.btnSendClick(Sender: TObject); var aMail: TJclEMail; begin aMail := TJclEMail.Create; Screen.Cursor := crHourGlass; try aMail.Recipients.Add('service@blabla.com'); aMail.Subject := '[IMPORTANT] blablba'; aMail.Body := 'text text text text'; aMail.Send(True); finally Screen.Cursor := crDefault; aMail.Free; end; end; This throws: MAPI Error: (2) "General MAPI failure" Any idea? ps: OS Windows 7 Outlook 2010 Delphi 2007 I have the same as you, just wrapped inside a class and it is working. I use to check if MAPI is OK at the first time I execute Send():

Delphi: RTTI and TObjectList<TObject>

≡放荡痞女 提交于 2019-12-05 16:36:49
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 certain field is some sort of TObjectList. This is what I've got so far: procedure InitializeClass(RContext

TListView Column Sort (Sort by first two columns)

非 Y 不嫁゛ 提交于 2019-12-05 14:50:58
I am using Delphi 2010 and TListView to list Names and other data. The first two columns is the Last Name & First Name Caption = Last Name SubItems[0] = First Name How do I sort the ListView by these two columns? These will only be the columns the Listview will be sorted by and I would like to always keep the sort as such (when adding, editing, deleting items) How can I accomplish this? Set SortType to 'stBoth', and implement an OnCompare event handler. Example: procedure TForm1.ListView1Compare(Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer); var S1, S2: string;

When and how should I obfuscate my Delphi code?

梦想与她 提交于 2019-12-05 14:08:58
What should I know about code obfuscation in Delphi? Should I or shouldn't I do it? How it is done and is there any good tools (commercial/free) to automate it? Why would you need to? As a whole Delphi does not decompile back, unlike .net, so, while decompilation is always a bit of a risk, Ive never found a decompiler that actually did it to a useful way, lots of areas got left as assembler and so on. If people want to rework your work, they can, no matter what, obfuscation or not, heck, some coders write almost naturally obfuscated code (having worked with a few) My vote therefore, is

Generic defined in unit breaking debug information

拥有回忆 提交于 2019-12-05 10:43:18
This must be a Delphi bug... I have a unit which is the basis of my persistance framework. In that unit I have a base class for all my domain objects, a list class and a generic list class. Just recently I noticed that when I step into the unit when debugging, execution will jump to a point a little further down in the file than it should... Maybe four or five lines. Re-ordering the file makes no difference. The code would also generate access violations, but only when I debugged it. I cast about trying to find the reason for this... Several things came to mind, like some code injection

Delphi RTTI: Get property's class

和自甴很熟 提交于 2019-12-05 10:22:50
Using Delphi 2010 and RTTI, I know how to get the class type of an object and how to get/set the value and type of an object's properties, but how do you determine which class in the inheritance chain a property came from? I want to use the properties of a base class differently than the main class. Consider this code: TClassBase = class(TObject) published property A: Integer; end; TClassDescendant = class(TClassBase) published property B: Integer; end; procedure CheckProperties(Obj: TObject); var ctx: TRttiContext; objType: TRttiType; Prop: TRttiProperty; begin ctx := TRttiContext.Create;

Find all Class Helpers in Delphi at runtime using RTTI?

↘锁芯ラ 提交于 2019-12-05 09:56:11
Does the extended RTTI in Delphi 2010 offer a way to list defined Class and Record Helpers at run time? As far as I know Delphi does not show a hint or warning when more than one class helper is defined for a class, class helper detection might be a helpful routine in 'quality assurance'. p.s. of course I know I should never ever use third party components or libraries without source code, which would make it easy to grep class helpers. Since class helpers only apply to a class based on what helper is "closest" in scope, a class simply cannot know that a helper exists. For example, you can

Is Delphi Prism a new version of Delphi .net?

巧了我就是萌 提交于 2019-12-05 09:48:20
First of all (before this question get down voted): I am a developer developing 99,99% of my programs using Delphi targeting Win32 (developing in Delphi 7 still, very slowly migrating to Delphi 2010). When Delphi 2006 or 2007 (can't remember which version at the moment) came out I bought the RAD Studio edition to be able to start developing .net applications using Delphi.net and VCL.net. I played around with it for some short time, but in the end, due to work load just kept using Delphi 7 as development platform. When Delphi 2010 came was released, I decided to give .net a go once more, and