Hello!
Is there a way of disabling some of the lines in a ListIconGadget?
Thanks,
Disable lines in ListIconGadget
- marcoagpinto
- Addict
- Posts: 1048
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: Disable lines in ListIconGadget
Only for windows
Code: Select all
Global Dim iTem(0),row
Procedure DisableItem(item)
row +1
ReDim iTem(row)
Item(row) = Item
EndProcedure
Procedure WnCallback(hWnd,uMsg,wParam,lParam)
result = #PB_ProcessPureBasicEvents
Select uMsg
Case #WM_NOTIFY
*nmhdr.NMHDR = lParam
If *nmhdr\hwndFrom = GadgetID(0)
Select *nmhdr\code
Case #NM_CUSTOMDRAW
*lvCD.NMLVCUSTOMDRAW = lParam
item = *lvCD\nmcd\dwItemSpec
Select *lvCD\nmcd\dwDrawStage
Case #CDDS_PREPAINT
ProcedureReturn #CDRF_NOTIFYITEMDRAW
Case #CDDS_ITEMPREPAINT
ProcedureReturn #CDRF_NOTIFYSUBITEMDRAW
Case #CDDS_ITEMPREPAINT | #CDDS_SUBITEM
For x= 1 To row
If item = iTem(x)
SetGadgetItemText(0,item,"Disabled",1)
*lvCD\nmcd\uItemState = #CDIS_DISABLED
*lvCD\clrText = $C2C2C2
ProcedureReturn #CDRF_DODEFAULT
EndIf
Next
EndSelect
EndSelect
EndIf
EndSelect
ProcedureReturn result
EndProcedure
OpenWindow(0,0,0,400,300,"ListIcon Disable Item",#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SetWindowCallback(@WnCallback())
ListIconGadget(0,10,10,380,280,"Name",150,#PB_ListIcon_FullRowSelect | #PB_ListIcon_GridLines | #PB_ListIcon_AlwaysShowSelection )
AddGadgetColumn(0,1,"State",100)
For i = 0 To 30
AddGadgetItem(0,-1,"ListIcon Item #" + Str(i)+Chr(10)+"Enabled")
Next
DisableItem(3)
DisableItem(5)
Disableitem(9)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 0
EndSelect
EndSelect
Until Quit = 1
Egypt my love
Re: Disable lines in ListIconGadget
Cross Platform
Code: Select all
Global row
Global Dim iTem(0)
Procedure DisableItem(item)
row +1
ReDim iTem(row)
Item(row) = Item
SetGadgetItemColor(0,item,#PB_Gadget_FrontColor,$C2C2C2)
EndProcedure
LoadFont(0,"Tahoma",10)
OpenWindow(0,0,0,640,480,"ListIcon Disabled Items",#PB_Window_SystemMenu| #PB_Window_ScreenCentered)
ListIconGadget(0,10,10,620,460,"",0,#PB_ListIcon_GridLines| #PB_ListIcon_FullRowSelect)
SetGadgetFont(0,FontID(0))
AddGadgetColumn(0,1,"Column 1",210)
AddGadgetColumn(0,2,"Column 2",200)
AddGadgetColumn(0,3,"Column 3",200)
For i = 0 To 50
linestr.s = LSet(Str(i),3," ")
AddGadgetItem(0, -1, Chr(10)+"Text on Line "+linestr+" in Column 1"+Chr(10)+"Text on Line "+linestr+" in Column 2"+Chr(10)+"Text on Line "+linestr+" in Column 3")
Next
DisableItem(0)
DisableItem(3)
DisableItem(5)
Disableitem(9)
Disableitem(10)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Select EventType()
Case #PB_EventType_LeftClick
item = GetGadgetState(0)
For x = 1 To row
If item = iTem(x)
SetGadgetItemState(0,item,0)
EndIf
Next
Case #PB_EventType_Change
item = GetGadgetState(0)
For n = 0 To CountGadgetItems(0)
For x = 1 To row
If item = iTem(x) And item > olditem
SetGadgetItemState(0,item+1,1)
item + 1
ElseIf item = iTem(x) And item < olditem
SetGadgetItemState(0,item-1,1)
item - 1
If item < 0
SetGadgetItemState(0,0,0)
EndIf
EndIf
Next
Next
olditem = item
EndSelect
EndSelect
EndSelect
Until Quit = 1
End
Egypt my love
- marcoagpinto
- Addict
- Posts: 1048
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: Disable lines in ListIconGadget
Thank you very much for replying!
I did explain it wrongly in my post.
I have listicongadgets with checkboxes in the first column of each line.
Is there a way of disabling the checkboxes for certain lines?
Thanks and sorry for my misexplanation.
Kind regards from your friend,
>Marco A.G.Pinto
----------------
I did explain it wrongly in my post.
I have listicongadgets with checkboxes in the first column of each line.
Is there a way of disabling the checkboxes for certain lines?
Code: Select all
ListIconGadget(#LISTGADGET_TEST,10,10,600+150+50+20+20+20+5,100-5,"Buffer",110+5,#PB_ListIcon_CheckBoxes|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
Kind regards from your friend,
>Marco A.G.Pinto
----------------
Re: Disable lines in ListIconGadget
Ok
For windows
Edit : Update
For windows
Code: Select all
Global count
Global Dim cb(3)
Procedure HideCheckBox(gadget, item )
lvi.LVITEM
lvi\iItem = item
lvi\mask = #LVIF_STATE
lvi\stateMask = #LVIS_STATEIMAGEMASK
;lvi\state = 0
SendMessage_(GadgetID(0), #LVM_SETITEM, 0, @lvi)
EndProcedure
Procedure callback(hWnd, uMsg, wParam, lParam)
result = #PB_ProcessPureBasicEvents
Select uMsg
Case #WM_NOTIFY
*nmlv.NM_LISTVIEW = lParam
If *nmlv\hdr\code = #LVN_ITEMCHANGED And *nmlv\hdr\hwndFrom = GadgetID(0)
iTem = *nmlv\iItem
For x = 0 To count
If item = cb(x)
HideCheckBox(0, item)
EndIf
Next
EndIf
EndSelect
ProcedureReturn result
EndProcedure
LoadFont(0,"Tahoma",12)
If OpenWindow(0, 0, 0, 800, 400, "Hide Specific Items Checkboxes", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ListIconGadget(0, 10,10, 780,380, "Column 0)", 250,#PB_ListIcon_GridLines| #PB_ListIcon_FullRowSelect| #PB_ListIcon_CheckBoxes)
SetGadgetFont(0,FontID(0))
For col=1 To 2
AddGadgetColumn(0, col, "Column "+Str(col), 250)
Next
For i = 0 To 50
AddGadgetItem(0, -1, "Text on Line "+Str(i)+" in Column 0"+Chr(10)+"Text on Line "+Str(i)+" in Column 1"+Chr(10)+"Text on Line "+Str(i)+" in Column 2")
Next
HideCheckBox(0, 2):cb(count) = 2 :count+1
HideCheckBox(0, 3):cb(count) = 3 :count+1
HideCheckBox(0, 8):cb(count) = 8 :count+1
HideCheckBox(0, 10):cb(count) = 10
SetWindowCallback(@callback())
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Debug GetGadgetItemState(0,0)
Debug GetGadgetItemState(0,2)
Debug ""
EndSelect
EndSelect
Until Quit = 1
EndIf
End
Last edited by RASHAD on Fri Mar 20, 2015 9:05 pm, edited 1 time in total.
Egypt my love
- marcoagpinto
- Addict
- Posts: 1048
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact:
Re: Disable lines in ListIconGadget
Thanks, RASHAD!





Re: Disable lines in ListIconGadget
You are welcome
Previous post updated to make it easier for you to add any number of CheckboxGadget .
Have fun
Previous post updated to make it easier for you to add any number of CheckboxGadget .
Have fun
Egypt my love
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: Disable lines in ListIconGadget
Very interesting
Thanks RASHAD
Thanks RASHAD


Not a destination