[Modules] ListEx (all OS / DPI)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
loulou2522
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Oct 14, 2014 12:09 pm

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

Post by loulou2522 »

Thank for this addition
It will be good if we can define each lenght for each string zone and if we can have for number or integer the ability to give a range ex 1 to 10 or validate onloy a number < to some value
Have a good day
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

Update:
  • SetCondition() for editable cells
  • #MaxChar for SetAttribute() and SetColumnAttribute()
e.g. only numbers between 0 and 11 allowed ( => 1 - 10 )

Code: Select all

ListEx::SetCondition(#List, 2, "BETWEEN{0|11}")
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
loulou2522
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Oct 14, 2014 12:09 pm

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

Post by loulou2522 »

ListEx::SetColumnAttribute(#list,4,ListEx::#MaxChars,14)

The fucntion blocked input only for 13 characters , i wonder fourteen characters Can you see Please ?
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

loulou2522 wrote:ListEx::SetColumnAttribute(#list,4,ListEx::#MaxChars,14)

The fucntion blocked input only for 13 characters , i wonder fourteen characters Can you see Please ?
I can't find a problem.

Code: Select all

ListEx::SetColumnAttribute(#List, 2, ListEx::#MaxChars, 14)
The editable field accepted "12345678901234".
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] ListEx (all OS / DPI)

Post by davido »

@Thorsten1867,

I've just checked out your latest update of ListEx which, unfortunately, crashes with the error:

1815 ListEx()\Color\Back = BlendColor_(OSX_NSColorToRGB(CocoaMessage(0, 0, "NSColor textBackgroundColor")), $FFFFFF, 80)
[20:43:23] [COMPILER] Line 1815: BlendColor_() is not a function, array, list, map or macro.
DE AA EB
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

davido wrote:@Thorsten1867,

I've just checked out your latest update of ListEx which, unfortunately, crashes with the error:

1815 ListEx()\Color\Back = BlendColor_(OSX_NSColorToRGB(CocoaMessage(0, 0, "NSColor textBackgroundColor")), $FFFFFF, 80)
[20:43:23] [COMPILER] Line 1815: BlendColor_() is not a function, array, list, map or macro.
Try it again. I hope the problem is solved now.
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] ListEx (all OS / DPI)

Post by davido »

@Thorsten1867,
As I expected, it works fine now. :D
Thank you.
DE AA EB
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've recently noticed that some of my programs using ListEx hide some of the bottom few rows from view.
Clicking on such a hidden row temporarily reveals it.

I assumed that I was doing something wrong, this usually is the case. :)
Being unable to solve the problem, I decided to try to amend your demo code to see if I could reproduce the effect.

If you add the following code after your last 'AddItem() ...

Code: Select all

      For m = 1 To 100
        ListEx::AddItem(#List, ListEx::#LastItem, RSet(Str(m),3,"0")  + " Harriet"  + #LF$ + "Smith"    + #LF$ + #LF$ + #LF$ + "Push")
      Next
... and then extend the depth of the window you should eventually notice the effect to which I referred to above.

I noticed this on my Mac, initially.
However, I use the code mainly on PCs.
All show exactly the same problem.
DE AA EB
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

Quick guide for terms:

Code: Select all

MarkContent()
SetCondition()

Code: Select all

"POSITIVE" => [?] =  positive number
"NEGATIVE" =>  [?] = negative number 
"EQUAL{3.95}" or "EQUAL{String}" => [?] = 3.95 or [?] = "String"
"LIKE{*end}" or "LIKE{start*}" or "LIKE{*part*}" => "...end" or "start..." or "...part..." 
"COMPARE{<|12}" =>  [?] < 12
"BETWEEN{10|20}"  =>  10 < [?] < 20
"BEYOND{3|4}"   =>  3 > [?] OR [?] > 4
"CHOICE{m|f}[C4]" => if column 4 = "m" -> color 1 / if column 4 = "f" -> color 2
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Cyllceaux
Enthusiast
Enthusiast
Posts: 510
Joined: Mon Jun 23, 2014 1:18 pm

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

Post by Cyllceaux »

Cool 8)

Next thing... After unhide, the ListEx should be drawn. (like ContainerEx).
Line 6149 - 6154
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

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

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Cyllceaux
Enthusiast
Enthusiast
Posts: 510
Joined: Mon Jun 23, 2014 1:18 pm

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

Post by Cyllceaux »

great :)
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've created a demo code of the problem I mentioned yesterday regarding the missing rows in ListEx gadgets:

Code: Select all

EnableExplicit

XIncludeFile "ListExModule.pbi"

#Window  = 0
Enumeration 1
  #List_A
  #List_B
  #List_C
