[Module] ComboBoxEx Gadget (all OS)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

[Module] ComboBoxEx Gadget (all OS)

Post by Thorsten1867 »

ComboBoxEx Gadget - Module (all OS / DPI / 64Bit)
  • Replace the arrow with an image possible
  • colors for single rows
  • automatic size adjustment
  • support of GUI themes (needs ModuleEx.pbi)
Image ___ Image

Code: Select all

; ComboBoxEx::AddItem()            - similar to 'AddGadgetItem()'
; ComboBoxEx::AttachPopupMenu()    - attach a popup menu to the list
; ComboBoxEx::Copy()               - copy selection to clipboard
; ComboBoxEx::Cut()                - cut selection to clipboard
; ComboBoxEx::Delete()             - delete selection
; ComboBoxEx::ClearItems()         - similar to 'ClearGadgetItems()'
; ComboBoxEx::CountItems()         - similar to 'CountGadgetItems()'
; ComboBoxEx::Disable()            - similar to 'DisableGadget()'
; ComboBoxEx::GetData()            - similar to 'GetGadgetData()'
; ComboBoxEx::GetID()              - similar to 'GetGadgetData()', but string instead of quad
; ComboBoxEx::GetColor()           - similar to 'GetGadgetColor()'
; ComboBoxEx::GetItemData()        - similar to 'GetGadgetItemData()'
; ComboBoxEx::GetItemLabel()       - similar to 'GetGadgetItemData()', but string instead of quad
; ComboBoxEx::GetItemText()        - similar to 'GetGadgetItemText()'
; ComboBoxEx::GetLabelText()       - similar to 'GetGadgetItemText()', but label instead of row
; ComboBoxEx::GetState()           - similar to 'GetGadgetState()'
; ComboBoxEx::GetText()            - similar to 'GetGadgetText()'
; ComboBoxEx::Gadget()             - similar to 'ComboBoxGadget()'
; ComboBoxEx::Hide()               - similar to 'HideGadget()'
; ComboBoxEx::Paste()              - paste clipboard
; ComboBoxEx::RemoveItem()         - similar to 'RemoveGadgetItem()'
; ComboBoxEx::SetAttribute()       - similar to 'SetGadgetAttribute()'
; ComboBoxEx::SetAutoResizeFlags() - [#MoveX|#MoveY|#Width|#Height]
; ComboBoxEx::SetColor()           - similar to 'SetGadgetColor()'
; ComboBoxEx::SetData()            - similar to 'SetGadgetData()'
; ComboBoxEx::SetFont()            - similar to 'SetGadgetFont()'
; ComboBoxEx::SetID()              - similar to 'SetGadgetData()', but string instead of quad
; ComboBoxEx::SetImage()           - replace the arrow with an image
; ComboBoxEx::SetItemColor()       - similar to 'SetGadgetItemColor()'
; ComboBoxEx::SetItemData()        - similar to 'SetGadgetItemData()'
; ComboBoxEx::SetItemImage()       - similar to 'SetGadgetItemImage()'
; ComboBoxEx::SetItemText()        - similar to 'SetGadgetItemText()'
; ComboBoxEx::SetLabelText()       - similar to 'SetGadgetItemText()', but label instead of row
; ComboBoxEx::SetState()           - similar to 'SetGadgetState()'
; ComboBoxEx::SetText()            - similar to 'SetGadgetText()'
Download: ComboBoxExModule.pbi
Last edited by Thorsten1867 on Fri Dec 20, 2019 4:21 pm, edited 2 times 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: [Module] ComboBoxEx Gadgeat (all OS)

Post by Thorsten1867 »

Update: #MultiSelect flag added
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: [Module] ComboBoxEx Gadgeat (all OS)

Post by Thorsten1867 »

Bugfix: ComboBoxEx::SetState()
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: [Module] ComboBoxEx Gadgeat (all OS)

Post by Thorsten1867 »

Update: Scrollbar added
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: [Module] ComboBoxEx Gadgeat (all OS)

Post by Thorsten1867 »

Update: ScrollBarGadget() replaced by drawing routine
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: [Module] ComboBoxEx Gadgeat (all OS)

Post by Thorsten1867 »

Update:
  • Attribute #ScrollBar [#ScrollBar_Default/#ScrollBar_Frame/#ScrollBar_DragPoint]
  • SetColor() -> [#ScrollBar_FrontColor/#ScrollBar_BackColor/#ScrollBar_BorderColor/#ScrollBar_ButtonColor/#ScrollBar_ThumbColor]
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: [Module] ComboBoxEx Gadgeat (all OS)

Post by ozzie »

Not sure if I'm doing something wrong. I have a test program that uses ComboBoxExModule.pbi dated 07.03.2020, and ModuleEx.pbi dated 10.04.2020, but when I compile the test program I get this error in ComboBoxExModule:
Line 1673: Structure field not found: ScrollBar

Do I need to include any other modules? I'm using PB 5.71 under Windows 10.
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] ComboBoxEx Gadgeat (all OS)

Post by Thorsten1867 »

I have tested the last version and uploaded it again.
Please try it again.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: [Module] ComboBoxEx Gadget (all OS)

Post by ozzie »

Thanks, but compilation now fails in ComboBoxExModule at Line 1692: Structure field not found: FocusBack.

This also occurs if I just compile ComboBoxExModule.pbi.
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] ComboBoxEx Gadget (all OS)

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]
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: [Module] ComboBoxEx Gadget (all OS)

Post by ozzie »

Thanks. All OK now.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: [Module] ComboBoxEx Gadget (all OS)

Post by IdeasVacuum »

Hi Thorsten

Playing with the example in the module :D

Code: Select all

If ComboBoxEx::Gadget(#ComboEx, 10, 40, 150, 40, 100, "", ComboBoxEx::#BorderLess, #Window)
The numbers - x,y, gadget width, gadget height, text width. Is that correct?

It is defaulting to a standard height of 20 and my icons are squeezed to 4 x 16 pix from 34 x 34 pix
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] ComboBoxEx Gadget (all OS)

Post by Thorsten1867 »

Update:
  • New Scrollbar
  • New DPI-management
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
jak64
Enthusiast
Enthusiast
Posts: 502
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: [Module] ComboBoxEx Gadget (all OS)

Post by jak64 »

Hello Thorsten1867,

I modified my program to color a line of my ComboBox, but I can't do it, the line does not get colored.

1) To test, I added:

Code: Select all

IncludeFile "D:\Purebasic\MY MUSIC\ComboBoxEx\ComboBoxEx\ComboBoxExModule.pbi"
on the front line of my program.

2) I modified my code as follows for the example, I want to put line 2 in red.

Code: Select all

ResetList(ListNameDirectories())
   While NextElement(ListNameDirectories())
     With ListNameDirectories()
       AddGadgetItem(#ComboDisplayDirectories, -1, \NameDirectory)
     EndWith
   Wend
   ComboBoxEx::SetItemColor(#ComboDisplayDirectories,2,#Red)


The comboBox contains almost 2000 elements.

When I run the program, no error but when I open my ComboBox, no line is displayed in red.

Can you help me ?
Mindphazer
Enthusiast
Enthusiast
Posts: 340
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: [Module] ComboBoxEx Gadget (all OS)

Post by Mindphazer »

You need to use

Code: Select all

ComboBoxEx::Gadget()
to create your combo box gadget,
and

Code: Select all

ComboBoxEx::AddItem() 
instead of AddGadgetItem() to populate it
MacBook Pro 14" M1 Pro - 16 Gb - MacOS 14 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
Post Reply