Recent

Author Topic: Can't place ATBinHex on form  (Read 1678 times)

domasz

  • Sr. Member
  • ****
  • Posts: 423
Can't place ATBinHex on form
« on: June 08, 2023, 09:37:29 am »
I installed ATBinHex using Online Package Manager. I installed other packages that way and they work fine.
When I try to place ATBINHex on a form I get error:
Quote
Error moving component ATBinHex1: ATBinHex

My lazarus:
Lazarus 2.2.2 (rev lazarus_2_2_2) FPC 3.2.2 x86_64-win64-win32/win64

balazsszekely

  • Guest
Re: Can't place ATBinHex on form
« Reply #1 on: June 08, 2023, 12:50:08 pm »
@domasz

Next time please do the following:

1. Build Lazarus with profile Debug IDE
2. Open package atbinhex_package.lpk, go to Compiler Option->Custom Option. Add $(IDEBuildOptions) to options, so you can debug the package
3. Open lazarus.lpi(IDE folder) then run the project, this will open another instance of Lazarus
4. Drop a TATBinHex component to the form, the first instance will break
5. Open Edit->Debug Window->Call Stack, notice that the issue originates from TATBinHex Redraw method(see attached image)
6. Redraw will call method HideScrollbars, which internally will call a ChangeBound, which will fail because no parent window is available at this moment.  A possible solution is to check if parent is nil:
Code: Pascal  [Select][+][-]
  1. procedure TATBinHex.HideScrollbars;
  2. var
  3.   si: TScrollInfo;
  4. begin
  5.   if Self.Parent = nil then //<-- add this
  6.     Exit; //and this
  7.   FillChar(si, SizeOf(si), 0);
  8.   with si do
  9.   begin
  10.     cbSize := SizeOf(si);
  11.     fMask := SIF_ALL;
  12.   end;
  13.   SetScrollInfo(Handle, SB_VERT, si, True);
  14.   SetScrollInfo(Handle, SB_HORZ, si, True);
  15. end;
7. Create a patch and report your findings to forum user AlexTP, so he can fix it on githbuh(https://github.com/Alexey-T/ATBinHex-Lazarus)
8. After the package is fixed, I can update in OPM
« Last Edit: June 08, 2023, 01:09:02 pm by GetMem »

domasz

  • Sr. Member
  • ****
  • Posts: 423
Re: Can't place ATBinHex on form
« Reply #2 on: June 09, 2023, 03:26:03 pm »
Thanks, GetMem!

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: Can't place ATBinHex on form
« Reply #3 on: June 14, 2023, 05:54:56 pm »
Applied the fix to Github.
Next time, please ping me on Github! I don't always read here.

balazsszekely

  • Guest
Re: Can't place ATBinHex on form
« Reply #4 on: June 14, 2023, 06:27:42 pm »
I also updated the OPM repository.

domasz

  • Sr. Member
  • ****
  • Posts: 423
Re: Can't place ATBinHex on form
« Reply #5 on: June 15, 2023, 08:56:31 am »
Thank you both.
I thought the problem is on my end, something in my not-so-latest Lazarus or in configuration. That's why I didn't just write to AlexTP.

 

TinyPortal © 2005-2018