Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Hi, in a program I have a central FireDAC connection to my database in a datamodule. I intend to have all record related activities (CRUD) in a class that holds the record. My questions are: 1) is there any penalty if I pass the connection (as var parameter?) to the constructor of the class? 2) is this the best way to separate the data from the UI? many thanks in advance Gernot
  3. David Heffernan

    DelphiTwain on 64-bit

    Well, apparently GlobalLock failed with an invalid handle. Why is that? You need to work out where Handle came from and why it is not valid.
  4. Dave Nottage

    DelphiTwain on 64-bit

    I discovered that it is throwing an AV at this part of TTwainSource.ReadNative: DibInfo := GlobalLock(Handle); ColorTableSize := (DibNumColors(DibInfo) * SizeOf(RGBQUAD)); // <---- AV here when it calls DibNumColors, as DibInfo is nil The code is inside a DLL written for Windows Terminal Services. The same code works fine in a DLL that is just loaded via a plain application, so perhaps it has something to with WTS? If I call SysErrorMessage(GetLastError) after the GlobalLock, the message is: The handle is invalid. The value for Handle is non-zero.
  5. Today
  6. Dave Nottage

    TEdit with a background color

    Instead of using Edit Custom Style for every component that we want a background color on, I came up with some code similar to this: type TEditEx = class(TEdit) private FColor: TAlphaColor; function GetBackgroundRectangle: TRectangle; procedure InternalSetColor(const Value: TAlphaColor); procedure SetColor(const Value: TAlphaColor); protected procedure ApplyStyle; override; published property Color: TAlphaColor read FColor write SetColor; end; procedure TEditEx.ApplyStyle; begin inherited; InternalSetColor(FColor); end; function TEditEx.GetBackgroundRectangle: TRectangle; var LStyleObject: TFmxObject; I: Integer; begin Result := nil; LStyleObject := FindStyleResource('rect'); if LStyleObject = nil then begin LStyleObject := FindStyleResource('background'); if LStyleObject <> nil then begin Result := TRectangle.Create(LStyleObject); Result.StyleName := 'rect'; Result.Align := TAlignLayout.Contents; Result.HitTest := False; Result.Stroke.Kind := TBrushKind.None; Result.Fill.Color := TAlphaColorRec.Null; Result.Parent := LStyleObject; end; end else Result := TRectangle(LStyleObject); end; procedure TEditEx.InternalSetColor(const Value: TAlphaColor); var LRectangle: TRectangle; begin LRectangle := GetBackgroundRectangle; if LRectangle <> nil then begin FColor := Value; LRectangle.Fill.Color := FColor; end; end; procedure TEditEx.SetColor(const Value: TAlphaColor); begin NeedStyleLookup; ApplyStyleLookup; InternalSetColor(Value); end; A side-effect of this code is that the inner parts of the edit control can be selected in the Object Inspector, like this: Any ideas of what I've done wrong, and how to remedy it?
  7. Yesterday
  8. Mike Torrettinni

    What options do I have to control custom releases?

    This is a big change, as I've never tried it and from google search it seems quite tricky to make it work - first time.
  9. Mike Torrettinni

    What options do I have to control custom releases?

    Ok, maybe I can make it work, will think about it. One concern is on first run, when they can (or not yet) enter license details. So, until they enter license detail, at this time there is no control available based on license. I don;t force the license to be entered, so until they do, I can't control the project features.
  10. Mike Torrettinni

    How do you organize units, forms?

    Good to know I'm not the only that finds this order useful! 🙂
  11. Dave Nottage

    10.3.2 as next or waiting for 10.4?

    I'm guessing sometime close to next Wednesday: http://blog.marcocantu.com/blog/2019-july-whatsnew-1032-webinar.html
  12. Darian Miller

    10.3.2 as next or waiting for 10.4?

    Can be within days
  13. ertank

    Indy - rev.5507 compile problem

    Hello, I cannot compile latest revision of Indy using fpcupdeluxe. Below is log of errors I receive: Compiling Debug Version (1002) Target OS: Win64 for x64 (3104) Compiling indylaz.pas (3104) Compiling .\Core\IdAboutVCL.pas (3104) Compiling .\Core\IdDsnCoreResourceStrings.pas (1010) Writing Resource String Table file: IdDsnCoreResourceStrings.rsj (3104) Compiling .\System\IdGlobal.pas (3104) Compiling .\System\IdException.pas (3104) Compiling .\System\IdResourceStrings.pas (1010) Writing Resource String Table file: IdResourceStrings.rsj (3104) Compiling .\System\IdStream.pas (3104) Compiling .\System\IdStreamVCL.pas (3104) Compiling .\Core\IdAntiFreeze.pas (3104) Compiling .\System\IdAntiFreezeBase.pas (3104) Compiling .\System\IdBaseComponent.pas C:\fpcupdeluxe\ccr\indy\Lib\.\Core\IdAntiFreeze.pas(101,96) Error: (2021) ENDIF without IF(N)DEF C:\fpcupdeluxe\ccr\indy\Lib\.\Core\IdAntiFreeze.pas(103,91) Error: (2021) ENDIF without IF(N)DEF C:\fpcupdeluxe\ccr\indy\Lib\.\Core\IdAntiFreeze.pas(104,82) Error: (2021) ENDIF without IF(N)DEF C:\fpcupdeluxe\ccr\indy\Lib\.\Core\IdAntiFreeze.pas(112,83) Error: (2021) ENDIF without IF(N)DEF C:\fpcupdeluxe\ccr\indy\Lib\.\Core\IdAntiFreeze.pas(113,80) Error: (2021) ENDIF without IF(N)DEF C:\fpcupdeluxe\ccr\indy\Lib\.\Core\IdAntiFreeze.pas(114,81) Error: (2021) ENDIF without IF(N)DEF C:\fpcupdeluxe\ccr\indy\Lib\.\Core\IdAntiFreeze.pas(115,78) Error: (2021) ENDIF without IF(N)DEF C:\fpcupdeluxe\ccr\indy\Lib\.\Core\IdAntiFreeze.pas(118,91) Error: (2021) ENDIF without IF(N)DEF C:\fpcupdeluxe\ccr\indy\Lib\.\Core\IdAntiFreeze.pas(119,86) Error: (2021) ENDIF without IF(N)DEF C:\fpcupdeluxe\ccr\indy\Lib\.\Core\IdAntiFreeze.pas(121,12) Error: (2021) ENDIF without IF(N)DEF C:\fpcupdeluxe\ccr\indy\Lib\.\Core\IdAntiFreeze.pas(122,3) Fatal: (2003) Syntax error, "=" expected but ")" found Fatal: (1018) Compilation aborted Error: C:\fpcupdeluxe\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode Error: (lazarus) Compile package indylaz 10.6.2: stopped with exit code 1 Error: (lazarus) [TLazPackageGraph.CompileRequiredPackages] "Exit code 1" Error: (lazarus) Building IDE: Compile AutoInstall Packages failed. make: *** [useride] Error 2 fpcupdeluxe: ERROR: UniversalInstaller (ConfigModule: indy): Failure trying to rebuild Lazarus. Details: ERROR: Fpcupdeluxe fatal error ! I checked IdAntiFreeze.pas, but it is slightly complicated IF conditionals in there for me. I do not have a spare VM with Delphi to test if it is compiled fine with Delphi. Using stock Indy delivered with Delphi installation for now. Thanks & regards, Ertan
  14. I suspect the main reason this occurs as "smelly" is because there are so few reasons to do this kind of thing in Delphi. It's far more common in c/c++ as old-timers think it's perfectly acceptable. if you have a justifiable need to do bit-whacking like this, then I say, do it. I probably wouldn't do it for, say, a mere 5% performance gain, but 50%+ is far more justifiable. It would be nice to see some comments as to what's supposed to be going on because average Delphi coders won't make heads or tails of the code. (I personally have trouble dealing with pointers in Delphi, since I do it so seldom.) And be especially careful to point out any dependencies on assumed sizes of vars, especially integers that can vary depending on the platform. (Better yet, use explicit types that ensure fixed sizes and explain why.)
  15. David Schwartz

    SSL certificate for VCL Application Exe

    I have not encountered this before. Why is it needed? (just curious)
  16. I think it changed a few releases back and the docs haven't been updated.
  17. David Schwartz

    10.3.2 as next or waiting for 10.4?

    any guesses when 10.3.2 might be released? Don't they usually start these dog-and-pony shows within a few weeks of release?
  18. David Schwartz

    How do you organize units, forms?

    I prefer to have FormCreate, FormActivate, FormClose, FormDestroy, and related stuff at the top so I can see the main flow. One practice I've seen used in many projects is to have a static procedure at the top that's used to create the form dynamically and initialize things. Otherwise, I try to group methods that are related, so if there are several methods related to a ListView, they'll be grouped close together. Sorting alphabetically can be annoying, especially when people stick a 3-letter prefix on method names to say something about the type of control they're for.
  19. ŁukaszDe

    10.3.2 as next or waiting for 10.4?

    Webinar: What’s New in Delphi, C++Builder, and RAD Studio 10.3.2? https://community.idera.com/developer-tools/b/blog/posts/what-s-new-in-delphi-10-3-2-webinar-next-week http://s608.t.en25.com/e/es?s=608&amp;e=3212415&amp;elqTrackId=65d0dc3c5cdd4756be52277591b686f0&amp;elq=c25618b1ac194292a576b4839d8d5592&amp;elqaid=31246&amp;elqat=1 Presenters: The Embarcadero Product Management Team - Sarina DuPont, Marco Cantu, and David MillingtonSession: Wednesday, Jul 24, 2019, 8:00 AM - 9:00 AM CST Join the Embarcadero Product Management Team to discover new capabilities throughout Delphi, C++Builder, and RAD Studio designed to delight Delphi multi-device developers and C++ Windows Developers. https://register.gotowebinar.com/register/1262173778065437955
  20. Darian Miller

    What options do I have to control custom releases?

    Instead of building separate executables, I suggest building one executable and leveraging feature toggles through licensing schemes or phone-home type methods
  21. Angus Robertson

    SSL certificate for VCL Application Exe

    Never seen the icon lost, been signing files for 15 years. Are you using the latest signtool? No other EXE manglers? Angus
  22. Actually, a manual critical section is not good enough, because behind the scenes the main UI thread will periodically reach inside any TCanvas objects that are not locked via their Lock() method. A manual critical section will not prevent that, you have to use the critical section that TCanvas.Lock() uses internally.
  23. Yes, very sure. This is a very well-known issue with TBitmap's implementation. If your threads are not calling Canvas.Lock() on their TBitmap objects then your rendering code is not thread-safe, and you have just been lucky so far that it hasn't failed on you yet. For instance, if your main UI thread is not processing any messages while your threads are rendering, then the main thread's GDI garbage collection will not occur to trash your TBitmap resources. But that is not a guarantee you should rely on, unless you explicitly code for that situation, ie by blocking the main UI thread while your rendering threads are running, which is probably not what you want to do. Otherwise, don't use TBitmap in threads, use a different implementation that doesn't suffer from threading issues, such as TBitmap32 from http://www.graphics32.org. Or, simply don't manipulate TBitmap objects in worker threads. Prepare the pixel data as needed, and then sync with the main UI thread to transfer the data into TBitmap.
  24. CarloM

    SSL certificate for VCL Application Exe

    Hello Again, when I sign a .exe file... in the resulting exe icon is lost. Any idea ?
  25. Are you sure? As I said above, in AlignMix I render a TBitmap.Canvas for each layer of a map using one worker thread per layer. It's rock solid, no crashes or resource issues when rendering. Steve
  26. Thank you Peter & Remy, I wasn't aware that TCanvas was sharing resources, the D7 documentation on lock/unlock refers to use lock to prevent other threads from writing to the canvas, but since my code wasn't accessing the canvas from outside the thread, I didn't think locking was mandatory. I have now changed the code to lock all 3 canvases outside the thread loop. Sherlock: It's funny how one person's confusing syntax is exactly the opposite for another person, I hate using "not" in any boolean check because for me it's confusing with logical (bitwise) operators. John Kouraklis I'm not sure what you mean. I use "csThumbRenderer" TCriticalSection in a try/finally block to copy over the contents of TBitmaps from the main thread. I use the same critical section in the main thread as well when accessing these bitmaps, so there should be no case where the bitmaps are used concurrently by more than one thread.
  27. Dalija Prasnikar

    NTP which component to use?

    Yes, and it says TIME protocol (the one that uses port 37) is obsolete... but I want to triple check that TIdSNTP is the way to go. Works if you only need to support Europe... if not...
  28. Ok, the components works well, it is a problem of Windows Firewall, I resolved managing the unwanted session closed and reopening the connection (like FileZilla does)
  1. Load more activity
×