Listicongadget and clicking on it

Just starting out? Need help? Post your questions and find answers here.
karu
Posts: 40
Joined: Mon Feb 24, 2014 10:16 pm

Listicongadget and clicking on it

Post 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
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Listicongadget and clicking on it

Post 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
karu
Posts: 40
Joined: Mon Feb 24, 2014 10:16 pm

Re: Listicongadget and clicking on it

Post by karu »

Thanks
User avatar
Kurzer
Posts: 90
Joined: Mon May 26, 2014 9:33 am

Re: Listicongadget and clicking on it

Post 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
SB 2.32 x86, Browser: Iron Portable V. 88.0.4500.0 (Chromium based), User age in 2023: 55y
"Happiness is a pet." | "Never run a changing system!"
User avatar
Kurzer
Posts: 90
Joined: Mon May 26, 2014 9:33 am

Re: Listicongadget and clicking on it

Post 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
SB 2.32 x86, Browser: Iron Portable V. 88.0.4500.0 (Chromium based), User age in 2023: 55y
"Happiness is a pet." | "Never run a changing system!"
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Listicongadget and clicking on it

Post 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
User avatar
Kurzer
Posts: 90
Joined: Mon May 26, 2014 9:33 am

Re: Listicongadget and clicking on it

Post by Kurzer »

Peter! YEEEEEEESSSS! Thank you. :D

Image
SB 2.32 x86, Browser: Iron Portable V. 88.0.4500.0 (Chromium based), User age in 2023: 55y
"Happiness is a pet." | "Never run a changing system!"
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Listicongadget and clicking on it

Post 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.
User avatar
Kurzer
Posts: 90
Joined: Mon May 26, 2014 9:33 am

Re: Listicongadget and clicking on it

Post 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
SB 2.32 x86, Browser: Iron Portable V. 88.0.4500.0 (Chromium based), User age in 2023: 55y
"Happiness is a pet." | "Never run a changing system!"
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Listicongadget and clicking on it

Post by Peter »

kurzer wrote:After some research I found out that the following code resets the headerheight.
Fixed. Should work now.
Post Reply