Delphi

How to refresh dbgrid without close and open dataset in delphi?

半城伤御伤魂 提交于 2020-01-02 02:48:07
问题 I need to refresh dbgrid constantly, in real time. Close and open dataset works fine, but blink the dbgrid. What can I do to avoid this? I'd like a solution like Ajax, that update only the necessary. Thanks 回答1: Have you tried to use Disable- & EnableControls ? DataSet.DisableControls; try DataSet.Close; DataSet.Open; finally DataSet.EnableControls; end; Furthermore, it should be possible to just call DataSet.Refresh instead of closing and opening to get the same result. 回答2: I use this in my

How to check if the app is running on iOS device or simulator in Delphi XE6

时光毁灭记忆、已成空白 提交于 2020-01-02 02:41:05
问题 Based on this link Conditional compilation (Delphi) CPUARM conditional if should be false for Simulator and true for device, the problem is it's not working for me. I am using Delphi XE6, iOS Simulator 7.1 This is my code {$IFDEF CPUARM} s := 'iOS device'; {$ELSE} s := 'iOS Simulator'; {$ENDIF} p.s iOS Simulator is running in a VMWare virtual machine. 回答1: Checking for CPUARM is the correct solution. iOS binaries compiled for the simulator are not ARM, they are actually x86. Just make sure to

Do generics in Delphi cause performance bottlenecks?

青春壹個敷衍的年華 提交于 2020-01-02 02:04:48
问题 Recently i have been developing an application and wanted to have a collections of several types. I don't want to declare and implement a new collection class for it's type. So, i thought of going with generics, but wasn't sure about the performance of Generics compared to normal typed instances. Performance is the major thing that i am looking at. My application is time critical and even loosing few 100 milliseconds is also not advisable. I am using Delphi XE3 For eg: ICollectionItem =

How can I play a single tone or custom wave with Delphi?

最后都变了- 提交于 2020-01-02 02:02:06
问题 I looked up some code, seems like everything is creating some math function waves, but I want to a single tone, or a custom wave made with custom single tones. I read this How can I generate continuous tones of varying frequencies? Which is close to my answer. Assumin I'm gonna use waveOutWrite like in the above link, I can't seem to figure out how the amp/freq is calculated for each Sample in HWAVEOUT. In the code from the link It's done like this: Samples[i] := round(vol*sin(omega*t));

Delphi TGIFImage animation issue with some GIF viewers

十年热恋 提交于 2020-01-02 01:45:52
问题 I have discovered that animated GIFs created using Delphi 2009's TGIFImage sometimes doesn't play correctly in some GIF viewers. The problem is that the animation is restarted prematurely. Consider the following example: program GIFAnomaly; {$APPTYPE CONSOLE} uses Windows, Types, Classes, SysUtils, Graphics, GIFImg; var g: TGIFImage; bm: TBitmap; procedure MakeFrame(n: integer); var x: Integer; y: Integer; begin for x := 0 to 256 - 1 do for y := 0 to 256 - 1 do bm.Canvas.Pixels[x, y] := RGB(

How can I make signaling NaNs easy to work with?

牧云@^-^@ 提交于 2020-01-02 01:18:29
问题 The IEEE754 standard defines two classes of NaN, the quiet NaN, QNaN, and the signaling NaN, SNaN. When an SNaN is loaded into a floating point register, an exception is raised by the floating point unit. QNaN is available to Delphi code through the constant named NaN that is declared in Math . The definition of that constant is: const NaN = 0.0 / 0.0; I would like to be able to use something similar to declare a constant that is a signaling NaN, but have not yet found a way to do that.

Is any way to add 2 arrays into one?

主宰稳场 提交于 2020-01-02 01:14:28
问题 Is there any simple univesal way to add 2 arrays into one? In the case below it is not possible simply use C := A + B statement... I would like to avoid making algorhytm for it everytime . TPerson = record Birthday: Tdate; Name, Surname:string; end; Tpeople = array of TPerson; var A, B, C:Tpeople; C:=A+B; // it is not possible thanx 回答1: Due to the two string fields in each TPerson record, you can't just use binary "move", since you'll mess the reference counting of string - especially in a

Delphi: writing to the private ancestor's field in descendant class

大兔子大兔子 提交于 2020-01-02 01:07:36
问题 I need to fix a third-party component. This component's class has private variable which is actively used by its descendants: TThirdPartyComponentBase = class private FSomeVar: Integer; public ... end; TThirdPartyComponent = class (TThirdPartyComponentBase) protected procedure Foo; virtual; end; procedure TThirdPartyComponent.Foo; begin FSomeVar := 1; // ACCESSING PRIVATE FIELD! end; This works because both classes are in the same unit, so they're kinda "friends". But if I'll try to create a

Equivalent to designer guidelines in code

核能气质少年 提交于 2020-01-02 01:07:06
问题 The VCL form designer offers pink guidelines for aligning controls at their respective text base lines: But as far as I can tell this doesn't work for labels and checkboxes. Update: It works for labels if you place the controls exactly , e.g. by Ctrl - arrow . It kind of works for checkboxes - see screenshot. Now, on some forms I'm creating controls in code, e.g. ed := TEdit.Create(Self); ed.SetBounds(...); ed.Parent := SomePanel; etc. How can I ensure that their text base lines are aligned?

Delphi Xe2 with Firemonkey : Can you have a non-client area that is painted in a style other than the default Windows nonclient paint style?

a 夏天 提交于 2020-01-02 00:49:32
问题 Here is a sample of a delphi application I am making using firemonkey + Delphi XE2. As you can see, you can use the visual style "stylebook" in Firemonkey to customize the appearance of most things inside the window frame. However the outside of the window frame is drawn using whatever style Windows decides. Now if I was using VCL instead of Firemonkey, I could apply "VCL Styles" and "skin" the whole VCL application in a dark color scheme. My guess is that this is NOT YET posssible with