delphi-xe2

How can I declare an array property?

て烟熏妆下的殇ゞ 提交于 2019-12-06 20:21:06
问题 I constructed class system TTableSpec=class(Tobject) private FName : string; FDescription : string; FCan_add : Boolean; FCan_edit : Boolean; FCan_delete : Boolean; FFields : array[1..100] of TFieldSpec; public property Name: String read FName; property Description: String read FDescription; property Can_add : Boolean read FCan_add; property Can_edit : Boolean read FCan_edit; property Can_delete : Boolean read FCan_delete; property Fields : array read FFields; end; Thus in TableSpec Fields

Firemonkey ScrollBox Bug

房东的猫 提交于 2019-12-06 16:33:22
问题 We are experiencing what seems to be a strange bug in Firemonkey's ScrollBox component (since TGrid inherits from TScrollBox it also affects all grids). On some ouf our development machines, everything works fine, while on others the bug occurs. We failed to detect any pattern between the systems (we checked OS, graphics hardware, DirectX version). Reproduction: Create a new FireMonkey application. Place a TScrollBox on the form. Add a button to the scrollBox and set its vertical position to

dynamically create popup menu tree from sql server table in Delphi

北慕城南 提交于 2019-12-06 15:39:35
I have a table like this: id parent_id name 1 1 Root 2 1 Car 3 1 Plane 4 2 BMW 5 4 CLK How can I dynamically create popup menu with all subitems in Delphi? This is how it should look like: Assuming root element has NULL as Parent_ID you can issue the request Select ID, Parent_ID, Name from all_my_menus order by Parent_ID nulls first, ID where Menu_ID = :MenuIDParameter 1 <NULL> Root 8 <NULL> another root 2 1 Car 4 1 Plane 3 2 BMW 5 4 CLK You would also cache in-memory created menu items: var MI_by_id: TDictionary<integer, TMenuItem>; The traversing through the results would look like var MI:

Reading response from TIdDNSResolver?

邮差的信 提交于 2019-12-06 14:33:18
I cannot find any simple examples of a DNS lookup using Indy 10's TIdDNSResolver component. They're all either for something I don't need (such as MX/SMTP), or are talking terms with no code . I have tried reading the result based on the few resources I can find, but don't know how I'm supposed to be reading the result. Here's what I have so far... uses IdBaseComponent, IdComponent, IdTCPConnection, IdDNSResolver; function TForm1.Lookup(const Name: String): String; var X: Integer; begin //DNS: TIdDNSResolver DNS.QueryType:= [qtA]; DNS.Resolve(Name); for X:= 0 to DNS.QueryResult.Count-1 do

Fade an image using GDI+ (i.e. Change only the Alpha channel of a TGPGraphic)

谁说胖子不能爱 提交于 2019-12-06 14:02:24
问题 I need to fade the right side of an image using GDI+. I'm actually trying to emulate the right hand side text fade that you see in Google Chrome. Here's what I want to do. Create a TGPGraphics object from a TBitmap . Create a TGPBitmap from a region of the TBitmap . Paint the background of the TGPGraphics object and the text to the TGPBitmap . Change the Alpha settings on the right hand side of the TGPBitmap object to produce the fade effect. Draw the TGPBitmap back to the TGPGraphics object.

Delphi IAccessible Get_accState influences Get_accName?

北慕城南 提交于 2019-12-06 13:56:35
I'm currently adding the IAccessible-Interface to my derived VCL-Components to be able to implement automated UI-Testing for my application. After implementing the interface i didnt see the name in the properties of my components read out via external tools, though i saw while debugging it was set. After "some" (or more likely very much) testing around i found out, that the return value of Get_accState seems to be influencing the name: When I return S_OK in this function (independet from the State i set), my Control name is empty, else it's the value set in Get_accName . Am I doing something

delphi - how to get type of enum

℡╲_俬逩灬. 提交于 2019-12-06 13:39:48
I know how to get enum value from integer value, and I have this code function GetEnumValue(intValue:integer):TMyType begin if(ordValue >= Ord(Low(TMyType)))and(ordValue <= Ord(High(TMyType)))then result :=TMyType(ordValue) else raise Exception.Create('ordValue out of TMyType range'); end; I have similiar code like above in many place for many enum type other than TMyType, I want encapsulate that code to single protected code on base class, so inherited class can use it. but I dont know how to generalize TMyType, so my code can check if it right enum type or another type object I cant have a

Embeded DB for Firemonkey apps

随声附和 提交于 2019-12-06 13:22:52
问题 Creating a client application, want the whole DB to be embed in the software or in a single standalone dll (ie sqlite), not something like mysql. Whats built into XE2 which would work 'out of the box' and not need thirdparty tools? Other than TClientDataSet / xml files :) 回答1: You can use my SQLite wrapper (also some more info in my blog) which supports multiple platforms. In Windows you'll need to deploy sqlite3.dll with your application, there is no need for this on OSX. You can get sources

How to reproduce this Code Completion bug?

杀马特。学长 韩版系。学妹 提交于 2019-12-06 11:54:48
I'm having a bug on Delphi XE2 (Update 4 Hotfix 1), which reproduces many times on the legacy project I work (it evolved from D6 to D7,D2006 and finally XE2), but I didn't know how to trigger it in a smaller project. The latest time, it triggered on creating an event handler for a "hidden popup" on the app. When I click on the menu option to create the Click handler this happens. pprocedure TMainForm.Blablabla1Click(Sender: TObject); begin end; rocedure TMainForm.FormActivate(Sender: TObject); You can see that the IDE inserted the new code INSIDE the declaration of the next method... But it's

Attaching an object to an already existing ListItem?

烈酒焚心 提交于 2019-12-06 10:46:18
In a ListView, how can I attach an object at any time to an already existing ListItem? (I know I can attach an object to a ListItem with AddItem , however I need to attach the object after the ListItem has been created). You can access it through the TListItem.Data property. For example: var ListItem: TListItem; begin ListView1.AddItem('Item 1', nil); ... ListItem := ListView1.Items[0]; ListItem.Data := Edit1; TEdit(ListItem.Data).Text := 'Updated text...'; end; You could solve this using the Data property of TListItem . That's often a quick and easy approach. The only slight wrinkle is if you