spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
  Home » DELPHI » Page 1
delphi transparent background component
Well here's a quick answer, that should get you going. type TEllipticPanel = class(Vcl.ExtCtrls.TPanel) procedure CreateWnd; override; procedure Paint; override; procedure Resize; override; procedure RecreateHRGN; end; TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private de

Categories : Delphi

Delphi Julian Date to Normal Date
System.DateUtils.JulianDateToDateTime converts a Julian Date to a TDateTime value. From documentation: The Julian date is the number of days, including fractional days, since 4713 BC January 1, Greenwich noon. And for System.DateUtils.ModifiedJulianDateToDateTime: The modified Julian date is the number of days, including fractional days, since Greenwich midnight on November 17, 1858. Mo

Categories : Delphi

Unable to invoke method declare in class implement generic interface method
This is a well known problem with generic interfaces. Here is yours: type IVisitor<T> = interface ['{9C353AD4-6A3A-44FD-B924-39B86A4CB14D}'] procedure Visit(o: T); end; Now, the as operator is implemented on top of the GUID that you specify for the interface. When you write: (V as IVisitor<TButton>).Visit(Button1); (V as IVisitor<TEdit>).Visit(Edit1); how can th

Categories : Delphi

encryption algorithm rijnadael C# on Delphi
I think the Init and DecryptString methods use arrays as parameters but you are using strings, which are also basically also arrays in Delphi, but special ones. You have to point at the correct first item which is 1 unlike 0 in C. You can of course first also transform your AnsiStrings in array of bytes and feed that to the methods. .Init(aKey[1], ....) and .Decrypt(din[1]) hth

Categories : Delphi

Call Button1Click in Form1/Unit1 from Unit2
Add a procedure declaration to the public section of TForm1, like this type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private public Procedure SayHello; end; ... procedure TForm1.SayHello; begin ShowMessage('Hello'); end; end. Then in Unit2 you would call this procedure. You would have to

Categories : Delphi

F2051 Unit ADODB was compiled with a different version of ADOInt._Command
Check the project source (DPR) and/or settings of the migrated application project. You may find explicit entries in the uses list that reference ADO units that are normally part of the VCL/RTL. Or, you may find the relevant ADO*.pas files have been placed in the same location as the DPR file itself. Alternatively you may find these units in a location that is referenced in the project search p

Categories : Delphi

Calculating flow panel width based on its contents
You don't want a partial tile, so when you're calculating how many columns are needed you want the nearest (equal or greater) integer. In the default rounding mode, Round(7/2) is '4'. That's fine. However Round(5/2) is '2'. That's because With the default rounding mode (rmNearest), if X is exactly halfway between two whole numbers, the result is always the even number. With only two rows

Categories : Delphi

How to call functions, which require the control `Parent` to be set, in constructor?
You should not set the Parent in the constructor. It is as simple as that. The Parent should be set after the constructor has returned. You will need to call these other functions, those that require Parent to be set, later. Or find a way to get the work done without requiring Parent to be set.

Categories : Delphi

How to install DWScript
I just installed dws in the following manner (after downloading using svn and creating a new project directory , DelphiX4, copying the four files from DelphiXE3): When you open dwsLib.dproj you should have (in Project Manager, under ProjectGroup1) dwsLibXE3.bpl as your project. In Project Options - Description, Change LIB suffix to XE4 and under Usage options select 'DesignTime and Runtime'. Click

Categories : Delphi

Delphi newbie errors
This program compiles successfully: {$APPTYPE CONSOLE} uses SysUtils; procedure Foo; var Text: string; rNum: Double; begin rNum := StrToFloat(Text); Text := IntToStr(round(rNum)); Text := FloatToStrF(sqr(rNum), ffFixed, 8, 3); Text := FloatToStrF(sqrt(rNum), ffFixed, 8, 3); Text := FloatToStr(Frac(rNum)); Text := IntToStr(trunc(rNum)); Text := FloatToStr(Frac(rNum)); end; b

Categories : Delphi

Is there a way to check if a folder contains subfolders?
I think in general there is no way to ask a file system object if it contains any directories. I think you need to enumerate the object's children as you have described, for instance with calls to FindFirstFile, FindNextFile etc.

