Automatic scrolling in a Listbox

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Automatic scrolling in a Listbox

      Hello All,

      Are there any built in functions that enable automatic horizontal scrolling of a selected item in a listbox.

      Not a scrollbar that the user has to interact with, but a function that sees the displayed string is greater than the length of the display and starts scrolling from right to left automatically when that item is selected.

      Something along the lines of...

      item_index = listbox_GetSel();
      if(LENGTH_OF(listbox_GetItemText(item_index)) > MAX_DISPLAYABLE_LENGTH_ON_THE_SCREEN)
      {
      SCROLL_AUTOMATICALLY_FROM_RIGHT_TO_LEFT();
      }

      ...but built in ?

      Thanks. <3

      The post was edited 1 time, last by Diesel ().

    • Hi,

      There is no built-in function for this feature yet, but we will consider adding it in the future, because it is often requested and definitely makes sense.

      So for now, you would have to implement this behavior manually to the LISTBOX. You can do the text scrolling with an animation that "animates" an offset value to move the text.

      You also have to do the drawing yourself using this offset value in an OwnerDraw routine.

      I have attached a sample that does this and you can take it as a reference.

      Best regards,
      Florian
      Files
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.