-
Content Count
1977 -
Joined
-
Last visited
-
Days Won
26
Everything posted by Attila Kovacs
-
ToolsApi: key boardbindings in the form editor
Attila Kovacs replied to santiago's topic in Delphi IDE and APIs
ctrl+alt+f12, not the best hotkey though. -
Doesn't this network license cost you mobility? What about notebooks, travelling, home office, etc..? Do you carry a shadow VM with your notebook which runs in the background? What is EMBT's problem with a 20 year old application? They should have make it free/abandonware long time ago if they don't want to take care of it anymore. But wait! There was a campaign in July 2015, buy Delphi XE8 and get an old version free of choice for free with it! Including Delphi 7! So what exactly is EMBT's problem? Nothing, which could't be managed in 5 minutes with some internal changes.
-
Ah, I see, but, Picture.Assign in this case calls TGraphic.Assign(Source) where source is your "jpeg", and it assigns by reference, so you must not free it, it will be free'd on reassigning or destroying the component. As far as I can see in the sources.
-
you changed Picture.Graphic.Assign(DataLink.Field) to Picture.Assign(...); ?
-
after accidentally turning off the "View references before refactoring" option on the form. (ctrl-shift-e) btw. if ctrl-shift-e stops working just trigger the context menu of the IDE code editor once. (right click)
-
Should I separate common units to Public and Internal, or have all Public?
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
"And I have CommonProjectDefinitions.pas where all types and common methods are defined." You either stick with this "very oldschool" method or you explode this unit separated by the modules using it, but splitting it after public/bird/dog/whatever is definitely a way to nowhere. -
you have to edit VTV sources and before every DrawText(W) do a DrawFormat := DrawFormat or DT_EXPANDTABS or DT_TABSTOPS; DrawFormat := DrawFormat or (FTabwidth shl 8); and you can create a property of FTabwidth, (plus one for Expandtabs yes/no).
-
TThread always raises OS Errror
Attila Kovacs replied to pyscripter's topic in RTL and Delphi Object Pascal
I understand his curiosity. It's only matters if there was an error which was not handled but it should have been. In 10.1 and 10.2 (the last release I have) the above example does not yield any error, GetLastError returns 0. You have to step through the app and look where it happens if you wan't to know. "Is this a known issue?" As others has also mentioned, it's not necessarily an issue, but a state. -
I don't know FMX, but normally a StringGrid is just a display and you sort the underlying data. But I don't know FMX.
-
turn off you disk cache and check it again
-
Locations vs Values: using RTTI to work with value types
Attila Kovacs replied to pyscripter's topic in RTL and Delphi Object Pascal
it's in the comments -
FastMM5 now released by Pierre le Riche (small background story)
Attila Kovacs replied to Günther Schoch's topic in Delphi Third-Party
@Kas Ob. Everything fine with your test. Reverted back to 'a'+c+'xxx..' and the results are same as yours. However, changing 'xxx..' to something longer changes the game. It performs better on larger memory chunks, but therefore also uses a lot more RAM. Btw, now I understand why was it slower on the first couple of runs, it did not reach the barrier. FMM5 performs more homogeneous, seamless transition between the block sizes. -
FastMM5 now released by Pierre le Riche (small background story)
Attila Kovacs replied to Günther Schoch's topic in Delphi Third-Party
@Kas Ob. Okay, I don't know how interesting is it. I've downloaded the SMM2 sources, changed the 'xxx..' stuff in the test dpr for some lorem ipsum cantus and my CPU is i7-3930K The two fastest runs: // Parallel For used : 8857900 ticks 32-bit // Parallel For used : 7113633 ticks 64-bit Edit: Under Berlin U2. -
FastMM5 now released by Pierre le Riche (small background story)
Attila Kovacs replied to Günther Schoch's topic in Delphi Third-Party
for me SMM2 is faster on x64 as on x86, also SMM2 uses much more RAM as FMM5, so it's possible that FMM5 could be tuned to use more RAM and even less CPU (?). -
How to remember units and classes, where is what?
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
copy paste this post as a comment into your frame -
Prevent WM_VSCROLL on TScrollBox to be executed twice in a row
Attila Kovacs replied to Mike Torrettinni's topic in VCL
I see. Then you could also check how Align "alCustom" works. It could save you some repainting/flickering. -
Prevent WM_VSCROLL on TScrollBox to be executed twice in a row
Attila Kovacs replied to Mike Torrettinni's topic in VCL
No I didn't miss it, and if it works for you then fine. Just fyi, if you drag the thumb, there will be messages coming (more than 2) and if you release the mouse button SB_ENDSCROLL fires. So depending on what you need, "OnScrolling" (Message.ScrollCode <> SB_ENDSCROLL) or "OnScroll" (Message.ScrollCode = SB_ENDSCROLL) you can call your event if assigned. May I ask what do you have in those events? -
Prevent WM_VSCROLL on TScrollBox to be executed twice in a row
Attila Kovacs replied to Mike Torrettinni's topic in VCL
If you were looking for "How to implement OnScroll events" you can trigger it on SB_ENDSCROLL and not on NOT SB_ENDSCROLL. But in this case your question was misleading and wasting our time. -
Prevent WM_VSCROLL on TScrollBox to be executed twice in a row
Attila Kovacs replied to Mike Torrettinni's topic in VCL
That was never my intention to suppress standard windows messages. I answered the question: "I'm looking at this simple example to scroll 2 Scroll boxes at the same time." Does it scroll 2 scrollboxes the same time? (Vertically, I did not implement the horizontal scroll message) -
Prevent WM_VSCROLL on TScrollBox to be executed twice in a row
Attila Kovacs replied to Mike Torrettinni's topic in VCL
There is a reason for the two calls. See msg.ScrollCode and https://docs.microsoft.com/en-us/windows/win32/controls/wm-vscroll Try this. TScrollBox = class(Vcl.Forms.TScrollBox) procedure WMVScroll(var msg: TWMVScroll); message WM_VSCROLL; end; procedure TForm1.ScrollBoxMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); procedure SetPos(ScrollBox: TScrollBox); var NewPos: Integer; begin NewPos := ScrollBox.VertScrollBar.Position - WheelDelta div 5; // sensitivity NewPos := Max(NewPos, 0); NewPos := Min(NewPos, ScrollBox.VertScrollBar.Range); ScrollBox.VertScrollBar.Position := NewPos; end; begin SetPos(ScrollBox1); SetPos(ScrollBox2); Handled := True; end; var InScroll: Boolean; procedure TScrollBox.WMVScroll(var msg: TWMVScroll); begin inherited; if not InScroll then begin InScroll := True; try if Self = Form1.ScrollBox1 then Form1.ScrollBox2.Dispatch(msg) else Form1.ScrollBox1.Dispatch(msg); finally InScroll := False; end; end; end; -
Making method with default encoding
Attila Kovacs replied to Tommi Prami's topic in RTL and Delphi Object Pascal
for TEncoding you can set it nil as default and use your favorite one (as default) if the param is nil -
right click on the object inspector and properties, not sure for themed skin
-
@Fr0sT.Brutal I was starting like that but I wanted a human readable output. But yes, basically you are right.
-
As I could not find anything measuring the InitUnits, and it has its reasons, I come up with this poor mans profiler: Two breakpoints is System.pas, one on TProc(P)(); in "procedure InitUnits;" and the other on the very next asm line: Then right-clink on the red bullets, "Breakpoint properties" -> "Advanced" On the first one: (actually you don't need the "Log result" here) On the second: (I have attached the InitHelper.pas to this post.) And just run the app. It will take a time to finish, then you can save the Events and process/investigate the output. Of course, the measured times are higher because of the debugger, but it gives a very good orientation for finding bottlenecks. To check the unit, place a conditional breakpoint on "I" somewhere. InitHelper.pas