Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

centering selected item in listbox

tropfen
New Contributor I
1,137 Views
Hello,

i am selecting an item in a listbox. some times this item is only shown partly in the listbox (see picture). i am using LB_SETSEL in a win32 Environment.

43164-listbox.png

is there a possibility to center the selected item? Only one item is selected.

Thanks in advance
Frank
0 Kudos
1 Solution
IanH
Honored Contributor III
1,137 Views
("i am" == "the user is" or "my program is"?)

Perhaps use LB_SETTOPINDEX with an appropriate offset of items to get your desired item in the middle.

View solution in original post

0 Kudos
4 Replies
IanH
Honored Contributor III
1,138 Views
("i am" == "the user is" or "my program is"?)

Perhaps use LB_SETTOPINDEX with an appropriate offset of items to get your desired item in the middle.
0 Kudos
tropfen
New Contributor I
1,137 Views
Hello IanH,

during developing time
i am ==
a) writing the source code
b) starting the program
c) pressing the button

what means that 'some times' the computer might do what i have intended ;-)


LB_SETTOPINDEX works for me

Frank
0 Kudos
IanH
Honored Contributor III
1,137 Views
The reason why I was asking for clarification about who or what was selecting the item is that a user is going to get pretty cranky pretty quickly if items in listboxes start jumping around whenever they change the selection directly in the listbox, as opposed to the selection being set by the program in response to non-user input or user actions remote from the listbox (perhaps selecting the item as part of the initialisation of the dialog box or as the result of clicking on a button elsewhere), where having the selected item appearing in the right spot makes a great deal of sense.
0 Kudos
tropfen
New Contributor I
1,137 Views
the change of the selected item is caused be a user action searching for a certain entry in the listbox. Therefor jumping around is intended and hopefully accepted by the user.

Frank
0 Kudos
Reply