Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tablelist hide rows

44 views
Skip to first unread message

Nicolas Robert

unread,
Dec 10, 2017, 5:14:45 AM12/10/17
to
hello ,

I meet this problem when I hide my rows, the time of answer of my interface is very slow , my CPU is full and It does not decrease any more.
I have two tabs , the first tab contains the hidden rows and the second the full rows ,There is a big difference of performance between both.
The only way to decrease my processor it is to juggle between 2 tabs... or delete all rows and insert my filtered list

My code below :

# ---------------------------------------------
package require tablelist

proc _insertlist_ {num tbl} {

$tbl insertlist end \
[lrepeat 1400 "N$num col$num col$num col$num col$num col$num col$num col$num col$num col$num col$num col$num"]

}

proc _show_ {num tbl} {

set malist {}

foreach val [$tbl getkeys 0 end] {
if {[$tbl getcells $val,0] eq "N$num"} {
lappend malist $val -hide 0
} else {
lappend malist $val -hide 1
}
}

$tbl configrowlist $malist

}

proc _init_ {tbl} {

set malist {}

foreach val [$tbl getkeys 0 end] {
lappend malist $val -hide 0
}

$tbl configrowlist $malist

}

proc popup {win argX argY} {
tk_popup .mn_onglet $argX $argY
}

proc _tablelist_ {} {

pack [ttk::notebook .nc] -fill both -expand 1

set db .db
set db1 .db1
set toolbar $db.toolbar
frame $db
frame $db1
frame $toolbar

set tbl $db.tree
set tbl1 $db1.tree1
set vsb $db.vsb
set vsb1 $db1.vsb1
set hsb $db.hsb
set hsb1 $db1.hsb1


set m $toolbar.m

menubutton $m -menu $m.menu -text "Show..." -relief solid
menu $m.menu -tearoff 0

tablelist::tablelist $tbl -columns { 0 "1" center 0 "2" 0 "3" 0 "4" 0 "5" 0 "6" 0 "7" 0 "8" 0 "9" 0 "10" 0 "11" 0 "12"} \
-xscrollcommand [list $hsb set] -yscrollcommand [list $vsb set] -stretch all -stripebg #f0f0f0

ttk::scrollbar $vsb -orient vertical -command [list $tbl yview]
ttk::scrollbar $hsb -orient horizontal -command [list $tbl xview]

grid $toolbar -row 0 -column 0 -sticky news
grid $m -row 1 -column 0 -sticky n
grid $tbl -row 1 -rowspan 2 -column 0 -sticky news
grid $vsb -row 1 -rowspan 2 -column 1 -sticky ns
grid $hsb -row 2 -column 0 -sticky ew

grid rowconfigure $db 1 -weight 1
grid columnconfigure $db 0 -weight 1

tablelist::tablelist $tbl1 -columns { 0 "1" center 0 "2" 0 "3" 0 "4" 0 "5" 0 "6" 0 "7" 0 "8" 0 "9" 0 "10" 0 "11" 0 "12"} \
-xscrollcommand [list $hsb1 set] -yscrollcommand [list $vsb1 set] -stretch all -stripebg #f0f0f0

ttk::scrollbar $vsb1 -orient vertical -command [list $tbl1 yview]
ttk::scrollbar $hsb1 -orient horizontal -command [list $tbl1 xview]

grid $tbl1 -row 1 -rowspan 1 -column 0 -sticky news
grid $vsb1 -row 0 -rowspan 2 -column 1 -sticky ns
grid $hsb1 -row 2 -column 0 -sticky ew
grid rowconfigure $db1 1 -weight 1
grid columnconfigure $db1 0 -weight 1

.nc add $db -text "Tablelist 1"
.nc add $db1 -text "Tablelist 2"

menu .mn_onglet -tearoff 0

.mn_onglet add command -label "> 1" -command {catch {destroy .w1} ; toplevel .w1 ; focus -force .w1}
.mn_onglet add command -label "> 2" -command {catch {destroy .w1} ; toplevel .w1 ; focus -force .w1}
.mn_onglet add command -label "> 3" -command {catch {destroy .w1} ; toplevel .w1 ; focus -force .w1}


for {set i 1} {$i < 20} {incr i} {
$m.menu add command -label "Show N$i" -command [list _show_ $i $tbl]
_insertlist_ $i $tbl
_insertlist_ $i $tbl1
}

$m.menu add command -label "Init..." -command [list _init_ $tbl]

_show_ 2 $tbl

}

_tablelist_
wm geometry . 800x500

nemethi

unread,
Dec 10, 2017, 11:18:43 AM12/10/17
to
Your tablelist widgets have 26600 rows each. When performing "Show
N<num>", Tablelist invokes "tag add|remove ..." 2 * 1400 times for a
text widget tag having "-elide 1", along with some internal
housekeeping. As a result, only 1400 of the total of 26600 rows will be
visible. I don't know why this is so CPU-intensive, but IMHO it is not
the best idea to have a tablelist widget in which only 1/19th of the
rows are kept visible. The alternative of deleting all rows and
inserting only the 1400 items to show, mentioned in your posting,
appears to be much more efficient.

--
Csaba Nemethi http://www.nemethi.de mailto:csaba....@t-online.de

Nicolas Robert

unread,
Dec 10, 2017, 12:56:38 PM12/10/17
to
> Your tablelist widgets have 26600 rows each. When performing "Show
> N<num>", Tablelist invokes "tag add|remove ..." 2 * 1400 times for a
> text widget tag having "-elide 1", along with some internal
> housekeeping. As a result, only 1400 of the total of 26600 rows will be
> visible. I don't know why this is so CPU-intensive, but IMHO it is not
> the best idea to have a tablelist widget in which only 1/19th of the
> rows are kept visible. The alternative of deleting all rows and
> inserting only the 1400 items to show, mentioned in your posting,
> appears to be much more efficient.
>
> --

Thanks for the response Csaba.
The -hide command is the only way that i found for filter a row in particular.
I don't look the performance when I filter , but thank you for the advice.
my problem it is just 25200 rows which are hidden, and that's why my CPU is full
0 new messages