[Modules] ListEx (all OS / DPI)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Ajm
Enthusiast
Enthusiast
Posts: 242
Joined: Fri Apr 25, 2003 9:27 pm
Location: Kent, UK

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

Post by Ajm »

Thank you Thorsten1867.


Regards

Andy
Regards

Andy

Image
Registered PB & PureVision User
User avatar
Lord
Addict
Addict
Posts: 899
Joined: Tue May 26, 2009 2:11 pm

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

Post by Lord »

Hi!

You incorporated some gadgets (button, date, combo) in the list.
Is it also possible to include a progressbargadget in the same way?
This would be a nice enhancement. :wink:
Image
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

It should be possible, but I haven't found a sensible application for it yet.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Lord
Addict
Addict
Posts: 899
Joined: Tue May 26, 2009 2:11 pm

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

Post by Lord »

Thorsten1867 wrote:It should be possible, but I haven't found a sensible application for it yet.
Something like this (part of some type of a downloader):
Image
This is just an example. I would prefer a smaller column size.
Image
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

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

Post by zikitrake »

Thank you for this module. I think this is the first time I feel comfortable using a different grid alternative than Listicon (there are several similar examples but I don't find them so easy to use).

If possible, I would like to see two options implemented:

1) When click Right mouse button, select the row where the cursor is (As in a ListIcon Gadget)

2) fileEx::SetGadgetState(GNum.i, Row.i): Change the selected/current row (as in ListIcon Gadget too)

Again, thank you for this module and apologies for my mechanically translated English.
PB 6.21 beta, PureVision User
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

Update:
  • ListEx::SetState(GNum.i, Row.i=#PB_Default)
  • Focus on the line in which a popup menu was opened with the right mouse button.
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: 1282
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

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

Post by Paul »

Great Module, very nicely done !

Note: Crashes if you "Right Click" on column header

Code: Select all

ListEx()\Row\Current = GetRow_(Y)
If SelectElement(ListEx()\Rows(), ListEx()\Row\Current)  ;<<-- [ERROR] SelectElement(): SelectElement(): index value can not be negative
  ListEx()\Focus = #True
  ListEx()\Row\Focus = ListEx()\Row\Current
  Draw_() ; Draw Focus
EndIf
Might want to add something like...

Code: Select all

ListEx()\Row\Current = GetRow_(Y)
If ListEx()\Row\Current > -1
  If SelectElement(ListEx()\Rows(), ListEx()\Row\Current)
    ListEx()\Focus = #True
    ListEx()\Row\Focus = ListEx()\Row\Current
    Draw_() ; Draw Focus
  EndIf
EndIf
Image Image
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

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

Post by zikitrake »

Thorsten1867 wrote:Update:
  • ListEx::SetState(GNum.i, Row.i=#PB_Default)
  • Focus on the line in which a popup menu was opened with the right mouse button.
You've made the impossible in the last few decades: Make me happy on Sunday afternoon.

THANK YOU :!:
PB 6.21 beta, PureVision User
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

Paul wrote:Note: Crashes if you "Right Click" on column header
Bug fixed
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

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

Post by davido »

@Thorsten1867,
Thank you for the updates. :D
DE AA EB
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

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

Post by zikitrake »

Please, another request, if possible:

Modify ListEx::SetItemImage to works with column header?

Thank you!

PS: I'm really enjoying updating my project to ListEx :D
PB 6.21 beta, PureVision User
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

Lord wrote:Is it also possible to include a progressbargadget in the same way?
This would be a nice enhancement. :wink:
Update:
  • Support of progressbars (#ProgressBar) for ListEx::AddColumn()
  • Added: SetProgressBarAttribute() - Set mininum or maximum value for all progressbars
  • Added: SetProgressBarFlags() - Set #ShowPercent flag to additionally display the progress as a percentage number
  • Added: #Progress$ to insert the current percentage into the progressbar text
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: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

zikitrake wrote:Modify ListEx::SetItemImage to works with column header?
Update:
  • Support of images in the header (#Header)
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: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

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

Post by zikitrake »

----- Edited -----
I solved the issue: Just disabling AttachPopupMenu line and inserting a new line in the righ-click event

Code: Select all

 DisplayPopupMenu(#PopupMenu2, WindowID(#Window))
------ END EDITION ---

I don't sure if it's an error of the module or my fails (I have a great hability to generate silly errors :D )

In this code, first time you do a right-click it display the popup menu, but it ignores the event in the line

Code: Select all

If EventType() = #PB_EventType_RightClick
Then, in the following right-click, it does the event but does not detect the current line, but the line that previously had the focus.

Code: Select all

CompilerIf #PB_Compiler_IsMainFile
  #Window  = 0
  Enumeration 1
    #List
    #PopupMenu
    #MenuItem1
  EndEnumeration
  
  If OpenWindow(#Window, 0, 0, 500, 500, "Window", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
    
    If CreatePopupMenu(#PopupMenu)
      MenuItem(#MenuItem1, "Click me")
    EndIf    
    
    ListEx::Gadget(#List, 10, 10, 400, 70, "", 25, "", ListEx::#GridLines)
    
    ListEx::AddColumn(#List, 0, "header1",    125)
    
    ListEx::AddItem(#List, ListEx::#LastItem, "Randy Rhoads")
    ListEx::AddItem(#List, ListEx::#LastItem, "Ozzy Osbourne")
    
    ListEx::AttachPopupMenu(#List, #PopupMenu)
    
    Repeat
      Event = WaitWindowEvent()      
      MenuID   =EventMenu()
      GadgetID = EventGadget()
      Select Event
        Case ListEx::#Event_Gadget ; works with or without EventType()          
          If EventType() = ListEx::#EventType_Row
            ;Debug ">>> Row: " + Str(EventData()) + " on List" + Str(GadgetID)
          EndIf
        Case #PB_Event_Menu
          
        Case #PB_Event_Gadget
          Select gadgetID
            Case #List      ;{ only in use with EventType()
              If EventType() = #PB_EventType_RightClick
                curRow = ListEx::GetState(#List)
                Debug "Name Selected in #Row" + str(curRow) + ": " + ListEx::GetItemText(#List, curRow, 0)
              EndIf              
          EndSelect
      EndSelect
    Until Event = #PB_Event_CloseWindow
  EndIf
CompilerEndIf
Last edited by zikitrake on Tue Jun 11, 2019 7:42 am, edited 3 times in total.
PB 6.21 beta, PureVision User
Rinzwind
Enthusiast
Enthusiast
Posts: 679
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

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

Post by Rinzwind »

Impressive job. What's yet missing is full keyboard navigation.
Post Reply