Categories : Delphi

How to debug inno-setup exceptions
The value returned by InitializeSetup() is undefined. function InitializeSetup(): Boolean; begin result := true; end; You get an undefined behaviour because of this. If most of the time the result will be false (last 8 bits of RAX == 0), this is not always the case and you'll get a seriously "hard to understand" issue, particularly when, for no reason, it'll work.

Categories : Delphi

Jpeg save to base64 in TThread
TJPEGImage is not thread safe. While issue with thread safe drawing mentioned in http://qc.embarcadero.com/wc/qcmain.aspx?d=55871 is somewhat fixed in Delphi XE6 (by exposing Canvas property you have to lock yourself), in your case it will probably not help much. You have to synchronize TJPEGImage handling with main thread. Also in your code you have created some memory leaks since you have nev

Categories : Delphi

File Streaming in Delphi - Optimum Buffer Size
@Trojanian, the code you mention above is similar to Remy Lebeau's answer in your previous post, TStringList.LoadFromFile - Exceptions with Large Text Files. I too fiddled around with Remy's example which could load larger files but performance for smaller files was roughly half the speed of TStrings.LoadFromFile. My own attempts to toggle the buffer-size didn't boost performance. Then I found t

Categories : Delphi

How to keep the selected checkmark box selected in a TCheckListbox control after using the .Move() method
You should use a method for calculating the new index and another for moving and follow the item. Then you will have a more speaking, DRY and reuseable for any control derived from TCustomListBox code: procedure TForm1.MoveAndFollow( ListBox : TCustomListBox; OldIndex, NewIndex : integer ); begin ListBox.Items.Move( OldIndex, NewIndex ); ListBox.ItemIndex := NewIndex; end; procedure TForm1.M

Categories : Delphi

When does a ShortCut fire?
That's a deceptively simple question with a surprisingly long answer. First I will deal with some basics and then follow the ShortCut through the VCL code to finally arrive at - I hope - a satisfying conclusion. What is a ShortCut? A ShortCut represents a special keyboard combination of one or more keys that cause an operation. Special means special to the programmer who gives meaning to the spe

Categories : Delphi

delphi twebbrowser setting attribute style for Element has no effect
The following works fine for me (in D7, on Win7 64-bit with IE 11). After clicking Button1, the WebBrowser displays "Some text" right-aligned, as expected. After clicking Button2, "some text" immediately displays center-aligned. Hopefully, a side-by-side comparison with your code will reveal what makes the difference. If the following doesn't help, you might get a better answer if you add a SS

Categories : Delphi

VarArrayAsPSafeArray is not available in Delphi 5.0
VarArrayAsPSafeArray() simply extracts the PSafeArray pointer from inside of a Variant. You can do that directly: V := VarArrayCreate([0, High(a)], varByte); SafeArray := PSafeArray(TVarData(V).VArray);

Categories : Delphi

Lift UInt64 limits with strings in Delphi
Arbitrarily large integers are not supported at the language level in Delphi, but a bit of Googling turns up http://www.delphiforfun.org/programs/Library/big_integers.htm, which can support them as alibrary.

Categories : Delphi

How to retrieve attribute info from a normal Delphi procedure
The article you link to says: There's no way of retrieving any sort of RTTI for "unit" level or local variables and procedures, hence no way of retrieving information about attributes. I believe that this is correct. The documentation lists a number of methods for TRttiContext. These are: Create DropContext FindType Free GetPackages GetType GetTypes KeepContext These give you means to lo

Categories : Delphi

Deplhi Import Component - Type Library vs ActiveX
Delphi Help System says: "The Import Type Library dialog box displays the type libraries registered on your system so you can add them to your projects. If the registered type libraries contain creatable CoClasses, this dialog allows you to install components representing them on the component palette. You can generate declarations in a .pas file that let you use these types as though they were

Categories : Delphi

Get complete URL in Delphi TWebmodule
Sorry, immediately after asking this question I found the required information right before my very eyes, it's Request.host. I now can easily create the redirection: redirecturl:='https://'+request.Host+':'+intToStr(port)+'/settings'; I feed that back into a tag in a pageproducer with the following code <html> <head> <meta http-equiv="Refresh" content="0; url=<#redirecturl&g

