Change color frame and scrollbar of ListIconGadget[Resolved]
- Kwai chang caine
- Always Here

- Posts: 5528
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Change color frame and scrollbar of ListIconGadget[Resolved]
Hello at all
Is it possible to change the color of a ListIconGadget ???
I want to say the frame and the ScrollingBar and the font ???
Thanks for your help
Good day
Is it possible to change the color of a ListIconGadget ???
I want to say the frame and the ScrollingBar and the font ???
Thanks for your help
Good day
Last edited by Kwai chang caine on Thu Sep 25, 2008 9:50 am, edited 1 time in total.
The happiness is a road...Not a destination
- Fluid Byte
- Addict

- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
- Kwai chang caine
- Always Here

- Posts: 5528
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
- Fluid Byte
- Addict

- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
Code: Select all
OpenWindow(0,0,0,340,380,"void",#PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
ContainerGadget(0,0,0,0,0)
ListIconGadget(1,0,0,0,0,"Name",290)
CloseGadgetList()
SetWindowLong_(GadgetID(0),#GWL_STYLE,GetWindowLong_(GadgetID(0),#GWL_STYLE) | #WS_CLIPCHILDREN)
SetWindowLong_(GadgetID(1),#GWL_EXSTYLE,0)
SetGadgetColor(0,#PB_Gadget_BackColor,#Red)
For i=1 To 80 : AddGadgetItem(1,-1,"List-View Item #" + Str(i)) : Next
For i=0 To CountGadgetItems(1)
SetGadgetItemColor(1,i,#PB_Gadget_FrontColor,Random($FFFFFF))
Next
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_SizeWindow
CXEDGE = GetSystemMetrics_(#SM_CXEDGE)
ResizeGadget(0,10,10,WindowWidth(0)-20,WindowHeight(0)-20)
ResizeGadget(1,CXEDGE,CXEDGE,GadgetWidth(0)-CXEDGE*2,GadgetHeight(0)-CXEDGE*2)
EndIf
Until EventID = #PB_Event_CloseWindowWindows 10 Pro, 64-Bit / Whose Hoff is it anyway?
- Kwai chang caine
- Always Here

- Posts: 5528
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Thanks a lot FLUID BYTE
If i add your code, with one of the code of SPARKIE and SROD, i have almost all
http://www.purebasic.fr/english/viewtop ... red+header
http://www.purebasic.fr/english/viewtop ... red+header
http://www.purebasic.fr/english/viewtop ... lor+colour
http://www.purebasic.fr/english/viewtop ... red+header
http://www.purebasic.fr/english/viewtop ... lor+colour
The frame, the header, only scrolbar failled.
I search how i can create my scrolbar for color it to the color desired :roll:
Thanks again of your kindness
I wish you a very good day
If i add your code, with one of the code of SPARKIE and SROD, i have almost all
http://www.purebasic.fr/english/viewtop ... red+header
http://www.purebasic.fr/english/viewtop ... red+header
http://www.purebasic.fr/english/viewtop ... lor+colour
http://www.purebasic.fr/english/viewtop ... red+header
http://www.purebasic.fr/english/viewtop ... lor+colour
The frame, the header, only scrolbar failled.
I search how i can create my scrolbar for color it to the color desired :roll:
Thanks again of your kindness
I wish you a very good day
The happiness is a road...Not a destination
With a combination of dirty tricks it's possible to change the background color of the scrollbar. I even worked out 2 solutionsFluid Byte wrote:Scrollbar? Not at all!
Code: Select all
Procedure WindowCallback(WindowHandle, Msg, WParam, LParam)
Shared BackgroundBrush
Shared NumRowsTotal
Shared RowHeight
Static LastIndex
Protected CurrentIndex
Protected Result = #PB_ProcessPureBasicEvents
Select Msg
Case #WM_PAINT
ShowScrollBar_(GadgetID(0), #SB_VERT, #False)
Case #WM_CTLCOLORSCROLLBAR
Result = BackgroundBrush
Case #WM_VSCROLL
CurrentIndex = GetGadgetState(1)
SendMessage_(GadgetID(0), #LVM_SCROLL, 0, (CurrentIndex - LastIndex) * RowHeight)
LastIndex = CurrentIndex
EndSelect
ProcedureReturn Result
EndProcedure
If OpenWindow(0, 100, 100, 270, 105, "Colored scrollbar background", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
ScrollBarWidth = GetSystemMetrics_(#SM_CXVSCROLL)
ListIconGadget(0, 5, 5, WindowWidth(0) - ScrollBarWidth - 10, WindowHeight(0) - 10, "Column 1", 100)
AddGadgetColumn(0, 1, "Column 2", 100)
For i = 1 To 20
AddGadgetItem(0, -1, "Line " + Str(i) + ", Column 1" + #LF$ + "Line " + Str(i) + ", Column 2")
Next i
NumRowsTotal = CountGadgetItems(0)
NumVisibleRows = SendMessage_(GadgetID(0), #LVM_GETCOUNTPERPAGE, 0, 0)
RowHeight = SendMessage_(GadgetID(0), #LVM_GETITEMSPACING, #True, 0) >> 16
ScrollBarGadget(1, WindowWidth(0) - ScrollBarWidth - 5, 5, ScrollBarWidth, WindowHeight(0) - 10, 0, NumRowsTotal, NumVisibleRows, #PB_ScrollBar_Vertical)
BackgroundBrush = CreateSolidBrush_(#Green)
SetWindowCallback(@WindowCallback())
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
DeleteObject_(BackgroundBrush)
EndIf
EndIf- Kwai chang caine
- Always Here

- Posts: 5528
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
In Fluid Byte's first program above are the lines:
I know these lines are manipulating gadget/window style attributes, but in the context of his program what does adding #WS_CLIPCHILDREN for the container gadget achieve?
Which are the pertinent attributes being renoved fron the list icon gadget and what does their removal achieve?
I would be pleased if someone could shed some light on this.
Code: Select all
SetWindowLong_(GadgetID(0),#GWL_STYLE,GetWindowLong_(GadgetID(0),#GWL_STYLE) | #WS_CLIPCHILDREN)
SetWindowLong_(GadgetID(1),#GWL_EXSTYLE,0)Which are the pertinent attributes being renoved fron the list icon gadget and what does their removal achieve?
I would be pleased if someone could shed some light on this.
Anthony Jordan
- Fluid Byte
- Addict

- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
I have put the ListIconGadget into a container to create the border. So when you resize the container the ListIconGadget will flicker. But when you set the #WS_CLIPCHILDREN style to the container it will still update it's client area but excludes all it's child windows.
Also I set the extended style of the ListIconGadget to NULL wich will remove the standard border wich is normally set with #WS_EX_CLIENTEDGE.
Also I set the extended style of the ListIconGadget to NULL wich will remove the standard border wich is normally set with #WS_EX_CLIENTEDGE.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
