ListIcon Fast and Furiously editable [Resolved]

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

ListIcon Fast and Furiously editable [Resolved]

Post by Kwai chang caine »

Hello at all

I try to mix three splendids codes for a ListIcon

The first of SROD give to me the height of the cell, it works very well and have no problem 8)
http://www.purebasic.fr/english/viewtop ... 2a#p335199
The second of NETMAESTRO give to me the coordinate of cell cliqued
http://forum.purebasic.com/english/view ... e3#p161560
The second of RASHAD fast load the ListIcon
http://www.purebasic.fr/english/viewtop ... 05#p403305

So apparently , the two codes RASHAD and NETMAESTRO are not really friends :|

I have try the first method to put the #NOTIFY of the RASHAD CallBack() into the NETMAESTRO ListIcon Subclassing(), but the ListIcon are empty :|

Code: Select all

Enumeration
 #Window
 #WinEntrer
 #ListIcon
 #StrEntrer
EndEnumeration 

Structure ListIcon
 PosX.i
 PosY.i
 ColSelec.i
 LigneSelec.i
 LargeurColonne.i
 HauteurColonne.i
 Oldlist.l
EndStructure

#LVSICF_NOINVALIDATEALL = 1
#LVN_ODCACHEHINT = #LVN_FIRST - 13
#LVM_SUBITEMHITTEST = #LVM_FIRST + 57
#MaxLignes = 350000

