[Modules] ListEx (all OS / DPI)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
doctorized
Addict
Addict
Posts: 856
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

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

Post by doctorized »

Thank you for the tip.
Two questions :
1) What should I do for the vertical cell editing?
2) How can I get header names?
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: Tabulator jumps to the next/previous row, if it is the last/first cell
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 »

doctorized wrote:2) How can I get header names?

Code: Select all

ListEx::GetItemText(#List, ListEx::#Header, Column)
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
doctorized
Addict
Addict
Posts: 856
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

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

Post by doctorized »

Is there a way to resize every column to fit its content (taking in mind both header and rows)?
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 »

doctorized wrote:Is there a way to resize every column to fit its content (taking in mind both header and rows)?
Use Flag #FitColumn for AddColumn()

Gesendet von meinem Aquaris X2 mit Tapatalk
Last edited by Thorsten1867 on Sat Aug 03, 2019 4:16 pm, edited 1 time in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
doctorized
Addict
Addict
Posts: 856
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

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

Post by doctorized »

If you check this image: http://users.sch.gr/arahiotis/other/ListEx.png, you will see that colors are not drawn corectly. Also, the last column (and maybe all of them) has a width a little smaller than it should. My code to create it is this:

Code: Select all

cols.a = ListEx::GetAttribute(#adv_lst_students,ListEx::#ColumnCount)
For i = 1 To cols
	ListEx::RemoveColumn(#adv_lst_students,0)
Next
txt$ = LCase(GetGadgetText(#adv_edtr))
If FindString(txt$,"select")
	CheckDatabaseQuery(#db, txt$)
Else
	CheckDatabaseUpdate(#db, txt$)
EndIf
txt$ = ""
cols = DatabaseColumns(#db) - 1
For ii = 0 To cols
	ListEx::AddColumn(#adv_lst_students,ii,DatabaseColumnName(#db,ii),80,"",ListEx::#FitColumn)
Next
While NextDatabaseRow(#db)
	For ii = 0 To cols
		txt$ + GetDatabaseString(#db, ii) + #LF$ 
	Next
	ListEx::AddItem(#adv_lst_students,-1,txt$) 
	txt$ = ""
Wend
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: attribute '#Padding' for SetAttribute() to change padding if you use #FitColumn
  • Bugfixes

Code: Select all

ListEx::SetAttribute(#List, ListEx::#Padding, 5)
@doctorized
Please try it again.
Last edited by Thorsten1867 on Sun Nov 17, 2019 1:35 pm, edited 1 time in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
doctorized
Addict
Addict
Posts: 856
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

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

Post by doctorized »

Thanks for the update but how and where should I use this attribute? If I use it right after creating the gadget, then if value is, for example 50, then columns have a larger same width than they should have. If I use it after the code I posted, nothing happens. The code:

Code: Select all

ListEx::SetAttribute(#adv_lst_students, ListEx::#Padding, 50)
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 »

Padding is the minimum distance between the line and the text.

Gesendet von meinem Aquaris X2 mit Tapatalk
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
doctorized
Addict
Addict
Posts: 856
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

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

Post by doctorized »

Thorsten1867 wrote:Padding is the minimum distance between the line and the text.

Gesendet von meinem Aquaris X2 mit Tapatalk
Yes, I know that. I thought that it fixed the color issue with some way. The colors are now as in the image: http://users.sch.gr/arahiotis/other/List2.png
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: #FitColumn
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
doctorized
Addict
Addict
Posts: 856
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

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

Post by doctorized »

Danke!
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:
  • Changed: SetItemImage() => ImageID -> Image
  • Added: Cursor keys / PageUp & PageDown / Strg + Pos1 & Strg + End

Code: Select all

ListEx::SetItemImage(#List.i, 3, 2, 16, 16, #Image, ListEx::#Center)
Last edited by Thorsten1867 on Sun Nov 17, 2019 1:37 pm, edited 1 time in total.
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:
  • Added: SelectItems()
  • Added: GetRowFromLabel()
  • Bugfixes

Code: Select all

ListEx::SelectItems(#List, ListEx::#All)
ListEx::SelectItems(#List, ListEx::#None)

Row.i = ListEx::GetRowFromLabel(#List, "Item 2")
Last edited by Thorsten1867 on Sun Nov 17, 2019 1:41 pm, edited 1 time in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

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

Post by zikitrake »

Good morning! And thank you for updates :D

There seems to be a small bug with the mouse scroll button when resizing the gadget.

With the vertical bar activated everything works correctly, but when resizing the gadget, this bar disappears (as it should be) but the scroll button of the mouse continues scrolling the list (although it already appears full on the screen).

Image
Post Reply