delphi-2010

Why do TTime comparisons give unexpected results?

我的未来我决定 提交于 2019-12-10 14:43:37
问题 I have observed some kind of weird behaviour regarding the EncodeDateTime and EncodeTime methods and I am seeking some explanation. procedure SomeTestCase; var time: TTime; dateTime: TDateTime; begin time := EncodeTime(8, 0, 0, 0); date := EncodeDateTime(2012, 11, 2, 8, 0, 0, 0); Assert(time = TimeOf(date)); //Fails end; What I've found is that date 's hour portion evaluates to 7:59:59 instead of 8:00:00 . But if I set the hour portion of time and date to 9, the assert passes and date

Drag image change while drag over grid

喜你入骨 提交于 2019-12-10 13:58:22
问题 I'm creating an instance of my custom DragObject on StartDrag: procedure TForm1.GridStartDrag(Sender: TObject; var DragObject: TDragObject); begin DragObject := TMyDragControlObject.Create(Sender as TcxGridSite); end; Lately on another grid on DragOver: procedure TForm1.SecondGridDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); begin Accept := False; if Source is TMyDragControlObject then with TMyDragControlObject(Source) do // using TcxGrid if

Error Starting Delphi When Debugging Design Time Package

╄→гoц情女王★ 提交于 2019-12-10 13:50:05
问题 I've encountered a problem starting a second instance of Delphi 2010 for debugging a design time package. Under Project Options|Debugger, I use "C:\Program Files\Embarcadero\RAD Studio\7.0\bin\bds.exe" as the host app with these parameters: "-pDelphi -nocache" I get the following error message when I run the package: If I continue, I get the following: Then, if I continue, I get the following: What am I doing wrong? This has always worked before. (I have repaired and uninstalled/reinstalled

how to dynamically create a component in delphi such as TLabel or TEdit …etc

馋奶兔 提交于 2019-12-10 13:29:19
问题 Using Delphi 2010 SQLQuery1.First; // move to the first record while(not SQLQuery1.EOF)do begin // do something with the current record // What's the code should i write in this part in order to create a TEdit // containing the user fullname the current item. ShowMessage(SQLQuery1['whom']); SQLQuery1.Next; // move to the next record end; 回答1: Well, to create a TEdit you need to do the following: Create a variable to work with. Either a local variable or a class member. Edit: TEdit; Then you

How to disable MouseWheel if mouse is not over VirtualTreeView (TVirtualStringTree)

谁都会走 提交于 2019-12-10 12:56:44
问题 TVirtualStringTree behaves by default if it is focused - it will scroll on mouse wheel even if mouse is not over control (except if it is over another TVirtualStringTree). Is there a quick and elegant way to disable this behaviour? I already did this with OnMouseWheel event and checking with PtInRect if Mouse.CursorPos if it is over a control but I have a feeling that there is a better way to do the same because this way I'd have to define a new event for each TreeView I add and also handle

Crt unit for Delphi 2010 [closed]

只愿长相守 提交于 2019-12-10 12:26:34
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I need Crt unit for Delphi 2010 console application (ReadKey, GotoXY, ...). Is there any Crt unit for Delphi 2010? 回答1: I'd start with any of the CRT units here. 回答2: I updated the code from Branko's link, and came up with this: https://onedrive.live.com/embed?cid=F5BB35AE00415BC7&resid=F5BB35AE00415BC7%21232

How do I programatically add actions to an Action Manager in Delphi 2010

会有一股神秘感。 提交于 2019-12-10 11:22:55
问题 I am trying to dynamically add actionitems, I can add the item and it works when I do this: HostActionItem := ActionManager.ActionBars[0].Items[0].Items[2]; NewItem := HostAction.Items.Add; NewItem.Action := MyActionToPerform; NewItem.Caption := Description; NewItem.ImageIndex := 1; NewItem.Tag := 13; However, when the action Execute method fires I attempt to get the ActionComponent from the Sender object like this: if (Sender is TAction) then tag := (Sender As TAction).ActionComponent.Tag;

What version of Delphi will let me create software that runs on a Mac?

眉间皱痕 提交于 2019-12-10 11:14:43
问题 I use Delphi and last year I upgraded from D5 Enterprise to Delphi 2010 Profession. Occasionally I get emails asking when I will have a version that runs on a Mac. Is there a version of Delphi out there that will create software that runs on a Mac? If not, do you know if Embarcadero plans on rolling out a version that does this in the near future? 回答1: See the roadmap: http://edn.embarcadero.com/article/39934 Project "Pulsar", slide 13. In the short term, many Delphi apps run just fine on the

Global, thread safe, cookies manager with Indy

我怕爱的太早我们不能终老 提交于 2019-12-10 10:53:36
问题 My Delphi 2010 app uploads stuff using multi-threading, uploaded data is POSTed to a PHP/web application which requires login, so I need to use a shared/global cookies manager (I'm using Indy10 Revision 4743 ) since TIdCookieManager is not thread-safe :( Also, server side, session id is automatically re-generated every 5 minutes, so I must keep both the global & local cookie managers in sync. My code looks like this: TUploadThread = class(TThread) // ... var GlobalCookieManager :

List local printers

为君一笑 提交于 2019-12-10 10:43:34
问题 I am using this routine to list the local printers installed on on a machine: var p: pointer; hpi: _PRINTER_INFO_2A; hGlobal: cardinal; dwNeeded, dwReturned: DWORD; bFlag: boolean; i: dword; begin p := nil; EnumPrinters(PRINTER_ENUM_LOCAL, nil, 2, p, 0, dwNeeded, dwReturned); if (dwNeeded = 0) then exit; GetMem(p,dwNeeded); if (p = nil) then exit; bFlag := EnumPrinters(PRINTER_ENUM_LOCAL, nil, 2, p, dwneeded, dwNeeded, dwReturned); if (not bFlag) then exit; CbLblPrinterPath.Properties.Items