[Modules] ListEx (all OS / DPI)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
ThoPie
User
User
Posts: 47
Joined: Sat Aug 22, 2009 6:49 pm

Re: [Modules] ListEx (all OS / DPI)

Post by ThoPie »

Hallo zusammen,
ich benötige bitte eure Hilfe.
Ich möchte bei einem langen ListEx-Gadget auf das letzte Element scrollen und diese Zeile markieren. Ein einfaches ListEx::SetState(ListEx::CountItems()) reicht ja nicht.
Vielen Dank für eure Hilfe.

English translation by DeepL (Kiffi)

Hello everyone,
I need your help please.
I want to scroll to the last item in a long ListEx gadget and select this row. A simple ListEx::SetState(ListEx::CountItems()) is not enough.
Thank you very much for your help.
User avatar
jacdelad
Addict
Addict
Posts: 1991
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: [Modules] ListEx (all OS / DPI)

Post by jacdelad »

Count items - 1 ? Die Zahlung beginnt doch bei 0.

Außerdem bist du hier im englischen Forum. :mrgreen:
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
matlab2
New User
New User
Posts: 4
Joined: Fri Aug 27, 2021 1:20 pm

Re: [Modules] ListEx (all OS / DPI)

Post by matlab2 »

Hello everyone,
after switching from PB6.20 to PB 6.21 I get a memory violation error when scrolling horizontally in ListEx (version from 22.6.2022).
If you start the example in the module and scroll, the memory violation occurs in line 4886.
Question: Is there already a solution?
User avatar
jacdelad
Addict
Addict
Posts: 1991
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: [Modules] ListEx (all OS / DPI)

Post by jacdelad »

Confirmed bug in 6.21: viewtopic.php?t=87121

Insert this right after "Module ListEx" in ListExModule.pbi (line 531 or such):

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_OS_Windows And #PB_Compiler_Version = 621
  Debug "FIX"
  Procedure.d _FixDrawText(x.d, y.d, Text$, FrontColor=-1, BackColor=-1)
    Protected r1.d, dx.d
    Debug "DT"
    dx = TextWidth(Text$)
    If x + dx <= 0.0
      ;Debug "No DrawText"
      Debug "NO"
      ProcedureReturn x + dx
    EndIf
    If FrontColor <> -1
      If BackColor <> -1
        r1 = DrawText(x, y, Text$, FrontColor, BackColor)
      Else
        r1 = DrawText(x, y, Text$, FrontColor)
      EndIf
    Else
      r1 = DrawText(x, y, Text$)
    EndIf
    ProcedureReturn r1
  EndProcedure
  
  Macro DrawText(x, y, Text, FrontColor=-1, BackColor=-1)
    _FixDrawText(x, y, Text, FrontColor, BackColor)
  EndMacro
CompilerEndIf
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
matlab2
New User
New User
Posts: 4
Joined: Fri Aug 27, 2021 1:20 pm

Re: [Modules] ListEx (all OS / DPI)

Post by matlab2 »

Thanks for the quick workaround!
User avatar
jacdelad
Addict
Addict
Posts: 1991
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: [Modules] ListEx (all OS / DPI)

Post by jacdelad »

All kudos go to mk-soft (see linked thread).
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Post Reply