EndEnumeration

#Image = 0
#Font_Arial9  = 1
#Font_Arial9B = 2
#Font_Arial9U = 3

LoadFont(#Font_Arial9,  "Arial", 9)
LoadFont(#Font_Arial9B, "Arial", 9, #PB_Font_Bold)
LoadFont(#Font_Arial9U, "Arial", 9, #PB_Font_Underline)

Global Event.i, i.i

If OpenWindow(#Window, 0, 0, 800, 550, "Window", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
  
  
  
  If ListEx::Gadget(#List_A, 5, 5, 260, 450, "", 25, "", ListEx::#GridLines|ListEx::#CheckBoxes|ListEx::#AutoResize|ListEx::#MultiSelect|ListEx::#ResizeColumn, #Window) ; ListEx::#NoRowHeader|ListEx::#ThreeState|ListEx::#NumberedColumn|ListEx::#SingleClickEdit 
    
    
    ; --- Add different types of columns  ---
    ListEx::AddColumn(#List_A, 1, "Edit", 185, "edit",   ListEx::#Editable) ; |ListEx::#FitColumn
    
    ; --- Add content ---
    For i = 0 To 80
      ListEx::AddItem(#List_A,ListEx::#LastItem,"List A: " + Str(i))
    Next i
    
  EndIf
  
  
  If ListEx::Gadget(#List_B, 270, 5, 260, 450, "", 25, "", ListEx::#GridLines|ListEx::#CheckBoxes|ListEx::#AutoResize|ListEx::#MultiSelect|ListEx::#ResizeColumn, #Window) ; ListEx::#NoRowHeader|ListEx::#ThreeState|ListEx::#NumberedColumn|ListEx::#SingleClickEdit 
    
    
    
    ; --- Add different types of columns  ---
    ListEx::AddColumn(#List_B, 1, "Edit", 185, "edit",   ListEx::#Editable) ; |ListEx::#FitColumn
    
    ; --- Add content ---
    For i = 0 To 80
      ListEx::AddItem(#List_B,ListEx::#LastItem,"List B: " + Str(i))
    Next i
    
  EndIf
  
  If ListEx::Gadget(#List_C, 545, 5, 260, 450, "", 25, "", ListEx::#GridLines|ListEx::#CheckBoxes|ListEx::#AutoResize|ListEx::#MultiSelect|ListEx::#ResizeColumn, #Window) ; ListEx::#NoRowHeader|ListEx::#ThreeState|ListEx::#NumberedColumn|ListEx::#SingleClickEdit 
    
    
    ; --- Add different types of columns  ---
    ListEx::AddColumn(#List_C, 1, "Edit", 185, "edit",   ListEx::#Editable) ; |ListEx::#FitColumn
    
    ; --- Add content ---
    For i = 0 To 80
      ListEx::AddItem(#List_C,ListEx::#LastItem,"List C: " + Str(i))
    Next i
  EndIf
EndIf  

Repeat
  Event = WaitWindowEvent()
  Select Event
    Case ListEx::#Event_Gadget ; works with or without EventType()
      Select EventType()
        Case #PB_EventType_RightClick 
          Debug "RightClick: " + Str(EventData())
        Case ListEx::#EventType_Row
          Debug ">>> Row: " + Str(EventData())
      EndSelect
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #List_A     ;{ only in use with EventType()
          Select EventType()
            Case ListEx::#EventType_Header
              Debug ">>> Header Click: " + Str(EventData()) ; Str(ListEx::EventColumn(#List_A))  
            Case ListEx::#EventType_Button
              Debug ">>> Button pressed (" + Str(ListEx::EventRow(#List_A))+"/"+Str(ListEx::EventColumn(#List_A)) + ")"
            Case ListEx::#EventType_Link
              Debug ">>> Link pressed (" + Str(ListEx::EventRow(#List_A))+"/"+Str(ListEx::EventColumn(#List_A)) + "): " +  ListEx::EventValue(#List_A)
              If ListEx::EventID(#List_A) = "PureBasic" : RunProgram("http://www.purebasic.com") :  EndIf
            Case ListEx::#EventType_String
              Debug ">>> Cell edited (" + Str(ListEx::EventRow(#List_A))+"/"+Str(ListEx::EventColumn(#List_A)) + "): " +  ListEx::EventValue(#List_A)
            Case ListEx::#EventType_Date
              Debug ">>> Date changed (" + Str(ListEx::EventRow(#List_A))+"/"+Str(ListEx::EventColumn(#List_A)) + "): " +  ListEx::EventValue(#List_A)  
            Case ListEx::#EventType_CheckBox
              Debug ">>> CheckBox state changed (" + Str(ListEx::EventRow(#List_A))+"/"+Str(ListEx::EventColumn(#List_A)) + "):" + Str(ListEx::EventState(#List_A)) 
            Case ListEx::#EventType_ComboBox
              Debug ">>> ComboBox state changed (" + Str(ListEx::EventRow(#List_A))+"/"+Str(ListEx::EventColumn(#List_A)) + "): " +  ListEx::EventValue(#List_A)
          EndSelect ;}
          
        Case #List_B     ;{ only in use with EventType()
          Select EventType()
            Case ListEx::#EventType_Header
              Debug ">>> Header Click: " + Str(EventData()) ; Str(ListEx::EventColumn(#List_B))  
            Case ListEx::#EventType_Button
              Debug ">>> Button pressed (" + Str(ListEx::EventRow(#List_B))+"/"+Str(ListEx::EventColumn(#List_B)) + ")"
            Case ListEx::#EventType_Link
              Debug ">>> Link pressed (" + Str(ListEx::EventRow(#List_B))+"/"+Str(ListEx::EventColumn(#List_B)) + "): " +  ListEx::EventValue(#List_B)
              If ListEx::EventID(#List_B) = "PureBasic" : RunProgram("http://www.purebasic.com") :  EndIf
            Case ListEx::#EventType_String
              Debug ">>> Cell edited (" + Str(ListEx::EventRow(#List_B))+"/"+Str(ListEx::EventColumn(#List_B)) + "): " +  ListEx::EventValue(#List_B)
            Case ListEx::#EventType_Date
              Debug ">>> Date changed (" + Str(ListEx::EventRow(#List_B))+"/"+Str(ListEx::EventColumn(#List_B)) + "): " +  ListEx::EventValue(#List_B)  
            Case ListEx::#EventType_CheckBox
              Debug ">>> CheckBox state changed (" + Str(ListEx::EventRow(#List_B))+"/"+Str(ListEx::EventColumn(#List_B)) + "):" + Str(ListEx::EventState(#List_B)) 
            Case ListEx::#EventType_ComboBox
              Debug ">>> ComboBox state changed (" + Str(ListEx::EventRow(#List_B))+"/"+Str(ListEx::EventColumn(#List_B)) + "): " +  ListEx::EventValue(#List_B)
          EndSelect ;}
          
        Case #List_C     ;{ only in use with EventType()
          Select EventType()
            Case ListEx::#EventType_Header
              Debug ">>> Header Click: " + Str(EventData()) ; Str(ListEx::EventColumn(#List_C))  
            Case ListEx::#EventType_Button
              Debug ">>> Button pressed (" + Str(ListEx::EventRow(#List_C))+"/"+Str(ListEx::EventColumn(#List_C)) + ")"
            Case ListEx::#EventType_Link
              Debug ">>> Link pressed (" + Str(ListEx::EventRow(#List_C))+"/"+Str(ListEx::EventColumn(#List_C)) + "): " +  ListEx::EventValue(#List_C)
              If ListEx::EventID(#List_C) = "PureBasic" : RunProgram("http://www.purebasic.com") :  EndIf
            Case ListEx::#EventType_String
              Debug ">>> Cell edited (" + Str(ListEx::EventRow(#List_C))+"/"+Str(ListEx::EventColumn(#List_C)) + "): " +  ListEx::EventValue(#List_C)
            Case ListEx::#EventType_Date
              Debug ">>> Date changed (" + Str(ListEx::EventRow(#List_C))+"/"+Str(ListEx::EventColumn(#List_C)) + "): " +  ListEx::EventValue(#List_C)  
            Case ListEx::#EventType_CheckBox
              Debug ">>> CheckBox state changed (" + Str(ListEx::EventRow(#List_C))+"/"+Str(ListEx::EventColumn(#List_C)) + "):" + Str(ListEx::EventState(#List_C)) 
            Case ListEx::#EventType_ComboBox
              Debug ">>> ComboBox state changed (" + Str(ListEx::EventRow(#List_C))+"/"+Str(ListEx::EventColumn(#List_C)) + "): " +  ListEx::EventValue(#List_C)
          EndSelect ;}
          
      EndSelect
  EndSelect
Until Event = #PB_Event_CloseWindow

    

  
DE AA EB
User avatar
doctorized
Addict
Addict
Posts: 882
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

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

Post by doctorized »

Thorsten1867 wrote:
doctorized wrote: ...but auto resizing columns' width is not working.
Try version from 10.11.2019.
Tried your last version from today but nothing changed. What exact command should I use?
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

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

Post by Thorsten1867 »

Bug fixed

The demo code was very helpful. :)
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Post Reply