Announcement

Collapse
No announcement yet.

ComboBox with tabs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ComboBox with tabs

    I have tried the following to put tabs in a combobox with no success.
    Has anyone some suggestions?

    Thanks, Ian

    CONTROL ADD COMBOBOX, hDlg, %IDC_PRODUCT, , 120, 205, 235, 235, %WS_CHILD _
    OR %WS_VISIBLE OR %WS_TABSTOP OR %WS_VSCROLL OR %CBS_DROPDOWN OR _
    %CBS_SORT OR %CBS_UPPERCASE, %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
    %WS_EX_RIGHTSCROLLBAR

    DIM tabstops(2) AS LONG
    LOCAL a AS LONG
    FOR a=0 TO 2
    tabstops(a)=VAL(READ$(a+1))
    NEXT a
    DATA 450, 222, 300
    STATIC cbi AS COMBOBOXINFO
    STATIC hCombo, hComboEdit AS LONG
    hCombo = GetDlgItem(hDlg, %IDC_PRODUCT)
    cbi.cbSize = SIZEOF(cbi)
    GetComboBoxInfo(hCombo, cbi)
    hComboEdit = cbi.hwndList
    SendMessage hComboEdit, %LB_SETTABSTOPS, 2, VARPTR(tabstops(0))
    'then add data to the combobox with
    COMBOBOX ADD hDlg, %IDC_PRODUCT, PARSE$(txt, 1) & $TAB & PARSE$(txt, 2) & $TAB & PARSE$(txt, 3)
    Ian Docksey, Trinitarian Bible Society

  • #2
    perhaps because LB_SETTABSTOPS is a listbox message and you are working with a combobox? (yes i know its a text box/lisbox hybrid)

    I do not see an equivalent CB_SETTABSTOPS so going to assume that it's not possible. Is it not a true listbox and only a subset of the capabilities?

    A little quick googling found this http://www.xtremevbtalk.com/showthread.php?t=20632

    Not a definitive answer but it points at "not possible".
    Last edited by George Bleck; 29 Apr 2009, 05:55 AM.
    <b>George W. Bleck</b>
    <img src='http://www.blecktech.com/myemail.gif'>

    Comment


    • #3
      Code:
      data 450, 222, 300
      the tab stops must be sorted in ascending order; backward tabs are not allowed.
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Bad news I'm afraid..
        Code:
              hComboList = cbi.hwndList
              SendMessage hComboList, %LB_SETTABSTOPS, 2, VARPTR(tabstops(0))
              MsgBox "1: " + ErrorMsg(GetLastError),,"System Error"
              'Result > [COLOR=red]1:  1434 This list box does not support tab stops[/COLOR].
        Seems that the Listbox part of the combo box is not created with the LBS_USETABSTOPS style.
        Listbox Styles generally (also applies to Listboxes that are part of a Combobox, I checked) cannot be changed once the Listbox has been created - So SetWindowLong is out

        Possibly interesting work-around ideas here.. http://vbnet.mvps.org/index.html?cod...tabbedlist.htm
        Last edited by Dave Biggs; 29 Apr 2009, 11:45 AM. Reason: Found useful link
        Rgds, Dave

        Comment


        • #5
          Ian

          You need to use CBS_OWNERDRAWFIXED in the combobox definition, then draw the text in the WM_DRAWITEM part of the main window's callback.

          See http://www.powerbasic.com/support/pb...ad.php?t=40468 for an example.

          Christopher

          Comment


          • #6
            Nice one Christopher!

            Here's a link to Borje's compilable DDT example..
            http://www.powerbasic.com/support/pb...ad.php?t=24113
            Rgds, Dave

            Comment

            Working...
            X