Global Grid.ListIcon
Global Dim myItems.s(#MaxLignes)

Procedure.I GetRowHeight(ListIconID.I) ; SROD
 
 rc.rect\left = #LVIR_BOUNDS
 SendMessage_(GadgetID(ListIconID), #LVM_GETITEMRECT, 0, rc)
 height = rc\bottom - rc\top
 ProcedureReturn height
 
EndProcedure

Procedure.s ChampEntree(*Grille.ListIcon)
 
 If *Grille\HauteurColonne < 20
  HauteurColonne = 18
 Else
  HauteurColonne = *Grille\HauteurColonne
 EndIf
 
 SetGadgetItemColor(#ListIcon, *Grille\LigneSelec - 1, #PB_Gadget_BackColor, #White, *Grille\ColSelec)
 SetGadgetItemColor(#ListIcon, *Grille\LigneSelec - 1, #PB_Gadget_FrontColor, #Black, *Grille\ColSelec)
 OpenWindow(#WinEntrer, WindowX(#Window) + *Grille\PosX, WindowY(#Window) + *Grille\PosY + *Grille\HauteurColonne, *Grille\LargeurColonne, HauteurColonne, "", #PB_Window_BorderLess) 
 StringGadget(#StrEntrer, 0, 0, *Grille\LargeurColonne, HauteurColonne, GetGadgetItemText(#ListIcon, *Grille\LigneSelec - 1, *Grille\ColSelec))
 SetActiveGadget(#StrEntrer)
 StickyWindow(#WinEntrer, #True)
 
 SetGadgetColor(#StrEntrer, #PB_Gadget_BackColor, RGB(178, 177, 169))
 AddKeyboardShortcut(#WinEntrer, #PB_Shortcut_Return, 1)
 AddKeyboardShortcut(#WinEntrer, #PB_Shortcut_Escape, 2) 
 
 GetWindowRect_(WindowID(1), editrect.rect) 
 ClipCursor_(editrect) 
 
 Repeat
  
  ev = WaitWindowEvent() 
  
  If EventWindow() = 1 
   
   Select ev
     
    Case #WM_RBUTTONDOWN
     Grid\PosX = 0
     Grid\PosY = 0
     Break
     
     
    Case #PB_Event_Menu 
     
     If EventMenu() = 1
      SetGadgetItemText(#ListIcon, *Grille\LigneSelec - 1, GetGadgetText(#StrEntrer), *Grille\ColSelec)
      Break
     Else
      Grid\PosX = 0
      Grid\PosY = 0
      Break
     EndIf 
     
   EndSelect 
   
  EndIf    
  
 Until ev = #PB_Event_CloseWindow
 
 If IsWindow(#WinEntrer)
  CloseWindow(#WinEntrer)
 EndIf
 
 ClipCursor_(0)
 
EndProcedure 

Procedure SubClass_LV(hwnd, msg, wparam, lparam) ; NETMAESTRO
 
 Result = CallWindowProc_(Grid\Oldlist, hwnd, msg, wparam, lparam) 
 
 Select msg
 
  Case #WM_NOTIFY ; RASHAD
   
   *pnmh.NMHDR = lParam 
   
   Select *pnmh\code
   
    Case #LVN_ODCACHEHINT
    
     result = 0
     
    Case #LVN_GETDISPINFO
    
     *pnmlvdi.NMLVDISPINFO = lParam 
     
     If *pnmlvdi\item\mask & #LVIF_TEXT
      Field$ = StringField(PeekS(@myItems(*pnmlvdi\item\iItem)), *pnmlvdi\item\iSubItem + 1, Chr(10))
      PokeS(*pnmlvdi\item\pszText, Field$)
     EndIf 
     ;
   EndSelect
   
  Case #WM_LBUTTONDBLCLK
   
   If Grid\PosX And Grid\PosY
    ChampEntree(@Grid)
   Else
    MessageRequester("", "Veuillez séléctionner une case auparavant") 
   EndIf
   
  Case #WM_LBUTTONDOWN
   
   If IsWindow(#WinEntrer)
    CloseWindow(#WinEntrer)
   EndIf
   
   HitInfo.LVHITTESTINFO ; NETMAESTRO
   Hitinfo\pt\x = WindowMouseX(#Window)
   HitInfo\pt\y = WindowMouseY(#Window) 
   SendMessage_(GadgetID(#ListIcon), #LVM_SUBITEMHITTEST, 0, @HitInfo)
   SetGadgetItemColor(#ListIcon, Grid\LigneSelec - 1, #PB_Gadget_BackColor, #White, Grid\ColSelec)
   SetGadgetItemColor(#ListIcon, Grid\LigneSelec - 1, #PB_Gadget_FrontColor, #Black, Grid\ColSelec)
   SetGadgetItemColor(#ListIcon, hitinfo\iitem, #PB_Gadget_BackColor, #Blue, hitinfo\iSubItem)
   SetGadgetItemColor(#ListIcon, hitinfo\iitem, #PB_Gadget_FrontColor, #White, hitinfo\iSubItem)
   
   Grid\PosX = 0
   Grid\PosY = 0
   Grid\LigneSelec = hitinfo\iitem + 1
   Grid\ColSelec = hitinfo\iSubItem
   Grid\LargeurColonne = GetGadgetItemAttribute(#ListIcon, Grid\LigneSelec, #PB_ListIcon_ColumnWidth, Grid\ColSelec)
   Grid\HauteurColonne = GetRowHeight(#ListIcon)
   
   For Lig = 0 To Grid\LigneSelec ; Ligne
    Grid\PosY + GetRowHeight(#ListIcon)
   Next
   
   For Col = 1 To Grid\ColSelec ; Colonne
    Grid\PosX + GetGadgetItemAttribute(#ListIcon, Grid\LigneSelec, #PB_ListIcon_ColumnWidth, Col - 1)
   Next
   
   Grid\PosX + 6
   
 EndSelect
 
 ProcedureReturn Result 
 
EndProcedure 

OpenWindow(#Window, 0, 0, 640, 480, "ListIcon Gadget Mischief: Edit Selected Item", $CF0001) 
ListIconGadget(#ListIcon, 0, 0, 640, 480, "", 0, #PB_ListIcon_GridLines|#LVS_OWNERDATA) 
AddGadgetColumn(#ListIcon, 1, "Column 1", 210) 
AddGadgetColumn(#ListIcon, 2, "Column 2", 210) 
AddGadgetColumn(#ListIcon, 3, "Column 3", 215)

SendMessage_(GadgetID(#ListIcon), #LVM_SETITEMCOUNT, #MaxLignes, #LVSICF_NOINVALIDATEALL) ; RASHAD
Grid\Oldlist = SetWindowLong_(GadgetID(#ListIcon), #GWL_WNDPROC, @SubClass_LV()) ; NETMAESTRO

For i=0 To #MaxLignes 
 myItems(i) = Trim(Str(i)) + Chr(10) + "Hello" + Chr(10) + "i'm"  + Chr(10) + "KCC " + Trim(Str(i))
Next i

Repeat 
 ev = WaitWindowEvent()
Until ev = #PB_Event_CloseWindow
After i have another method, put RASHAD CallBack() beside NETMAESTRO SubClassing and this time the editable function not works very well :cry:

Code: Select all

; http://forum.purebasic.com/english/viewtopic.php?p=161560&sid=1ae821fb59eee6783c37324226c924e3#p161560

Enumeration
 #Window
 #WinEntrer
 #ListIcon
 #StrEntrer
EndEnumeration 

Structure ListIcon
 PosX.i
 PosY.i
 ColSelec.i
 LigneSelec.i
 LargeurColonne.i
 HauteurColonne.i
 Oldlist.l
EndStructure

#LVSICF_NOINVALIDATEALL = 1
#LVN_ODCACHEHINT = #LVN_FIRST - 13
#LVM_SUBITEMHITTEST = #LVM_FIRST + 57
#MaxLignes = 350000

Global Grid.ListIcon
Global Dim myItems.s(#MaxLignes)

Procedure.I GetRowHeight(ListIconID.I) ; SROD
 
 rc.rect\left = #LVIR_BOUNDS
 SendMessage_(GadgetID(ListIconID), #LVM_GETITEMRECT, 0, rc)
 height = rc\bottom - rc\top
 ProcedureReturn height
 
EndProcedure

Procedure.s ChampEntree(*Grille.ListIcon)
 
 If *Grille\HauteurColonne < 20
  HauteurColonne = 18
 Else
  HauteurColonne = *Grille\HauteurColonne
 EndIf
 
 SetGadgetItemColor(#ListIcon, *Grille\LigneSelec - 1, #PB_Gadget_BackColor, #White, *Grille\ColSelec)
 SetGadgetItemColor(#ListIcon, *Grille\LigneSelec - 1, #PB_Gadget_FrontColor, #Black, *Grille\ColSelec)
 OpenWindow(#WinEntrer, WindowX(#Window) + *Grille\PosX, WindowY(#Window) + *Grille\PosY + *Grille\HauteurColonne, *Grille\LargeurColonne, HauteurColonne, "", #PB_Window_BorderLess) 
 StringGadget(#StrEntrer, 0, 0, *Grille\LargeurColonne, HauteurColonne, GetGadgetItemText(#ListIcon, *Grille\LigneSelec - 1, *Grille\ColSelec))
 SetActiveGadget(#StrEntrer)
 StickyWindow(#WinEntrer, #True)
 
 SetGadgetColor(#StrEntrer, #PB_Gadget_BackColor, RGB(178, 177, 169))
 AddKeyboardShortcut(#WinEntrer, #PB_Shortcut_Return, 1)
 AddKeyboardShortcut(#WinEntrer, #PB_Shortcut_Escape, 2) 
 
 GetWindowRect_(WindowID(1), editrect.rect) 
 ClipCursor_(editrect) 
 
 Repeat
  
  ev = WaitWindowEvent() 
  
  If EventWindow() = 1 
   
   Select ev
     
    Case #WM_RBUTTONDOWN
     Grid\PosX = 0
     Grid\PosY = 0
     Break
     
     
    Case #PB_Event_Menu 
     
     If EventMenu() = 1
      SetGadgetItemText(#ListIcon, *Grille\LigneSelec - 1, GetGadgetText(#StrEntrer), *Grille\ColSelec)
      Break
     Else
      Grid\PosX = 0
      Grid\PosY = 0
      Break
     EndIf 
     
   EndSelect 
   
  EndIf    
  
 Until ev = #PB_Event_CloseWindow
 
 If IsWindow(#WinEntrer)
  CloseWindow(#WinEntrer)
 EndIf
 
 ClipCursor_(0)
 
EndProcedure 

Procedure WinCallback(hwnd, msg, wParam, lParam) ; RASHAD
 
 result = #PB_ProcessPureBasicEvents 
 
 Select msg
   
  Case #WM_NOTIFY 
   
   *pnmh.NMHDR = lParam 
   
   Select *pnmh\code
   
    Case #LVN_ODCACHEHINT
    
     result = 0
     
    Case #LVN_GETDISPINFO
    
     *pnmlvdi.NMLVDISPINFO = lParam 
     
     If *pnmlvdi\item\mask & #LVIF_TEXT
      Field$ = StringField(PeekS(@myItems(*pnmlvdi\item\iItem)), *pnmlvdi\item\iSubItem + 1, Chr(10))
      PokeS(*pnmlvdi\item\pszText, Field$)
     EndIf 
     ;
   EndSelect
   
 EndSelect 
 
 ProcedureReturn result 
 
EndProcedure 

Procedure SubClass_LV(hwnd, msg, wparam, lparam) ; NETMAESTRO
 
 Result = CallWindowProc_(Grid\Oldlist, hwnd, msg, wparam, lparam) 
 
 Select msg
   
  Case #WM_LBUTTONDBLCLK
   
   If Grid\PosX And Grid\PosY
    ChampEntree(@Grid)
   Else
    MessageRequester("", "Veuillez séléctionner une case auparavant") 
   EndIf
   
  Case #WM_LBUTTONDOWN
   
   If IsWindow(#WinEntrer)
    CloseWindow(#WinEntrer)
   EndIf
   
   HitInfo.LVHITTESTINFO 
   Hitinfo\pt\x = WindowMouseX(#Window)
   HitInfo\pt\y = WindowMouseY(#Window) 
   SendMessage_(GadgetID(#ListIcon), #LVM_SUBITEMHITTEST, 0, @HitInfo)
   SetGadgetItemColor(#ListIcon, Grid\LigneSelec - 1, #PB_Gadget_BackColor, #White, Grid\ColSelec)
   SetGadgetItemColor(#ListIcon, Grid\LigneSelec - 1, #PB_Gadget_FrontColor, #Black, Grid\ColSelec)
   SetGadgetItemColor(#ListIcon, hitinfo\iitem, #PB_Gadget_BackColor, #Blue, hitinfo\iSubItem)
   SetGadgetItemColor(#ListIcon, hitinfo\iitem, #PB_Gadget_FrontColor, #White, hitinfo\iSubItem)
   
   Grid\PosX = 0
   Grid\PosY = 0
   Grid\LigneSelec = hitinfo\iitem + 1
   Grid\ColSelec = hitinfo\iSubItem
   Grid\LargeurColonne = GetGadgetItemAttribute(#ListIcon, Grid\LigneSelec, #PB_ListIcon_ColumnWidth, Grid\ColSelec)
   Grid\HauteurColonne = GetRowHeight(#ListIcon)
   
   For Lig = 0 To Grid\LigneSelec ; Ligne
    Grid\PosY + GetRowHeight(#ListIcon)
   Next
   
   For Col = 1 To Grid\ColSelec ; Colonne
    Grid\PosX + GetGadgetItemAttribute(#ListIcon, Grid\LigneSelec, #PB_ListIcon_ColumnWidth, Col - 1)
   Next
   
   Grid\PosX + 6
   
 EndSelect
 
 ProcedureReturn Result 
 
EndProcedure 

OpenWindow(#Window, 0, 0, 640, 480, "ListIcon Gadget Mischief: Edit Selected Item", $CF0001) 
ListIconGadget(#ListIcon, 0, 0, 640, 480, "", 0, #PB_ListIcon_GridLines|#LVS_OWNERDATA) 
AddGadgetColumn(#ListIcon, 1, "Column 1", 210) 
AddGadgetColumn(#ListIcon, 2, "Column 2", 210) 
AddGadgetColumn(#ListIcon, 3, "Column 3", 215)

SetWindowCallback(@WinCallback())
SendMessage_(GadgetID(#ListIcon), #LVM_SETITEMCOUNT, #MaxLignes, #LVSICF_NOINVALIDATEALL) ; RASHAD
Grid\Oldlist = SetWindowLong_(GadgetID(#ListIcon), #GWL_WNDPROC, @SubClass_LV()) ; NETMAESTRO

For i=0 To #MaxLignes 
 myItems(i) = Trim(Str(i)) + Chr(10) + "Hello" + Chr(10) + "i'm"  + Chr(10) + "KCC " + Trim(Str(i))
Next i

Repeat 
 ev = WaitWindowEvent()
Until ev = #PB_Event_CloseWindow
If you have a way for maried this two codes for the life, Kcc are very happy :D

Have a good day
Last edited by Kwai chang caine on Mon Sep 26, 2016 10:40 am, edited 1 time in total.
ImageThe happiness is a road...
Not a destination
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: ListIcon Fast and Furiously editable

Post by Thunder93 »

Hi Kwai chang caine.

It's the way you've customized it.

On the x64 PB, I receive ' Invalid memory access '. The faulting line shows CallWindowProc_().

Fix your structure to have Oldlist use integer type instead of long. It'll work then for both 32 and 64.... It should :lol:
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: ListIcon Fast and Furiously editable

Post by Kwai chang caine »

Hello Thunder93
It's strange.. SROD use the default type of variable, so in PB it's long no ?

Original code of SROD

Code: Select all

#LVM_SUBITEMHITTEST = #LVM_FIRST + 57 
Global oldlist,lv 
Last edited by Kwai chang caine on Tue Sep 20, 2016 1:30 pm, edited 2 times in total.
ImageThe happiness is a road...
Not a destination
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: ListIcon Fast and Furiously editable

Post by Thunder93 »

No... when no type is provided, it'll default to integer.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: ListIcon Fast and Furiously editable

Post by Kwai chang caine »

Aaaah !!! thanks, i don't know that :shock:
I don't know why, but i have memorised the contrary they are 10 years when i begin PB :oops:
ImageThe happiness is a road...
Not a destination
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: ListIcon Fast and Furiously editable

Post by Thunder93 »

Code: Select all

Global oldlist

Debug TypeOf(oldlist)
Debug #PB_Integer

produces;

21
21
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: ListIcon Fast and Furiously editable

Post by Kwai chang caine »

Ok ..thanks again, i fix that 8)

I have see something :shock:
In fact the second code works...but it is very slow to show the editable string the first time :?
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: ListIcon Fast and Furiously editable

Post by Kwai chang caine »

No false alert...
The second code works...and it is very slow to show the editable string the first time if you not scroll
And if you scroll, after that not works :(
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: ListIcon Fast and Furiously editable

Post by Kwai chang caine »

I use a VIRTUAL Listicon and i believe all the problem is in the "VIRTUAL" word :oops:
http://www.purebasic.fr/english/viewtop ... 16#p110116
In fact this RASHAD ListIcon is the contrary of WYSIWYG ....but WYSINWYH...What You See Is Not What You Have :mrgreen:
ImageThe happiness is a road...
Not a destination
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: ListIcon Fast and Furiously editable

Post by RASHAD »

Hi KCC
With Virtual ListIcon you do not deal with the ListIcon but with the dynamic array
in your case myItems.s(#MaxLignes)
So you read from it and write to it using PeekS & PokeS
You can start from here

Code: Select all

; http://forum.purebasic.com/english/viewtopic.php?p=161560&sid=1ae821fb59eee6783c37324226c924e3#p161560

Enumeration
 #Window
 #WinEntrer
 #ListIcon
 #StrEntrer
EndEnumeration

Structure ListIcon
 PosX.i
 PosY.i
 ColSelec.i
 LigneSelec.i
 LargeurColonne.i
 HauteurColonne.i
 Oldlist.l
EndStructure

#LVSICF_NOINVALIDATEALL = 1
#LVN_ODCACHEHINT = #LVN_FIRST - 13
#LVM_SUBITEMHITTEST = #LVM_FIRST + 57
#MaxLignes = 350000

Global Grid.ListIcon
Global Dim myItems.s(#MaxLignes)

Procedure.I GetRowHeight(ListIconID.I) ; SROD
 
 rc.rect\left = #LVIR_BOUNDS
 SendMessage_(GadgetID(ListIconID), #LVM_GETITEMRECT, 0, rc)
 height = rc\bottom - rc\top
 ProcedureReturn height
 
EndProcedure

Procedure.s ChampEntree(*Grille.ListIcon)
 
 If *Grille\HauteurColonne < 20
  HauteurColonne = 18
 Else
  HauteurColonne = *Grille\HauteurColonne
 EndIf
 
 SetGadgetItemColor(#ListIcon, *Grille\LigneSelec - 1, #PB_Gadget_BackColor, #White, *Grille\ColSelec)
 SetGadgetItemColor(#ListIcon, *Grille\LigneSelec - 1, #PB_Gadget_FrontColor, #Black, *Grille\ColSelec)
 OpenWindow(#WinEntrer, WindowX(#Window) + *Grille\PosX, WindowY(#Window) + *Grille\PosY + *Grille\HauteurColonne, *Grille\LargeurColonne, HauteurColonne, "", #PB_Window_BorderLess)
 StringGadget(#StrEntrer, 0, 0, *Grille\LargeurColonne, HauteurColonne, GetGadgetItemText(#ListIcon, *Grille\LigneSelec - 1, *Grille\ColSelec))
 SetActiveGadget(#StrEntrer)
 StickyWindow(#WinEntrer, #True)
 
 SetGadgetColor(#StrEntrer, #PB_Gadget_BackColor, RGB(178, 177, 169))
 AddKeyboardShortcut(#WinEntrer, #PB_Shortcut_Return, 1)
 AddKeyboardShortcut(#WinEntrer, #PB_Shortcut_Escape, 2)
 
 GetWindowRect_(WindowID(1), editrect.rect)
 ClipCursor_(editrect)
 
 Repeat
 
  ev = WaitWindowEvent()
 
  If EventWindow() = 1
   
   Select ev
     
    Case #WM_RBUTTONDOWN
     Grid\PosX = 0
     Grid\PosY = 0
     Break
     
     
    Case #PB_Event_Menu
     
     If EventMenu() = 1
      SetGadgetItemText(#ListIcon, *Grille\LigneSelec - 1, GetGadgetText(#StrEntrer), *Grille\ColSelec)
      Break
     Else
      Grid\PosX = 0
      Grid\PosY = 0
      Break
     EndIf
     
   EndSelect
   
  EndIf   
 
 Until ev = #PB_Event_CloseWindow
 
 If IsWindow(#WinEntrer)
  CloseWindow(#WinEntrer)
 EndIf
 
 ClipCursor_(0)
 
EndProcedure

Procedure WinCallback(hwnd, msg, wParam, lParam) ; RASHAD
 
 result = #PB_ProcessPureBasicEvents
 
 Select msg
   
  Case #WM_NOTIFY
   
   *pnmh.NMHDR = lParam
   
   Select *pnmh\code
   
    Case #LVN_ODCACHEHINT
   
     result = 0
     
    Case #LVN_GETDISPINFO
   
     *pnmlvdi.NMLVDISPINFO = lParam
     
     If *pnmlvdi\item\mask & #LVIF_TEXT
      Field$ = StringField(PeekS(@myItems(*pnmlvdi\item\iItem)), *pnmlvdi\item\iSubItem + 1, Chr(10))
      PokeS(*pnmlvdi\item\pszText, Field$)
     EndIf
     ;
   EndSelect
   
 EndSelect
 
 ProcedureReturn result
 
EndProcedure

Procedure SubClass_LV(hwnd, msg, wparam, lparam) ; NETMAESTRO
 
 Result = CallWindowProc_(Grid\Oldlist, hwnd, msg, wparam, lparam)
 
 Select msg   
   
  Case #WM_LBUTTONDOWN 
   HitInfo.LVHITTESTINFO
   Hitinfo\pt\x = WindowMouseX(#Window)
   HitInfo\pt\y = WindowMouseY(#Window)
   SendMessage_(GadgetID(#ListIcon), #LVM_SUBITEMHITTEST, 0, @HitInfo)
   Debug hitinfo\iItem
   Debug hitinfo\iSubItem
   Debug StringField(myItems(hitinfo\iItem),hitinfo\iSubItem+1,Chr(10))
   
 EndSelect
 
 ProcedureReturn Result
 
EndProcedure

OpenWindow(#Window, 0, 0, 640, 480, "ListIcon Gadget Mischief: Edit Selected Item", $CF0001)
ListIconGadget(#ListIcon, 0, 0, 640, 480, "", 0, #PB_ListIcon_GridLines|#LVS_OWNERDATA)
AddGadgetColumn(#ListIcon, 1, "Column 1", 210)
AddGadgetColumn(#ListIcon, 2, "Column 2", 210)
AddGadgetColumn(#ListIcon, 3, "Column 3", 215)

SetWindowCallback(@WinCallback())
SendMessage_(GadgetID(#ListIcon), #LVM_SETITEMCOUNT, #MaxLignes, #LVSICF_NOINVALIDATEALL) ; RASHAD
Grid\Oldlist = SetWindowLong_(GadgetID(#ListIcon), #GWL_WNDPROC, @SubClass_LV()) ; NETMAESTRO

For i=0 To #MaxLignes
 myItems(i) = Trim(Str(i)) + Chr(10) + "Hello" + Chr(10) + "i'm"  + Chr(10) + "KCC " + Trim(Str(i))
Next i

Repeat
 ev = WaitWindowEvent()
Until ev = #PB_Event_CloseWindow

Egypt my love
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: ListIcon Fast and Furiously editable

Post by Kwai chang caine »

Thanks a lot RASHAD 8)
I'm on smartphone, i test your code tommorow
Have a very good day
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: ListIcon Fast and Furiously editable

Post by Kwai chang caine »

First thing.... i test when i'm behind my PC 8)

Yeeees !!!! it's ROYAL
Image
I have understand now...i must talking to the array and forgot one time for all, the ListIcon

It's difficult to believe it's a ListIcon, but it's not really a ListIcon :?
In fact, a little bit like KCC, it's a programmer...but it's not really a programmer :mrgreen:

Thanks a lot for your precious help
Have a very good day my pyramidal friend 8)
ImageThe happiness is a road...
Not a destination
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: ListIcon Fast and Furiously editable

Post by yrreti »

Boy Kwai chang caine, you always have the craziest emolies etc! ha ha
The only one other one that I miss some times, is NETMAESTRO's smiling frog with the teeth.
User avatar
blueb
Addict
Addict
Posts: 1111
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: ListIcon Fast and Furiously editable

Post by blueb »

yrreti wrote:...The only one other one that I miss some times, is NETMAESTRO's smiling frog with the teeth.
I think we should ask netmaestro to blend his photo to have smiling teeth (like the frog did) :)
- It was too lonely at the top.

System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: ListIcon Fast and Furiously editable

Post by IdeasVacuum »

WYSINWYH :mrgreen:
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply