[Modules] ListEx (all OS / DPI)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
PB_Rainer
User
User
Posts: 80
Joined: Fri Jun 07, 2019 1:56 pm

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

Post by PB_Rainer »

Thorsten1867 wrote:I tested it again and uploaded it.
Hi Thorsten,

WELL DONE, thanks a lot.

Rainer
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

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

Post by davido »

@Thorsten1867,

I have found what appears to be a bug in version 20033101.
I have been able to reproduce the bug in the demo code you supply with the ListEx:

If you change the width of the column from 60 to 80 in line 10292 and then 'run' - two problems appear:

As expected a horizontal scroll-bar is drawn.
1. This scroll-bar partially hides row 10
2. Rows 9 and 10 no longer respond to left-clicks to highlight the clicked row or events.
DE AA EB
User avatar
mrv2k
User
User
Posts: 51
Joined: Fri Jan 20, 2012 3:40 pm
Location: SE England
Contact:

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

Post by mrv2k »

Hi Thorsten

Thanks for all the updates. The gadget is almost perfect.

Any chance that you can get the gadget to automaticlly scroll if you are using the keyboard and you reach the bottom row of the screen? The standard gadget does this.

Paul
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 »

The cursor keys work for me?!?
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
mrv2k
User
User
Posts: 51
Joined: Fri Jan 20, 2012 3:40 pm
Location: SE England
Contact:

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

Post by mrv2k »

Strange... Must have had an old version. Downloaded again and it works fine.

Thanks for the answer though.

Keep up the good work!
tester
User
User
Posts: 30
Joined: Sun Dec 28, 2014 1:12 pm

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

Post by tester »

Hi Thorsten.
Thanks for the powerful gadget.

SetItemColor for the "test" column number 5 does not work, but it does if you select column number 6.
User avatar
mrv2k
User
User
Posts: 51
Joined: Fri Jan 20, 2012 3:40 pm
Location: SE England
Contact:

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

Post by mrv2k »

Hi Thorsten

Any chance of adding an minimum size to the scrollbar slider as i gets really small when showing a long list...

https://imgur.com/eXNPIkU

Thanks

Paul
User avatar
mrv2k
User
User
Posts: 51
Joined: Fri Jan 20, 2012 3:40 pm
Location: SE England
Contact:

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

Post by mrv2k »

Fixed it!

Changed...

Code: Select all

If ListEx()\ScrollBar\Item()\Thumb\Size < dpiY(6) : ListEx()\ScrollBar\Item()\Thumb\Size = dpiY(6) : EndIf
to

Code: Select all

If ListEx()\ScrollBar\Item()\Thumb\Size < dpiY(20) : ListEx()\ScrollBar\Item()\Thumb\Size = dpiY(20) : EndIf
in the procedure CalcScrollBarThumb_

Regards

Paul
User avatar
mrv2k
User
User
Posts: 51
Joined: Fri Jan 20, 2012 3:40 pm
Location: SE England
Contact:

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

Post by mrv2k »

I'm trying to use the ListEx gadget in a splitter gadget. If I run this code, there seems to be a problem with the auto resize. Am I doing something wrong?

Code: Select all

IncludeFile "ListEx\ListExModule.pbi"
IncludeFile "TreeEx\TreeExModule.pbi"