Categories : Delphi

Validate user against aspnet_Membership from Delphi
Finally I was able to get this done with help from my colleague and this link courtesy Malcolm Swaine at http://www.codeproject.com/Articles/32600/Manually-validating-an-ASP-NET-user-account-with-a Here is the final code that should do the trick. uses DECHash,Data.Cloud.CloudAPI; ... .. function GetHash_ASPNetMemberShip(const Password, Salt:string):string; var bPassword ,bSalt ,bSaltPassword

Categories : Delphi

Downloading list of files from remote FTP
Googling for EIdAcceptTimeout leads to this discussion in the Indy forum: UseHOST in TIdFTP (client) => EIdAcceptTimeout Where Remy Lebeau states: The only time that exception can occur during a data transfer is if you have the TIdFTP.Passive property set to False, which tells the FTP server to make an inbound connection to TIdFTP. Those connections are usually blocked by firewalls/rou

Categories : Delphi

How to update Node's index after the MoveTo Function performed in TcxTreeList of Delphi
You're referring to the Developer Express TcxTreelist, yes? The reason I ask is that if if I try your code, the compiler objects to "Nodes" as an unknown identifier, so I'm not clear how you're managing to get your code to compile, let alone run. However, with Devex's TcxTreelist, the following code correctly lists the tree items in the order they are currently displayed (i.e. what I see in the

Categories : Delphi

Delphi How to parse specified values from HTTP get
You might use DBXJSON contained in Delphi since Delphi 2010, an other option could be to use e.g. SuperObject. Since your shown example is a simple JSON String without nesting you might access the cointained values by just interating over a TJSONObject acessing as TJSONArray. This array consists of Pairs of "Name" and the value. An simple example shown with the string you provided: uses DBXJSON;

Categories : Delphi

Runtime assigned action's ShortCut does not fire in custom component
Summary There is no built-in Action component in TControl. It is an Action property that is unassigned by default. The user of the control can assign the property with whatever Action is desired. The designer of the control (you) does not have to provide an Action nor ActionList. The actual problem I would like to assign directly to the "built in" Action but cannot find out how to access its

Categories : Delphi

how can I get corners point from some windows region (HRGN)
In general case, there is no way to retrieve initial polygon vertices from HRGN. Internally windows region consists of some rectangles. Exact representation is possible for rectilinear region, but any slanted edge gives a lot of small rectangles (and slightly different polygons could give equal regions) If your problem is to obtain a set of rectangles, then use GetRegionData function.

Categories : Delphi

JMapView control doesn't appear on a FireMonkey form in Android
I have solved the problem. In order to make JMapView control appear on a form I have to execute the following code right after creating JMapView instance: FJMapView.onCreate(TJBundle.JavaClass.init); FJMapView.onResume;

Categories : Delphi

How to wait for termination of itself
I need to call installation (A2) and want to be sure A1 is not running. This is impossible. You cannot execute code in a process that has terminated. Once the process has terminated there is nothing that can execute code. You'll need a new process. Start the new process with the sole task of waiting on its parent to terminate, and then do whatever is needed once the parent has terminated.

Categories : Delphi

Handling error SOAP client
If I hit the web service endpoint http://msw.gov.pl/srp/v3_0/uslugi/subskrypcje/, the server redirects to https://msw.gov.pl/srp/v3_0/uslugi/subskrypcje/. So I suggest that you import the WSDL using the https URI, and try again.

Categories : Delphi

Delphi checklistbox array
It's a little hard to work out what you are doing as we only have a partial explanation, and limited code. However, this looks wrong: Copy(EDI_2.Text, i, j); Assuming you have 1-based strings (i.e. are not using the mobile compilers) then the loop variable i starts at 0. You should instead use: Copy(EDI_2.Text, i+1, j); Now, you don't need j since it is always 1. So it becomes: Copy(EDI_2.T

Categories : Delphi

delphi popup menu click event is not just executed when mouse click the menu item but executed after some function execution
If you would set some breakpoints and use F8 to step through your code you would see what is wrong. Anywhay the reason why the message displayed is 'Item1 Clicked!' is becouse that is set to FMsg variable at the time. The flow of your code is like this: //Popup Menu Item1 Click event handler procedure MyForm.Item1Click(Sender: TObject); begin FMsg := 'Item1 Clicked!'; //4. Called after yo

Categories : Delphi

for all/for each looping through a Delphi TCollection?
For..in loops are implemented as calls to GetEnumerator and the methods on the variable it returns. The Items property is not an object, but an array property that maps silently to a getter/setter pair, so it can't return an enumerator, but TCollection itself does have a GetEnumerator method. Thus: for mycollectionitem in mycollection do mycollectionitem.setWhatever(); Be aware, though, th

Categories : Delphi

How to use User-Input to address specific variables in Pascal (Eval/Exec?)
What you want to do is called Reflection. Delphi does have support for it (they call it Extended RTTI). Give a look at the functions IsPublishedProp and SetPropValue.

Categories : Delphi

Undeclared Identifier using listboxes
Your MainUnit needs to use the ManageUsersUnit unit. If the only references to the form in that other unit are in the implementation section then add it to the uses clause there. As a general rule you should only add to the interface uses clause if absolutely necessary. unit MainUnit; /// ... implementation uses AddTenantUnit, HomeUnit, MainMenuUnit, ManageUsersUnit; Your code then refe

Categories : Delphi

how to color DBGrid special cell?
You can do it this way: if Column.FieldName = 'Clubs' then begin if ADOTable1.FieldByName('Clubs').AsString = 'yes' then DBGrid1.Canvas.Brush.Color := clRed else DBGrid1.Canvas.Brush.Color := clYellow; end; DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);

Categories : Delphi

Capture screenshot from selected minimized window
Try something like this: function ScreenShot(hWindow: HWND; bm: TBitmap): Boolean; var R: TRect; ScreenDc: HDC; lpPal: PLOGPALETTE; wp: WINDOWPLACEMENT; ai: ANIMATIONINFO; hWd: HWND; restoreAnimation: Boolean; ExStyle: LONG_PTR; begin Result := False; if not IsWindow(hWindow) then Exit; ZeroMemory(@wp, SizeOf(wp)); wp.length := SizeOf(wp); GetWindowPlacement(hWindow, @w

Categories : Delphi

Changing default TextSettings Font Family / Size (XE7)
I would expect that default means it's using the settings in the style. You can open the style in the Bitmap Style Designer on the Tools menu, make any changes and the Save As a FireMonkey style. I'm not sure if there's an easy way to change the defaults, though. It may mean changing every font individually.

Categories : Delphi


Recently Add
Delphi and using Teamspeak SDK
delphi transparent background component
Delphi Julian Date to Normal Date
Unable to invoke method declare in class implement generic interface method
encryption algorithm rijnadael C# on Delphi
Call Button1Click in Form1/Unit1 from Unit2
F2051 Unit ADODB was compiled with a different version of ADOInt._Command
Calculating flow panel width based on its contents
How to call functions, which require the control `Parent` to be set, in constructor?
How to install DWScript
Delphi newbie errors
Is there a way to check if a folder contains subfolders?
How to debug inno-setup exceptions
Jpeg save to base64 in TThread
File Streaming in Delphi - Optimum Buffer Size
How to keep the selected checkmark box selected in a TCheckListbox control after using the .Move() method
When does a ShortCut fire?
delphi twebbrowser setting attribute style for Element has no effect
VarArrayAsPSafeArray is not available in Delphi 5.0
Lift UInt64 limits with strings in Delphi
How to retrieve attribute info from a normal Delphi procedure
Deplhi Import Component - Type Library vs ActiveX
Get complete URL in Delphi TWebmodule
Validate user against aspnet_Membership from Delphi
Downloading list of files from remote FTP
How to update Node's index after the MoveTo Function performed in TcxTreeList of Delphi
Delphi How to parse specified values from HTTP get
Runtime assigned action's ShortCut does not fire in custom component
how can I get corners point from some windows region (HRGN)
JMapView control doesn't appear on a FireMonkey form in Android
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.