Jump to content

Vandrovnik

Members
  • Content Count

    583
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Vandrovnik

  1. Vandrovnik

    Alternative for RDP solution

    What about clients connected directly to central database server through a VPN?
  2. Hello, I tried to define a conditional symbol in .dpr file (before "uses"). Well, I can define it: {$DEFINE Test} but later in units, this symbol seems to be undefined. {$IFDEF Test} xx; // causes compiler error in .dpr, but is ignored in units. {$ENDIF} Is that by design (and why?!), or is that a bug? From help (The symbol is recognized for the remainder of the compilation of the current module in which the symbol is declared), I am not sure what they mean by a module: a unit, or a dll/exe? I defined the symbol in Project, Options, but still would like to know why it is not possible to define it in .dpr.
  3. Vandrovnik

    Recommendation on VCL development on 4k monitor

    You can try running Delphi in DPI-unaware mode. It's blurry, but from what I've tested, it's the least problematic.
  4. Vandrovnik

    tJPEGImage - set image resolution (dpi)

    Hello, I would like to set the resolution of tJPEGImage, such as 300 dpi. Is it possible, or the only way is to save jpg and then directly overwrite corresponding bytes in the file/stream?
  5. Vandrovnik

    tJPEGImage - set image resolution (dpi)

    I have found no official way, but created this, which seems to work (after calling JPEGNeeded): type tJpegImageClassHelper = class helper for tJpegImage public procedure SetResolution(aDpiX, aDpiY: word); end; tJpegDataClassHelper = class helper for tJpegData public procedure SetResolution(aDpiX, aDpiY: word); end; procedure tJpegImageClassHelper.SetResolution(aDpiX, aDpiY: word); begin with self do if fImage<>nil then fImage.SetResolution(aDpiX, aDpiY); end; procedure tJpegDataClassHelper.SetResolution(aDpiX, aDpiY: word); type tJpegApp0Rec = packed record // 18 B including the marker; starts on position 2 in the file APP0Marker: word; // 2, FF E0 Length: word; // 2, Length of segment excluding APP0 marker Identifier: array[1..5] of AnsiChar; // 5, 4A 46 49 46 00 = 'JFIF' in ASCII, terminated by a null byte JFIFVersion: word; // 2, First byte for major version, second byte for minor version (01 02 for 1.02) DensityUnits: byte; // 1, Units for the following pixel density fields; 00 : No units, 01 : Pixels per inch (2.54 cm), 02 : Pixels per centimeter XDensity: word; // 2, Horizontal pixel density. Must not be zero YDensity: word; // 2, Vertical pixel density. Must not be zero XThumbnail: byte; // 1, Horizontal pixel count of the following embedded RGB thumbnail. May be zero YThumbnail: byte; // 1, Vertical pixel count of the following embedded RGB thumbnail. May be zero // ThumbnailData... // 3 × n, Uncompressed 24 bit RGB (8 bits per color channel) raster thumbnail data in the order R0, G0, B0, ... Rn-1, Gn-1, Bn-1; with n = Xthumbnail × Ythumbnail end; pJpegApp0Rec = ^tJpegApp0Rec; var App0: pJpegApp0Rec; function Swap(Value: word): word; begin result := (Value shr 8) or ((Value and $FF) shl 8); end; begin with self do begin if fData = nil then exit; if fData.Size < 20 then exit; App0:=pointer(NativeUInt(fData.Memory) + 2); if App0^.Identifier = 'JFIF'#0 then begin App0^.DensityUnits := 1; App0^.XDensity := Swap(aDpiX); App0^.YDensity := Swap(aDpiY); end; end; end;
  6. Vandrovnik

    High-dpi scaling problems with TFrame

    For me, the only way to handle all HDPI related problems and bugs, is to use Delphi in DPI-unaware mode and keep all designed forms and frames at 96 dpi. On runtime they scale fine. Even then Delphi IDE 12.3 on monitor set to 150 % sometimes shows hint too small and moved to top left corner of the screen...
  7. Hello, Please is it possible to have memory manager in Delphi 12.3 to call my routine when it is unable to allocate new block of memory? My routine would release some memory (cache of bitmaps) and memory manager should try again, without raising an exception. Or is there another way of creating a cache as big as possible, but without limiting "normal" operation of the application?
  8. Vandrovnik

    Need a cheap tablet. Recommend?

    You can also use remote lab: https://developer.samsung.com/remote-test-lab
  9. Vandrovnik

    OtlParallel Memory Leak

    Assigning to one string variable from multiple threads at same time is not a good idea...
  10. We had the same problem (Windows XP as virtual machines). Did not succeed finding a solution in Delphi app, so virtual machines upgraded to Windows 7...
  11. Vandrovnik

    Firebird database on Android

    {$IFDEF ANDROID} function SetEnvironmentVariable(Name:string; Value:string): boolean; begin result:=false; //assume failure if Value='' then begin // Assume user wants to remove variable. if unsetenv(MarshaledAstring(UTF8String(Name)))=0 then result:=true; end else begin // Non empty so set the variable if setenv(MarshaledAstring(UTF8String(Name)), MarshaledAstring(UTF8String(Value)), 1)=0 then result:=true; end; end;
  12. Hello, I have a DrawGrid, on some columns user can click to switch between values (enable / disable them). Is it possible to allow OnDblClick on some columns, while not allowing OnDblClick on these columns with "switches"? OnDblClick is used to open modal dialog to change some values. Thank you, kind regards, Karel
  13. Vandrovnik

    tDrawGrid - how to prevent OnDblClick on certain columns

    Thank you for your reply. I did not write, that in this grid, RowSelet is set, so in OnDblClick I get Col=0. So instead I used: var Cell: TGridCoord; Pt: tPoint; begin fSkipDrag:=true; Pt:=Mouse.CursorPos; Pt:=Grid.ScreenToClient(Pt); Cell:=Grid.MouseCoord(Pt.x, Pt.y); if (Cell.X<1) or (Cell.X>3) then ... It is not perfect - if computer is really busy / slow, mouse may move before OnDblClick is run.
  14. Vandrovnik

    Recommended devices android testing

    Samsung offers a remote testing lab: https://developer.samsung.com/remote-test-lab
  15. I did not make speed tests, the speed will probably be almost the same, because of large file cache and fast NVME drives.
  16. Why? I use RAM drive as target for all .dcu files. After reboot, no .dcus exists -> no problems from old .dcus, .dcus compiled with another settings etc. And it also saves some SSD writes. (With HDDs, RAM drive was also significantly faster.)
  17. Vandrovnik

    Continually Losing Frames

    It did not happen to me in 12.2 (yet). In older versions, i just replaced <DesignClass>TFrame</DesignClass> with <FormType>dfm</FormType><DesignClass>TFrame</DesignClass> in .dproj file. T thought it was happening mostly after Delphi upgrade.
  18. Vandrovnik

    Printing to evolis printer

    Does it have Windows printer driver? If it does, you can probably print on it the same way you can print on common printers (for example, using Fastreport in Delphi).
  19. Vandrovnik

    Delphi 12.2 Toolbars strange behavior

    My futile fight with toolbars in Delphi started with Delphi X?? and continues to this day. But I found a solution: I turned off all toolbars and left only the palette on top 🙂(To be honest, I did not try to enable any of toolbars in Delphi 12.2, so I am not sure that problems persist.)
  20. foo(GetDouble) is expected error - you cannot pass function result to a procedure with var parameter.
  21. Vandrovnik

    Wrap texts in DBGrid

    You can draw whatever you want in OnDrawColumnCell but AFAIK, all rows must have the same height.
  22. I just did not test, whether it works O:-)
  23. Yes, it does (Delphi 12.2).
  24. What about a class procedure? type tTest = class(tObject) public class procedure MyFormShow(Sender: TObject); end; ... self.OnShow:=tTest.MyFormShow;
×