OpenWindow(0,0,0,1280,720,"Test",#PB_Window_ScreenCentered!#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget)
TreeEx::Gadget(1,0,0,0,0,"Tree",TreeEx::#AutoResize, 0)
ListEx::Gadget(2,0,0,0,0,"Test 1",1,"",ListEx::#GridLines|ListEx::#AutoResize, 0)
SplitterGadget(3,0,0,WindowWidth(0),WindowHeight(0)-MenuHeight(),1,2,#PB_Splitter_Vertical|#PB_Splitter_Separator)
SetGadgetAttribute(3,#PB_Splitter_FirstMinimumSize,250)  
SetGadgetState(3,250)
ListEx::SetAutoResizeFlags(2, ListEx::#Height|ListEx::#Width)
ListEx::SetColumnAttribute(2,0,ListEx::#ColumnWidth,600)
ListEx::AddColumn(2,1,"Test 2",260)
ListEx::AddColumn(2,2,"Test 3",82)
ListEx::SetHeaderAttribute(2, ListEx::#Align, ListEx::#Center,2)
ListEx::SetColumnAttribute(2, 2, ListEx::#Align, ListEx::#Center)

ListEx::DisableRedraw(2,#True)

For i=1  To 1000
  ListEx::AddItem(2,ListEx::#LastItem,"Column 1" + #LF$ + "Column 2" + #LF$ + "Column 3")
Next

ListEx::DisableRedraw(2,#False)

Repeat
  
  event=WaitWindowEvent()
        
Until event=#PB_Event_CloseWindow
Regards

Paul
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:
  • Attribut '#ParentGadget' for resizing (e.g. ContainerGadget)
  • Attribut '#MinimumSize' for minimum size of scrollbar thumb
@mrv2k
Please try!
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 »

Changed
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
mrv2k
User
User
Posts: 51
Joined: Fri Jan 20, 2012 3:40 pm
Location: SE England
Contact:

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

Post by mrv2k »

I think its a DPI issue. My display is normally set to 125% scaling. If I turn scaling to 100%, the header and column problems go away.

If I run this code at 100% scaling, the gadgets are perfect.

Code: Select all

IncludeFile "ListEx\ListExModule.pbi"
IncludeFile "TreeEx\TreeExModule.pbi"

OpenWindow(0,0,0,1280,920,"Test",#PB_Window_ScreenCentered!#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget)
TreeEx::Gadget(1,0,0,0,0,"Tree",TreeEx::#AutoResize, 0)
ListEx::Gadget(2,0,0,0,0,"Test 1",1,"",ListEx::#GridLines|ListEx::#AutoResize, 0)
SplitterGadget(3,0,0,WindowWidth(0),WindowHeight(0)-MenuHeight()-200,1,2,#PB_Splitter_Vertical|#PB_Splitter_Separator)
SetGadgetAttribute(3,#PB_Splitter_FirstMinimumSize,250)
SetGadgetState(3,250)

ListEx::SetAutoResizeFlags(2, ListEx::#Height|ListEx::#Width)
ListEx::SetAttribute(2,ListEx::#ParentGadget, 3)
ListEx::SetAttribute(2,ListEx::#MinimumSize, 20)
ListEx::SetAutoResizeColumn(2,1)
ListEx::SetColumnAttribute(2,0,ListEx::#ColumnWidth,GadgetWidth(3)-257-342) ; 257 =250+7 For Splitter | 342 = 260+82 For Columns
ListEx::AddColumn(2,1,"Test 2",260)
ListEx::AddColumn(2,2,"Test 3",82)


ListEx::Gadget(4,0,WindowHeight(0)-205,WindowWidth(0),180,"Test 1",WindowWidth(0)-342,"",ListEx::#GridLines|ListEx::#AutoResize, 0)
ListEx::SetAutoResizeFlags(4, ListEx::#Height|ListEx::#Width)  
ListEx::SetAutoResizeColumn(4,1)
ListEx::SetAttribute(4,ListEx::#MinimumSize, 20)
ListEx::AddColumn(4,1,"Test 2",260)
ListEx::AddColumn(4,2,"Test 3",82)

ListEx::DisableRedraw(2,#True)
ListEx::DisableRedraw(4,#True)

For i=1  To 10000
  ListEx::AddItem(2,ListEx::#LastItem,"Column 1" + #LF$ + "Column 2" + #LF$ + "Column 3")
  ListEx::AddItem(4,ListEx::#LastItem,"Column 1" + #LF$ + "Column 2" + #LF$ + "Column 3")
Next

ListEx::DisableRedraw(2,#False)
ListEx::DisableRedraw(4,#False)

Repeat
  
  event=WaitWindowEvent()
        
Until event=#PB_Event_CloseWindow
If I set it to anything over 100%, the header bar becomes extended and the columns sizes break. It also breaks SetAutoResizeColumn.

I can probably get around the splittergadget problem by intercepting the resize event and doing a bit of math to calculate the first column width. The #ParentGadget is great, but splitter gadgets are dynamic and you would need to know the dimensions of which ever side the ListEx is in. This might be possible by getting the ListEx GadgetWidth() after the splitter is drawn as it automatically resizes each gadget.

#MinimumSize - Works Great!

Thanks for all you help!

Paul

P.S. Theres a typo on line 7491. It reads...

Code: Select all

If ListEx()\ParentNum <> #PB_Default
It should be

Code: Select all

If ListEx()\Parent\Num <> #PB_Default
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 »

Bugfixes (DPI)
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
mrv2k
User
User
Posts: 51
Joined: Fri Jan 20, 2012 3:40 pm
Location: SE England
Contact:

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

Post by mrv2k »

Thanks Thorsten!

Works absolutely perfectly now!

Only had to comment out a debug.

Great Work!

Regards

Paul
User avatar
mrv2k
User
User
Posts: 51
Joined: Fri Jan 20, 2012 3:40 pm
Location: SE England
Contact:

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

Post by mrv2k »

Sorry Me Again!

Looks like something broke on the scroll bars with the new update. The scrollbar button scrolls at a different speed to the mouse. It does it on the example if you add a few more lines. I checked on different DPI's and it's not related.

Regards

Paul
Post Reply