thank you
now i have to look to receive the coords of each listiconfield
Moderator: gnozal


I am afraid that is not going to happen, as these libraries do not "ownerdraw" the listicon like pb does.IdeasVacuum wrote:...
So, could we have:
PureCOLOR_SetGadgetLineColor(#MyListIcon,RGB(127,157,185))
or:
PureLVSORT_LineColor(#MyListIcon,RGB(127,157,185))
The default MS Windows line colour is almost impossible to see (for some of us at least)
Code: Select all
;
; List
EnableExplicit
Enumeration ;window
  #win
EndEnumeration
Enumeration ;gadgets
  #b_Get
  #b_Quit
  #Li  
EndEnumeration
Enumeration ;shortcuts menu
  #sk_down
  #sk_up
  
EndEnumeration
Global.l celly, cellx, cellheight, celltop, cellleft, cellmaxrow, celledited, celleditmode
Global.s celltextedit, celltext
Procedure LvFilterCallback(LV.l, Filterstring.s, Column.l, Event.l) ; simple search example
  Protected itemNumber.l, I.l
  If Filterstring
    itemNumber = -1
    If IsGadget(LV)
      For I = 0 To CountGadgetItems(LV) - 1 
        If FindString(UCase(GetGadgetItemText(LV, I, Column)), UCase(FilterString),0) 
          itemNumber = I
          Break
        EndIf
      Next 
      If itemNumber <> -1 ; if string found, scroll to row
        PureLVSORT_ScrollToRow(LV, itemNumber)
        PureCOLOR_SetCellColor(LV, itemnumber,Column,#Blue,$FFDEAD)
      EndIf
    EndIf
  EndIf
EndProcedure
Procedure.l LvEditCallback(Event.l, ListIconNumber.l, Column.l, Row.l, Text.s)
  Select Event
    Case #PureLVSORT_EditStart
      Debug "Edit Start"
      celltext=GetGadgetItemText(ListIconNumber,row,column)
      Debug "edt_start :"+celltext
      celleditmode=1
      ; Return  :	- 0 to enable stringgadget (default)
      ; 		- *string to enable a spingadget [the string holds the choice items (separator = '|']
    Case #PureLVSORT_EditText
      Debug "Edit Text"
      celltextedit=text
      celledited+1
      Debug "edt_edit :"+celltextedit
      ;Debug "im callback "+celltextedit
      ;         ; Return  :	- 0 to keep the text (default)
      ;         ; 		- *string to change the text [the string holds the changed text]
    Case #PureLVSORT_EditEnd
      Debug "Edit End"
      If celledited
        If celltext<>celltextedit
          Debug "-----------------"
          Debug "     down before :"+celltext
          Debug "     down after:"+celltextedit
          Debug "     Ok can be written"
          Debug "-----------------"
        EndIf
        
        celledited=0
        celltextedit=""
        celltext=""
        celleditmode=0
      EndIf
      
    Case #PureLVSORT_EditEscape
      Debug "Edit ESC"
      celleditmode=0
  EndSelect
EndProcedure
Procedure reload()
  Define cols=5,c, r, rows=10 , i , tmp.s, out.s
  HideGadget(#Li,1)
  ClearGadgetItems(#Li)
  
  While GetGadgetItemText(#Li, -1); , 0)
    RemoveGadgetColumn(#Li,0)
  Wend
  RemoveGadgetColumn(#Li,0)
  
  For c=0 To cols
    tmp="Column "+Str(c)
    AddGadgetColumn(#li,c,tmp,20)
  Next c
  tmp=""
  
  For r=0 To rows
    For c=0 To cols
      For i=1 To 5
        tmp+Chr(Random(25)+97)
      Next i
      out+tmp+Chr(10)
      tmp=""
    Next c
    AddGadgetItem(#Li,-1,out)
    out=""
  Next r
  
  PureLVSORT_SelectGadgetToSort(#Li,#PureLVSORT_ShowClickedHeader_No)
  PureLVSORT_DefineFilterCallback(@LvFilterCallback())
  PureLVSORT_SetFilterTimeOut(100)
  PureLVSORT_SetFilter(#Li)
  
  For c=0 To 10
    PureLVSORT_SetColumnWidth(#Li,c,#PureLVSORT_UseHeader)
  Next c
  
  PureLVSORT_SetFilter(#Li)
  
  PureLVSORT_SetFilterTimeOut(25)
  PureLVSORT_DefineFilterCallback(@LvFilterCallback())
  For c=0 To 10-1
    PureLVSORT_MakeColumnEditable(#Li,c,#True)
  Next c
  
  PureLVSORT_SetEditingCallback(@LvEditCallback())
  PureLVSORT_SetEditingColors(RGB(255,222,192),#PureCOLOR_SystemColor)
  HideGadget(#Li,0)
  cellmaxrow=CountGadgetItems(#Li)-1
EndProcedure
Procedure LvMouseClick(GId.i, *vP.Point)
  
  Define vID=GadgetID(GId)
  
  Protected pLVH.LVHITTESTINFO
  
  GetCursorPos_   (*vP)  ;wo ist Maus 
  MapWindowPoints_(0, vID, *vP, 1)
  pLVH\pt\x = *vP\x
  pLVH\pt\y = *vP\y
  SendMessage_(vID, #LVM_SUBITEMHITTEST, 0, pLVH)                
  *vP\y = pLVH\iItem      ;row ab 0
  *vP\x = pLVH\iSubItem   ;col ab 0
  celly=*vP\y
  cellx=*vP\x
  ; --- Ergänzung
  Protected rec.RECT , i
  SendMessage_(vid, #LVM_GETSUBITEMRECT, *vp\y, rec)
  rec\left=0
  rec\right=rec\left+GetGadgetItemAttribute(GId,-1,#PB_ListIcon_ColumnWidth,0)
  If *vP\x >0
    For i=1 To *vP\x
      rec\left+GetGadgetItemAttribute(GId,-1,#PB_ListIcon_ColumnWidth, i-1)
      rec\right=rec\left+GetGadgetItemAttribute(GId,-1,#PB_ListIcon_ColumnWidth,i)
    Next
  EndIf
  
  cellheight= rec\bottom-rec\top
  celltop  = rec\top+1
  cellleft = rec\left+1
EndProcedure
ExamineDesktops()
;window, gadgets
Define.l dw=DesktopWidth(0)
Define.l dh=DesktopHeight(0)
Define.l wx,ww,wy,wh
Define.l c
Define p.Point
;events
Define.l event,eventtype,gadget,Menu
Define.l quit
ww=500
wh=500
wx=100;dw/2-ww/2
wy=100;dh/2-wh/2
OpenWindow(#win,wx,wy,ww,wh,"Schaumerma",#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget)
ButtonGadget(#b_Get,0,0,50,20,"reload")
ListIconGadget(#Li,0,20,ww,wh-20,"this",20,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
HideGadget(#Li,1)
AddKeyboardShortcut(#Win,#PB_Shortcut_Down,#sk_down)
AddKeyboardShortcut(#Win,#PB_Shortcut_Up,#sk_up)
reload()
Define.s Info.s= "Enter Editingmode by doubleclicking (L) one field."+#CRLF$
Info+"Typing on the keyboard will change the TEXT in the Callback accordingly"+#CRLF$
Info+"Only DEL has some kind of ''delay''"+#CRLF$+#CRLF$
Info+" Run in IDE with debug on"
MessageRequester("",Info)
Repeat
  event=WaitWindowEvent()
  eventtype=EventType()
  menu=EventMenu()
  gadget=EventGadget()
  
  Select event
      
    Case #PB_Event_Gadget
      Select gadget
        Case #b_get
          reload()
        Case #Li
          Select eventtype
            Case #PB_EventType_LeftDoubleClick
              LvMouseClick(#Li, p)
              Debug "Mouse celltop "+Str(celltop)
              Debug "Mouse cellheight "+Str(cellheight)
              Debug "Mouse Col "+Str(cellx)
              Debug "Mouse Row "+Str(celly)
              
          EndSelect
      EndSelect
      
    Case #PB_Event_Menu
      
      Select menu
        Case #sk_down
          ;one down
          If celleditmode
            If celledited
              If celltext<>celltextedit
                Debug "-----------------"
                Debug "     down before :"+celltext
                Debug "     down after:"+celltextedit
                Debug "     Ok can be written"
                Debug "-----------------"
              EndIf
              
              celledited=0
              celltextedit=""
              celltext=""
            EndIf
            If celly <= cellmaxrow-1  
              celltop+cellheight
              celly+1
              Debug "celltop "+Str(celltop)+" cellheight "+Str(cellheight)+" Col "+Str(cellx)+" Row "+Str(celly)
              PostMessage_(GadgetID(#Li), #WM_LBUTTONDBLCLK, 0, cellleft| (celltop <<16)) ;<---- double click on x = 12 y = 42 (mouse coordinates)
              
            EndIf
          EndIf
        Case #sk_up
          ;up one up
          If celleditmode
            If celledited
              If celltext<>celltextedit
                Debug "-----------------"
                Debug "     down before :"+celltext
                Debug "     down after:"+celltextedit
                Debug "     Ok can be written"
                Debug "-----------------"
              EndIf
              celledited=0
              celltextedit=""
              celltext=""
            EndIf
            
            If celly >=0+1
              
              celltop-cellheight
              celly-1
              Debug "celltop "+Str(celltop)+" cellheight "+Str(cellheight)+" Col "+Str(cellx)+" Row "+Str(celly)
              
              PostMessage_(GadgetID(#Li), #WM_LBUTTONDBLCLK, 0, cellleft| (celltop <<16)) ;<---- double click on x = 12 y = 42 (mouse coordinates)
            EndIf
          EndIf
          
      EndSelect
      
    Case #PB_Event_CloseWindow
      quit+1
  EndSelect
  
Until quit
End

Hi,bobobo wrote:there is on eissue concerning the editingmode.
Maybe a kind of bug.

Anybody?karu wrote:Hi, can some tell me, how i can select whole text in cell after i double clicked on it, if i use PureLVSORT_MakeColumnEditable function.
Thanks
Karu
https://www.rsbasic.de/backups/,Hey AMpos,take a look at this. But it seems doesn't work on PB5.7+AMpos wrote:I need this librarybut it seems the server is gone...
![]()
Does some one has it? Would it work in current PB version?