summaryrefslogtreecommitdiffstats
path: root/generic/tkListbox.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-01-16 14:20:40 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-01-16 14:20:40 (GMT)
commitdfecb499abf1df3c0605d0058f454d8230221dd8 (patch)
tree7ff206b7f3d35ee0ec06de4e155535bf63e39958 /generic/tkListbox.c
parentd48a10cb3142cfbefd0314439d877da5eb03b926 (diff)
downloadtk-dfecb499abf1df3c0605d0058f454d8230221dd8.zip
tk-dfecb499abf1df3c0605d0058f454d8230221dd8.tar.gz
tk-dfecb499abf1df3c0605d0058f454d8230221dd8.tar.bz2
Addressed issue B (see artifact [9d48a9c212] of ticket [3f456a5bb9])
Diffstat (limited to 'generic/tkListbox.c')
-rw-r--r--generic/tkListbox.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index a57650b..4f20d44 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -1096,6 +1096,7 @@ ListboxBboxSubCmd(
Listbox *listPtr, /* Information about the listbox */
int index) /* Index of the element to get bbox info on */
{
+ register Tk_Window tkwin = listPtr->tkwin;
int lastVisibleIndex;
/*
@@ -1131,7 +1132,15 @@ ListboxBboxSubCmd(
Tk_GetFontMetrics(listPtr->tkfont, &fm);
pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen);
- x = listPtr->inset + listPtr->selBorderWidth - listPtr->xOffset;
+ if (listPtr->justify == TK_JUSTIFY_LEFT) {
+ x = (listPtr->inset + listPtr->selBorderWidth) - listPtr->xOffset;
+ } else if (listPtr->justify == TK_JUSTIFY_RIGHT) {
+ x = Tk_Width(tkwin) - (listPtr->inset + listPtr->selBorderWidth)
+ - pixelWidth - listPtr->xOffset + GetMaxOffset(listPtr);
+ } else {
+ x = (Tk_Width(tkwin) - pixelWidth)/2
+ - listPtr->xOffset + GetMaxOffset(listPtr)/2;
+ }
y = ((index - listPtr->topIndex)*listPtr->lineHeight)
+ listPtr->inset + listPtr->selBorderWidth;
results[0] = Tcl_NewIntObj(x);