[Modules] ListEx (all OS / DPI)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
ruslanx
User
User
Posts: 46
Joined: Mon Jun 06, 2011 8:28 am

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

Post by ruslanx »

hi, the scrolling is very unstable ...lagging
User avatar
lgb-this
User
User
Posts: 28
Joined: Sat Aug 30, 2014 9:00 pm
Location: Switzerland
Contact:

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

Post by lgb-this »

I made some tests with the release from 21.05.2020 and i have the problem with the scrollbar too. It happens with screen scaling 100% or 200% on my Win10 pc. The behaviour is very erratic.

Any chance to fix this ?

Regards Matthias
User avatar
lgb-this
User
User
Posts: 28
Joined: Sat Aug 30, 2014 9:00 pm
Location: Switzerland
Contact:

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

Post by lgb-this »

If the table is bigger than the gadget, i detected 2 problems:

Code: Select all

XIncludeFile "listexmodule.pbi"

OpenWindow(0, 50, 50, 600, 500, "Test")

#lg_test1 = 2

ListEx::Gadget(#lg_test1,10,10,500,400,"Titel 1",200)
ListEx::DisableReDraw(#lg_test1,#True) 
ListEx::AddColumn(#lg_test1,1,"Titel 2",100)
ListEx::AddColumn(#lg_test1,2,"Titel 3",300)
  
For i = 0 To 100
  ListEx::AddItem(#lg_test1,ListEx::#LastItem,"Zeile " + Str(i) + #LF$ + "Zeile " + Str(i) + #LF$ + "Zeile " + Str(i))
Next i

ListEx::DisableReDraw(#lg_test1,#False)

Repeat
  EventID = WaitWindowEvent(1) 
Until EventID = #PB_Event_CloseWindow

CloseWindow(0)
Problem 1: I can't select a line higher than row 18. Only the visible lines 1..17 can be selected with the mouse.

Problem 2: If i make a right click => the program crashes.

If i change the width of the 3rd column to "100", the program is ok and the 2 problems are gone. In this case the table is smaller than the gadget.

Any idea ?

Regards Matthias
nicoh
User
User
Posts: 26
Joined: Thu Sep 19, 2019 10:44 am

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

Post by nicoh »

Hi,

the ListEx::#EventType_Row event is not fired when navigating with up and down keys.
User avatar
doctorized
Addict
Addict
Posts: 854
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

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

Post by doctorized »

I tried the latest one from 21.05.2020 and AlternateRow color seems not to be working. All lines have the same color. Why is that?
nicoh
User
User
Posts: 26
Joined: Thu Sep 19, 2019 10:44 am

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

Post by nicoh »

I fixed 2 bugs related to DPI scaling.

The lines between "EDIT nicoh" and "EDIT nicoh end" have been changed from the last officially released version.

1. Add dpi(X) in GetColum_X()

Code: Select all

 Procedure.i GetColumn_(X.i)

    If ListEx()\ScrollBar\Item("VScroll")\Hide = #False And X >= ListEx()\ScrollBar\Item("VScroll")\X
      ProcedureReturn #NotValid
    EndIf
    
    X = DesktopUnscaledX(X)
    
    If X > ListEx()\Size\X And X < ListEx()\Size\Cols
      
      ForEach ListEx()\Cols()
        ; EDIT nicoh replaced this line:
        ; If ListEx()\Cols()\X >= X + DesktopUnscaledX(ListEx()\Col\OffsetX)
        If ListEx()\Cols()\X >= dpiX(X) + DesktopUnscaledX(ListEx()\Col\OffsetX)
        ; EDIT nicoh end
          ProcedureReturn ListIndex(ListEx()\Cols()) - 1
        EndIf
      Next
      
      ProcedureReturn ListIndex(ListEx()\Cols())
    Else
      ProcedureReturn #NotValid
    EndIf
    
  EndProcedure
2. Fix X, Y, Width, Height, State in DrawProgressBar_()

Code: Select all

Procedure   DrawProgressBar_(X.f, Y.f, Width.f, Height.f, State.i, Text.s, TextColor.i, Align.i, FontID.i)
      Define.f Factor
      Define.i pbWidth, pbHeight, textX, textY, Progress, Percent
      
      If State < ListEx()\ProgressBar\Minimum : State = ListEx()\ProgressBar\Minimum : EndIf
      If State > ListEx()\ProgressBar\Maximum : State = ListEx()\ProgressBar\Maximum : EndIf
      
      ; EDIT nicoh added the following 5 lines:
      X = DesktopUnscaledX(X)
      Y = DesktopUnscaledY(Y)
      Width = DesktopUnscaledX(Width)
      Height = DesktopUnscaledY(Height)
      State = DesktopUnscaledX(State)
      ; EDIT nicoh end
      
      pbWidth  = dpiX(Width  - 4)
      pbHeight = dpiY(Height - 4)

      [ ... ]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

Update:
  • New Scrollbars
  • New Timer for Cursor & Autoscroll
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1243
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

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

Post by Paul »

Is there something that needs to be set to make the module DPI aware?
Image Image
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

Yes, I still have to find the rest of the bugs. ;-)
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

Update:
  • New DPI management
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 636
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

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

Post by captain_skank »

Hi,

Does this module have varaible row heights ( for wordwrapping ? )

cheers
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

Update: Support for the "MarkdownModule.pbi" (#MarkDown)
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

captain_skank wrote: Fri May 13, 2022 10:21 am Does this module have varaible row heights ( for wordwrapping ? )
If the text contains #LF$, the text is output in multiple lines, if the line height is sufficient.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1243
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

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

Post by Paul »

Thorsten1867 wrote: Thu May 12, 2022 1:49 pm Update:
  • New DPI management
A little better but still not there yet ;)

You are able to select the column header half way into the next row.
And if you try to select an item from the bottom row, it selects an item 4 rows above it. The further away from the header to get the worse the selection. Seems DPI and scaling if not calculated into the row selection.

I'm guessing you're not testing with a 4K monitor?
I wasn't able to see all these DPI issues with my own software until I actually got a 4K monitor :(
Image Image
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

Update:
  • Added: Adjust row height (#AdjustRows)
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Post Reply