[Modules] ListEx (all OS / DPI)
Re: [Modules] ListEx (all OS / DPI)
@Thorsten1867,
When a row is clicked, that row is highlighted in light blue colour.
Is it possible to change this colour?
When a row is clicked, that row is highlighted in light blue colour.
Is it possible to change this colour?
DE AA EB
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Re: [Modules] ListEx (all OS / DPI)
You can change almost all colors and then save your own theme:davido wrote:@Thorsten1867,
When a row is clicked, that row is highlighted in light blue colour.
Is it possible to change this colour?
Code: Select all
SetColor(#List, #FocusColor, Color)
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Re: [Modules] ListEx (all OS / DPI)
@Thorsten1867,
Thank you, very much for your help. Excellent.
It always looks easy when one is shown how.
Thank you, very much for your help. Excellent.
It always looks easy when one is shown how.
DE AA EB
Re: [Modules] ListEx (all OS / DPI)
1. When using ListEx::AddItem() to add a large number of items, then clear with ListEx::ClearItems()
When you add a small number of items again, various problems occur: the items disappear, and the scrollbars are in the wrong position.
2. The scroll bar position is not updated to the correct position when using ListEx::DisableReDraw()
In addition to the support for HIDPI, there is a slight deviation in the position of the edit box, which is the cause of purebasic itself, and Fred seems unwilling to fix it:
viewtopic.php?f=4&t=71879
When you add a small number of items again, various problems occur: the items disappear, and the scrollbars are in the wrong position.
2. The scroll bar position is not updated to the correct position when using ListEx::DisableReDraw()
In addition to the support for HIDPI, there is a slight deviation in the position of the edit box, which is the cause of purebasic itself, and Fred seems unwilling to fix it:
viewtopic.php?f=4&t=71879
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Re: [Modules] ListEx (all OS / DPI)
Please try:
Does it work then?
Code: Select all
Procedure ClearItems(GNum.i)
If FindMapElement(ListEx(), Str(GNum))
ClearList(ListEx()\Rows())
Draw_()
EndIf
EndProcedure
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Re: [Modules] ListEx (all OS / DPI)
Can't solve the problemThorsten1867 wrote:Please try:
Does it work then?Code: Select all
Procedure ClearItems(GNum.i) If FindMapElement(ListEx(), Str(GNum)) ClearList(ListEx()\Rows()) Draw_() EndIf EndProcedure
The problem may be that ListEx()\Row\Number, ListEx()\VScroll, ListEx()\HScroll, ClearItems haven't been updated since I tried
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Re: [Modules] ListEx (all OS / DPI)
Second try:
Code: Select all
Procedure ClearItems(GNum.i)
If FindMapElement(ListEx(), Str(GNum))
ClearList(ListEx()\Rows())
ListEx()\Row\Number = 0
UpdateRowY_()
AdjustScrollBars_()
Draw_()
EndIf
EndProcedure
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Re: [Modules] ListEx (all OS / DPI)
It can't solve the problem.Thorsten1867 wrote:Second try:
Code: Select all
Procedure ClearItems(GNum.i) If FindMapElement(ListEx(), Str(GNum)) ClearList(ListEx()\Rows()) ListEx()\Row\Number = 0 UpdateRowY_() AdjustScrollBars_() Draw_() EndIf EndProcedure
Only in this way can we solve the problem:
Code: Select all
Procedure ClearItems(GNum.i)
If FindMapElement(ListEx(), Str(GNum))
ClearList(ListEx()\Rows())
ListEx()\Row\Number = 0
UpdateRowY_()
SetGadgetAttribute(ListEx()\VScrollNum, #PB_ScrollBar_Minimum, 0)
SetGadgetAttribute(ListEx()\VScrollNum, #PB_ScrollBar_Maximum, 0)
SetGadgetAttribute(ListEx()\VScrollNum, #PB_ScrollBar_PageLength, 0)
Draw_()
EndIf
EndProcedure
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Re: [Modules] ListEx (all OS / DPI)
Bugfixes
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Re: [Modules] ListEx (all OS / DPI)
Hi Thorsten,
2 Problems:
1. If you do some right clicks inside the gadget an error with 'negative index not allwed' appears in _RightClickHandler()
2. Menu problem
is it possible that already a popup menu (0) is available, even if I not define one with ListEx::AttachPopupMenu() ?
Because if already a menue with id 0 is defined, something opens by right click on an item in your gadget.
If you move the mouse above you see the menu of the window.
A bugfix is to add:
Like
2 Problems:
1. If you do some right clicks inside the gadget an error with 'negative index not allwed' appears in _RightClickHandler()
Code: Select all
IncludeFile "../pbi/ListExModule.pbi"
OpenWindow(0, 100, 100, 300, 120, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListEx::Gadget(0, 5, 5, 290, 90, "Test", 50, "", ListEx::#GridLines, 0)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
is it possible that already a popup menu (0) is available, even if I not define one with ListEx::AttachPopupMenu() ?
Because if already a menue with id 0 is defined, something opens by right click on an item in your gadget.
If you move the mouse above you see the menu of the window.
Code: Select all
IncludeFile "../pbi/ListExModule.pbi"
OpenWindow(0, 100, 100, 300, 120, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CreateMenu(0, WindowID(0))
MenuTitle("Test")
MenuItem(0, "Item")
ListEx::Gadget(0, 5, 5, 290, 90, "Test", 50, "", ListEx::#GridLines, 0)
ListEx::AddItem(0, ListEx::#LastItem, "Amelia")
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Code: Select all
ListEx::AttachPopupMenu(0, -1)
Code: Select all
IncludeFile "../pbi/ListExModule.pbi"
OpenWindow(0, 100, 100, 300, 120, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CreateMenu(0, WindowID(0))
MenuTitle("Test")
MenuItem(0, "Item")
ListEx::Gadget(0, 5, 5, 290, 90, "Test", 50, "", ListEx::#GridLines, 0)
ListEx::AddItem(0, ListEx::#LastItem, "Amelia")
ListEx::AttachPopupMenu(0, -1)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Re: [Modules] ListEx (all OS / DPI)
Bugfixes
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Re: [Modules] ListEx (all OS / DPI)
Hi Thorsten,
next bug to fix:
If you select one item, you get 0 as result.
If you select more than one the result is Ok.
next bug to fix:
Code: Select all
IncludeFile "../pbi/ListExModule.pbi"
OpenWindow(0, 100, 100, 300, 120, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListEx::Gadget(0, 5, 5, 290, 90, "Test", 50, "", ListEx::#GridLines|ListEx::#MultiSelect, 0)
ListEx::AddItem(0, ListEx::#LastItem, "Line 1")
ListEx::AddItem(0, ListEx::#LastItem, "Line 2")
ListEx::AddItem(0, ListEx::#LastItem, "Line 3")
ListEx::AddItem(0, ListEx::#LastItem, "Line 4")
ListEx::AddItem(0, ListEx::#LastItem, "Line 5")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Select EventType()
Case #PB_EventType_LeftClick
Debug ListEx::CountItems(0, ListEx::#Selected)
EndSelect
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
If you select more than one the result is Ok.
Last edited by infratec on Tue Sep 17, 2019 9:40 am, edited 1 time in total.
Re: [Modules] ListEx (all OS / DPI)
Hi,
next one:
If you select more than one entry, the alternate color of all lines disappears.
next one:
Code: Select all
IncludeFile "../pbi/ListExModule.pbi"
OpenWindow(0, 100, 100, 300, 220, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListEx::Gadget(0, 5, 5, 290, 190, "Test", 50, "", ListEx::#GridLines|ListEx::#MultiSelect, 0)
ListEx::AddItem(0, ListEx::#LastItem, "Line 1")
ListEx::AddItem(0, ListEx::#LastItem, "Line 2")
ListEx::AddItem(0, ListEx::#LastItem, "Line 3")
ListEx::AddItem(0, ListEx::#LastItem, "Line 4")
ListEx::AddItem(0, ListEx::#LastItem, "Line 5")
ListEx::SetColor(0, ListEx::#AlternateRowColor, $909090)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Re: [Modules] ListEx (all OS / DPI)
Bugfixes: CountItems / alternate color / shift-select
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Re: [Modules] ListEx (all OS / DPI)
Hi,
I found one more bug:
The flag ListEx::#Selected is not set correctly when only one item is selected.
However, CountItems() returns the correct amount of selected items.
You can see this behavior by using the code above.
Clicking the popup menu will show the results in debugger.
Debugger output (example):
Could you fix this?
I found one more bug:
Code: Select all
OpenWindow(0, 100, 100, 300, 220, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CreatePopupMenu(0)
MenuItem(0, "Count selected")
ListEx::Gadget(0, 5, 5, 290, 190, "Test", 50, "", ListEx::#GridLines|ListEx::#MultiSelect, 0)
ListEx::AddItem(0, ListEx::#LastItem, "Line 1")
ListEx::AddItem(0, ListEx::#LastItem, "Line 2")
ListEx::AddItem(0, ListEx::#LastItem, "Line 3")
ListEx::AddItem(0, ListEx::#LastItem, "Line 4")
ListEx::AddItem(0, ListEx::#LastItem, "Line 5")
Define.i Event, Index, Count, Selected
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Select EventType()
Case #PB_EventType_RightClick
DisplayPopupMenu(0, WindowID(0))
EndSelect
EndSelect
Case #PB_Event_Menu
Select EventMenu()
Case 0
Selected = 0
Count = ListEx::CountItems(0) - 1
For Index = 0 To Count
If ListEx::GetItemState(0, Index) & ListEx::#Selected
Selected + 1
EndIf
Next
Debug "Count via loop: " + Str(Selected)
Debug "CountItems(): " + Str(ListEx::CountItems(0, ListEx::#Selected))
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
However, CountItems() returns the correct amount of selected items.
You can see this behavior by using the code above.
Clicking the popup menu will show the results in debugger.
Debugger output (example):
Code: Select all
Count via loop: 0 <- Should be 1
CountItems(): 1
Count via loop: 2 <- ok
CountItems(): 2
Count via loop: 3 <- ok
CountItems(): 3