Page 1 of 32

[Modules] ListEx (all OS / DPI)

Posted: Tue Mar 05, 2019 11:13 am
by Thorsten1867
ListEx Gadget - Module (all OS / DPI / 64Bit)
  • Gadget: #GridLines / #NoRowHeader / #NumberedColumn (= Column 0 with line numbers)
  • Support of images with/without text or for buttons
  • editable columns (Strings/CheckBoxes/ComboBoxes/DateGadgets)
  • Columns with events (Buttons / Links / Header-Click)
  • Sortable columns (String / Integer / Float / Date / Birthday / Time / Money)
  • Sorted according to German rules (encyclopedia or telephone book)
  • Sort by header click (#SortArrows / #SwitchDirection)
  • Automatically reduces the size of a defined column when the horizontal scroll bar becomes visible
  • Labels for columns for easier query
  • Data (Integer) and ID (String) can be specified for each list line
  • automatic size adjustment to window (#MoveX|#MoveY|#ResizeWidth|#ResizeHeight)
Image

Code: Select all

; ListEx::AddCells()                - adds a new row and insert text in cells with label
; ListEx::AddColumn()               - similar to 'AddGadgetColumn()'
; ListEx::AddComboBoxItems()        - add items to the comboboxes of the column (items seperated by #LF$)
; ListEx::AddItem()                 - similar to 'AddGadgetItem()'
; ListEx::CountItems()              - similar to 'CountGadgetItems()' [#Selected/#Checked/#Inbetween]
; ListEx::ChangeCountrySettings()   - change default settings
; ListEx::ClearComboBoxItems()      - clear items of the comboboxes of the column
; ListEx::ClearItems()              - similar to 'ClearGadgetItems()'
; ListEx::ClipBoard()               - copy selected items to clipboard (CSV)
; ListEx::DisableEditing()          - disable editing for the complete list
; ListEx::DisableReDraw()           - disable redraw
; ListEx::EventColumn()             - column of event (Event: ListEx::#Event_Module)
; ListEx::EventRow()                - row of event    (Event: ListEx::#Event_Module)
; ListEx::EventState()              - returns state   (e.g. CheckBox / DateGadget)
; ListEx::EventValue()              - returns value   (string)
; ListEx::EventID()                 - returns row ID or header label 
; ListEx::ExportCSV()               - export CSV-file from list
; ListEx::Gadget()                  - [#GridLines|#NumberedColumn|#NoRowHeader]
; ListEx::GetAttribute()            - similar to 'GetGadgetAttribute()'
; ListEx::GetCellText()             - similar to 'GetGadgetItemText()' with labels
; ListEx::GetCellState()            - similar to 'GetGadgetItemState()' with labels
; ListEx::GetChangedState()         - check whether entries have been edited
; ListEx::GetColumnAttribute()      - similar to 'GetGadgetItemAttribute()'
; ListEx::GetColumnFromLabel()      - returns column number for this label
; ListEx::GetColumnLabel()          - returns the label of the column
; ListEx::GetColumnState()          - similar to 'GetGadgetItemState()' for a specific column
; ListEx::GetItemData()             - similar to 'GetGadgetItemData()'
; ListEx::GetItemID()               - similar to 'GetGadgetItemData()' but with string data
; ListEx::GetItemState()            - similar to 'GetGadgetItemState()' [#Selected/#Checked/#Inbetween]
; ListEx::GetItemText()             - similar to 'GetGadgetItemText()'
; ListEx::GetRowFromLabel()         - returns row number for this label
; ListEx::GetRowLabel()             - returns the label of the row
; ListEx::GetState(GNum.i)          - similar to 'GetGadgetState()'
; ListEx::Hide()                    - similar to 'HideGadget()', but disables redrawing of the canvas gadget
; ListEx::HideColumn()              - hides a column
; ListEx::ImportCSV()               - import CSV-file to list
; ListEx::Refresh()                 - redraw gadget
; ListEx::RemoveCellFlag()          - removes a flag
; ListEx::RemoveColumn()            - similar to 'RemoveGadgetColumn()'
; ListEx::RemoveColumnFlag()        - removes a column flag
; ListEx::RemoveFlag()              - removes a gadget flag
; ListEx::RemoveItem()              - similar to 'RemoveGadgetItem()'
; ListEx::RemoveItemState()         - removes #Selected / #Checked / #Inbetween
; ListEx::ResetChangedState()       - reset to not edited
; ListEx::SelectItems()             - select all rows [#All/#None]
; ListEx::SetAttribute()            - similar to SetGadgetAttribute()  [#Padding] 
; ListEx::SetAutoResizeColumn()     - column that is reduced when the vertical scrollbar is displayed.
; ListEx::SetAutoResizeFlags()      - [#MoveX|#MoveY|#Width|#Height]
; ListEx::SetCellFlags()            - [#LockCell|#Strings|#ComboBoxes|#Dates]
; ListEx::SetCellState()            - similar to 'SetGadgetItemState()' with labels
; ListEx::SetCellText()             - similar to 'SetGadgetItemText()'  with labels
; ListEx::SetColor()                - similar to 'SetGadgetColor()'
; ListEx::SetColorTheme()           - change the color theme
; ListEx::SetColumnAttribute()      - [#Align/#ColumnWidth/#Font]
; ListEx::SetColumnFlags()          - [#FitColumn | #Left/#Right/#Center]
; ListEx::SetColumnState()          - similar to 'SetGadgetItemState()' for a specific column
; ListEx::SetCurrency()             - 
; ListEx::SetDateMask()             - similar to 'SetGadgetText()' and 'DateGadget()'
; ListEx::SetDateAttribute()        - similar to 'SetGadgetAttribute()' and 'DateGadget()'
; ListEx::SetFlags()                - set gadget flags
; ListEx::SetFont()                 - similar to 'SetGadgetFont()'
; ListEx::SetHeaderAttribute()      - [#Align]
; ListEx::SetHeaderHeight()         - set header height
; ListEx::SetHeaderSort()           - enable sort by header column [#Sort_Ascending|#Sort_Descending|#Sort_NoCase|#Sort_SwitchDirection]
; ListEx::SetItemAttribute()        - similar to 'SetGadgetItemAttribute()'
; ListEx::SetItemColor()            - similar to 'SetGadgetItemColor()'
; ListEx::SetItemData()             - similar to 'SetGadgetItemData()'
; ListEx::SetItemFont()             - change font of row or header [#Header]
; ListEx::SetItemID()               - similar to 'SetGadgetItemData()' but with string data
; ListEx::SetItemImage( )           - add a image at row/column
; ListEx::SetItemState()            - similar to 'SetGadgetItemState()' [#Selected/#Checked/#Inbetween]
; ListEx::SetItemText()             - similar to 'SetGadgetItemText()'
; ListEx::SetProgressBarAttribute() - set minimum or maximum value for progress bars
; ListEx::SetProgressBarFlags()     - set flags for progressbar (#ShowPercent)
; ListEx::SetRowsHeight()           - change height of rows
; ListEx::SetTimeMask()             - change mask for time (sorting)
; ListEx::Sort()                    - sort rows by column [#SortString|#SortNumber|#SortFloat|#SortDate|#SortBirthday|#SortTime|#SortCash / #Deutsch]
Download: ListExModule.pbi

Re: [Modules] Editable and sortable ListGadget (Beta)

Posted: Tue Mar 05, 2019 1:30 pm
by blueb
Thanks Thorsten.

I'm just in the beginning stages of coding a game that needs to maintain
a grid for player and game stats... this well laid-out List gadget will be a
welcome addition. :D

PS -No problems with Demo using Win 10 Pro (x64) and PB 5.70 (x86)

Re: [Modules] Editable and sortable ListGadget (Beta)

Posted: Tue Mar 05, 2019 5:32 pm
by Thorsten1867
Added: Resize Handle with autoresize defined column (minWidth/maxWidth)

Re: [Modules] Editable and sortable ListGadget (Beta)

Posted: Tue Mar 05, 2019 7:21 pm
by Little John
Very useful, many thanks for sharing!
Obviously, this was a lot of work.

One important information is missing in the first post here:
Source code wrote:All OS
:-)

Much appreciated.

Re: [Modules] Editable and sortable ListGadget (all OS)

Posted: Tue Mar 05, 2019 7:51 pm
by Thorsten1867
Added: Link with pop-up menu possible

Re: [Modules] Editable and sortable ListGadget (all OS)

Posted: Wed Mar 06, 2019 7:14 am
by Cyllceaux
Really nice Work. :D

But Can't use it, cause of DPI.

Image


(It's the Problem of ALL Canvas-Based Gadgets)

Re: [Modules] Editable and sortable ListGadget (all OS)

Posted: Wed Mar 06, 2019 9:43 am
by srod
Cyllceaux wrote:...It's the Problem of ALL Canvas-Based Gadgets
I don't see that at all. Fonts are automatically scaled so it is just a case of using the current DPI scale factor alongside the available text metric functions to lay out the content appropriately. Aside from a lack of support for per-monitor DPI awareness, there are no real issues with the canvas gadget aside from having to put in a little more effort as PB cannot possibly scale all the content automatically. I have a substantial cross-platform grid control in development and it is behaving itself fine with regards DPI, although PB support for DPI awareness is somewhat limited right now.

@Thorsten : there seems to be massive flicker when dragging a horizontal scrollbar after I resize things to make the scrollbars visible. The client area seems to 'jump' about a bit. If you are editing a cell and move the vertical scrollbar, the string gadget can get left behind. Also, the various child controls occasionally overlay the scrollbars. All 'classic' problems when embedding child controls in a grid control - I should know as I had to contend with all of these problems with my original EsGRID control! :) Win 7x64, PB 5.70.

Re: [Modules] Editable and sortable ListGadget (all OS)

Posted: Wed Mar 06, 2019 3:11 pm
by Kwai chang caine
Really usefull gadget missing in PB :shock:
Thanks a lot for sharing 8)

Do you think it's possible to use it a day, like VirtualListIcon for load very quickly thousand of lines ?
viewtopic.php?p=513256#p513256
The first problem surely is lost the "all OS" side :|

Code: Select all

IncludeFile "ListExModule.pbi"

#Window  = 0

Enumeration 1
 #List
EndEnumeration

If OpenWindow(#Window, 0, 0, 500, 250, "Window", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
 
 HeureDebut = ElapsedMilliseconds() 
 ListEx::Gadget(#List, 10, 10, 400, 230, "", 25, "", ListEx::#GridLines|ListEx::#NumberedColumn) ; ListEx::#NoRowHeader|ListEx::#NumberedColumn|ListEx::#CheckBoxes
 
 ListEx::AddColumn(#List, ListEx::#LastItem, "Lines",    275)
 ListEx::SetHeaderAttribute(#List, ListEx::#Align, ListEx::#Center)
 
 For i = 1 To 1000
  ListEx::AddItem(#List, ListEx::#LastItem, #LF$ + "Line number " + Trim(Str(i)))
 Next 
 
 ListEx::SetRowsHeight(#List, 22)
 TempPasser$ = StrF((ElapsedMilliseconds() - HeureDebut) / 1000) + " secondes"
 MessageRequester("Time elapsed",  TempPasser$)
  
 Repeat
  Event = WaitWindowEvent()
 Until Event = #PB_Event_CloseWindow
  
EndIf

Re: [Modules] Editable and sortable ListGadget (all OS)

Posted: Wed Mar 06, 2019 6:10 pm
by Thorsten1867
  • Bugfixes
  • new flag: #SingleClickEdit

Re: [Modules] Editable and sortable ListGadget (all OS)

Posted: Wed Mar 06, 2019 6:12 pm
by Thorsten1867
Kwai chang caine wrote:Do you think it's possible to use it a day, like VirtualListIcon for load very quickly thousand of lines ?
viewtopic.php?p=513256#p513256
The first problem surely is lost the "all OS" side :|
The reason for developing the module was that I needed a cross-platform solution.

Re: [Modules] Editable and sortable ListGadget (all OS)

Posted: Wed Mar 06, 2019 6:46 pm
by Cyllceaux
srod wrote:
Cyllceaux wrote:...It's the Problem of ALL Canvas-Based Gadgets
I don't see that at all. Fonts are automatically scaled so it is just a case of using the current DPI scale factor alongside the available text metric functions to lay out the content appropriately. Aside from a lack of support for per-monitor DPI awareness, there are no real issues with the canvas gadget aside from having to put in a little more effort as PB cannot possibly scale all the content automatically. I have a substantial cross-platform grid control in development and it is behaving itself fine with regards DPI, although PB support for DPI awareness is somewhat limited right now.
I don't say it is a bug of Canvas... It is a Problem of Canvas-Based Gadgets.

If I multiply the inner-width with 1.5 (I use a Surface with a 150% dpi scale), than the gadget looks right. Simple problem, simple solution. :wink: :D

Re: [Modules] Editable and sortable ListGadget (all OS)

Posted: Wed Mar 06, 2019 8:09 pm
by Thorsten1867
  • nasty bug fixed
  • added support for 'Tab' & 'Shift-Tab' in editable fields

Re: [Modules] Editable and sortable ListGadget (all OS)

Posted: Wed Mar 06, 2019 11:22 pm
by Andre
Very good work, and an impressive function-list... and cross-platform, thank you very much for sharing! :D

I still need to test it on MacOS... But on Win10 it works fine here, with one exception: there seems to a canvas drawing error, see the screenshot here: https://cdn1.imggmi.com/uploads/2019/3/ ... 7-full.jpg

Do you plan to make it working in Dialogs (with automatic resizing) too?
If not, it shouldn't be a big problem to use the List (canvas-gadget) as child of an (automatically) resizing container gadget, and react on the resize events... ;)

Re: [Modules] Editable and sortable ListGadget (all OS)

Posted: Thu Mar 07, 2019 8:19 am
by infratec
Just tested your module: ThumpUp !!!

Then I took a look to avoid the json color files and found,
that in SetColor are some attributes missing.

HeaderFront.i
HeaderBack.i
HeaderGrid.i
ScrollBar.i

They are not inside. Please add these too.

Bernd

Re: [Modules] Editable and sortable ListGadget (all OS)

Posted: Thu Mar 07, 2019 9:22 am
by srod
Still problems with horizontal scrolling. Problems also with combo cells. I am finding that when I edit one and then select another cell, the combo contents often disappear. Cannot reproduce this 100% consistently, though the following seems to do it most often : select the first combo cell and change contents to 'female'. Select another cell. Now double click the first combo cell again, do not change its contents and then double click another cell. The contents of the combo cell seem to be wiped.