Tk Source Code

Check-in [ce7ce2f5]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Addressed question 2 (see artifact [9d48a9c212] of ticket [3f456a5bb9]). This code arranges for the correct xview when creating the listbox with non-default justification. It is correctly placed in Tk_ListboxObjCmd. When changing justification later, i.e. in ConfigureListbox, there is no reason to change the xview, it would not be desired that the listbox xview jumps when configuring -justify.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tip-441
Files: files | file ages | folders
SHA1: ce7ce2f5a6364ffdc2fdb4ea82f38f0b7e1d2ce7
User & Date: fvogel 2016-01-16 14:03:32
Original Comment: Addressed question 2 (see artifact [9d48a9c212] of ticket [3f456a5bb9])
Context
2016-01-16
14:16
Addressed issue A and question 6 (see artifact [9d48a9c212] of ticket [3f456a5bb9]).

Issue A is fixed. Test case: package req Tk listbox .l .l insert end M M M M M M M M M pack .l .l conf -just center ; # or right .l conf -highlightthickness 40 .l selection set 4

Regarding question 6, Tk_TextWidth is a bit lower level function in the API, which must be slightly beneficial regarding performance. Tk_TextWidth is therefore preferred. check-in: bfbd8ae6 user: fvogel tags: tip-441

14:03
Addressed question 2 (see artifact [9d48a9c212] of ticket [3f456a5bb9]). This code arranges for the correct xview when creating the listbox with non-default justification. It is correctly placed in Tk_ListboxObjCmd. When changing justification later, i.e. in ConfigureListbox, there is no reason to change the xview, it would not be desired that the listbox xview jumps when configuring -justify. check-in: ce7ce2f5 user: fvogel tags: tip-441
14:00
Addressed question 1 (see artifact [9d48a9c212] of ticket [3f456a5bb9]) check-in: e85c0d6b user: fvogel tags: tip-441
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkListbox.c.

577
578
579
580
581
582
583




584
585
586
587
588
589
590
    }

    if (ConfigureListbox(interp, listPtr, objc-2, objv+2) != TCL_OK) {
	Tk_DestroyWindow(listPtr->tkwin);
	return TCL_ERROR;
    }





    if (listPtr->justify == TK_JUSTIFY_RIGHT) {
        listPtr->xOffset = GetMaxOffset(listPtr);
    } else if (listPtr->justify == TK_JUSTIFY_CENTER) {
        listPtr->xOffset = GetMaxOffset(listPtr) / 2;
        listPtr->xOffset -= listPtr->xOffset % listPtr->xScrollUnit;
    }







>
>
>
>







577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
    }

    if (ConfigureListbox(interp, listPtr, objc-2, objv+2) != TCL_OK) {
	Tk_DestroyWindow(listPtr->tkwin);
	return TCL_ERROR;
    }

    /*
     * Adjust startup x view according to the justify option.
     */

    if (listPtr->justify == TK_JUSTIFY_RIGHT) {
        listPtr->xOffset = GetMaxOffset(listPtr);
    } else if (listPtr->justify == TK_JUSTIFY_CENTER) {
        listPtr->xOffset = GetMaxOffset(listPtr) / 2;
        listPtr->xOffset -= listPtr->xOffset % listPtr->xScrollUnit;
    }