Page 1 of 2

Listicongadget and clicking on it

Posted: Tue Oct 31, 2017 8:45 am
by karu
Can anyone tell me, how i can detect clicks on listicongadget cell, also on column header?
I have to know in witch column click was made and in what column header click was made.

Thanks
Karu

Re: Listicongadget and clicking on it

Posted: Tue Oct 31, 2017 12:29 pm
by Peter
you can use BindCellClick() from my ListIconGadgetEx-Module: https://github.com/spiderbytes/ListIconGadgetEx

Example:

Code: Select all

IncludeFile "ListIconGadgetEx.sbi"

EnableExplicit

Enumeration
  #Window
  #ListIconGadget
EndEnumeration

Procedure CellClick(ListIconGadget, Column, Row)
  
  Debug "CellClick():"
  Debug "Column: " + Str(Column)
  
  If Row = -1
    Debug "Row: Header"
  Else
    Debug "Row: " + Str(Row)
  EndIf
  
  Debug "------------------"
  
EndProcedure

OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 800, 800, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListIconGadget(#ListIconGadget, 0, 0, 800, 800, "Name", 300, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(#ListIconGadget, 1, "Address", 400)

ListIconGadgetEx::SetOddRowColor ("lightgreen", "darkgreen", "black", "white")
ListIconGadgetEx::SetEvenRowColor("white", "lightblue", "black", "black")

ListIconGadgetEx::SetRowHeight(#ListIconGadget, 36)
ListIconGadgetEx::BindCellClick(#ListIconGadget, @CellClick())


Define Counter

For Counter = 0 To 9
  AddGadgetItem(#ListIconGadget, -1, "Name" + Counter + #LF$ + "Address" + Counter)
Next
Greetings ... Peter

Re: Listicongadget and clicking on it

Posted: Mon Nov 06, 2017 12:50 pm
by karu
Thanks

Re: Listicongadget and clicking on it

Posted: Sun Oct 18, 2020 2:39 pm
by Kurzer
Hello, Peter,
I just stumbled over your handy ListIconGadgetEx module and I can use it right now. Many thanks for it! Image

A short question: There is no function UnBindCellClick() in the module. Is it not necessary or did you just not add it?

Markus

Re: Listicongadget and clicking on it

Posted: Fri Oct 23, 2020 8:06 pm
by Kurzer
Peter,
can you tell me what I need to change in your module to also provide the header with the new Rowheight?
Currently only the rows below are adjusted in height.

Code: Select all

  Procedure SetRowHeight(ListIconGadget, RowHeight)
    
    GetGrid
    
    ! spider.DojoAspect.after( grid, 'renderRow', function( row, args ) {
    !		var div = $(row).find("td.dgrid-cell").find("div").find("div");
    ! 	div.css('height', v_rowheight + 'px');
    ! 	div.css('line-height', v_rowheight + 'px');
    ! 	return row;
    ! });	
    
  EndProcedure
Image

I tried to include a padding-top padding-bottom in the class dgrid-header, but the data rows below are not moved further down.

:oops: Unfortunately, I still don't have the time to learn more about this topic. I really hope that Fred decides to implement a good web GUI library. The many small JS adjustments you have to make manually on gadgets and the program interface under Spiderbasic to make it look more or less presentable are... how do you say in english? A pain in the ass.

Greetings Markus

Re: Listicongadget and clicking on it

Posted: Sat Oct 24, 2020 1:57 pm
by Peter
kurzer wrote:UnBindCellClick()
kurzer wrote:provide the header with the new Rowheight
Added: UnbindCellClick(ListIconGadget)
Added: SetHeaderHeight(ListIconGadget, HeaderHeight)

:arrow: https://github.com/spiderbytes/ListIconGadgetEx

Greetings ... Peter

Re: Listicongadget and clicking on it

Posted: Sat Oct 24, 2020 5:08 pm
by Kurzer
Peter! YEEEEEEESSSS! Thank you. :D

Image

Re: Listicongadget and clicking on it

Posted: Sat Oct 24, 2020 5:18 pm
by Peter
:lol: you're welcome.

I have just uploaded a new version with an experimental sorting functionality. You are invited to try it out.

Re: Listicongadget and clicking on it

Posted: Sat Oct 24, 2020 6:36 pm
by Kurzer
For your information:

I was happy a bit too early, because in my project your HeaderHeight extension just did not work.
After some research I found out that the following code resets the headerheight. The height of the data rows below is not affected.

Code: Select all

SetGadgetItemAttribute(#ListIconGadget3, 0, #PB_ListIcon_ColumnWidth, 100, 1)
At the moment I just change the header height every time I change the column width. This works quite well.

Markus

Re: Listicongadget and clicking on it

Posted: Sat Oct 24, 2020 11:00 pm
by Peter
kurzer wrote:After some research I found out that the following code resets the headerheight.
Fixed. Should work now.