Deutsch   English   Français   Italiano  
<105b76q$1en1e$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: nntp.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Mark Summerfield <m.n.summerfield@gmail.com>
Newsgroups: comp.lang.tcl
Subject: Re: how to style one particular treeview
Date: Thu, 17 Jul 2025 16:08:58 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <105b76q$1en1e$1@dont-email.me>
References: <105a95j$17qfs$1@dont-email.me>
	<20250717123645.89b79352c1642ecf847362e5@example.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 17 Jul 2025 18:08:59 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="aa16a58a18cc1cb3d82dbc5415f4f1ef";
	logging-data="1530926"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19GbuWnTKm2c8Ofqs+9c+uv"
User-Agent: Pan/0.154 (Izium; 517acf4)
Cancel-Lock: sha1:lWTFxra1BHwbRE+rVgFfhNs2ZH0=

On Thu, 17 Jul 2025 12:36:45 -0300, Emiliano wrote:

> On Thu, 17 Jul 2025 07:36:19 -0000 (UTC)
> Mark Summerfield <m.n.summerfield@gmail.com> wrote:
> 
>> I am using one particular ttk::treeview as a listbox:
>> 
>>     ttk::frame .ignoresForm.ignoresListFrame
>>     set ignoresList [ttk::treeview \
>>         .ignoresForm.ignoresListFrame.ignoresList -striped true \
>>         -yscrollcommand {.ignoresForm.ignoresListFrame.scrolly set}]
>>     ttk::style configure List.Treeview -indent 0
>>     #ttk::style map List.Treeview -indent [list disabled 0 active 0]
>>     $ignoresList configure -show tree -selectmode browse \
>>         -style List.Treeview
>>     $ignoresList column #0 -anchor w -stretch true
>>     ttk::scrollbar .ignoresForm.ignoresListFrame.scrolly -orient vertical \
>>         -command {.ignoresForm.ignoresListFrame.ignoresList yview}
>> 
>> By default a ttk::treeview has an -indent of 20 pixels which makes sense
>> for trees but is not needed for lists.
>> 
>> In the code above I've tried to create a custom style to apply to one
>> treeview but it has no effect whether I use ttk::style configure or 
>> ttk::style map.
>> 
>> What is the correct way to do this?
> 
> Use
> 
> ttk::style configure List.Treeview.Item -indicatorsize 0
> 
> to suppress the space reserved for the open/close indicator. This might be ignored on Win/Mac with native themes.
> 
> 
> Regards

Thank you Emiliano, that worked great!

I used:

    ttk::frame .ignoresForm.ignoresListFrame
    set ignoresList [ttk::treeview \
        .ignoresForm.ignoresListFrame.ignoresList -striped true \
        -yscrollcommand {.ignoresForm.ignoresListFrame.scrolly set}]
    ttk::style configure List.Treeview.Item -indicatorsize 0
    $ignoresList configure -show tree -selectmode browse \
        -style List.Treeview
    $ignoresList column #0 -anchor w -stretch true
    ttk::scrollbar .ignoresForm.ignoresListFrame.scrolly -orient vertical \
        -command {.ignoresForm.ignoresListFrame.ignoresList yview}