Adding Columns to comboboxes through API


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 2 12 LastLast
Results 1 to 15 of 21

Thread: Adding Columns to comboboxes through API

  1. #1
    Lori Taylor Guest

    Adding Columns to comboboxes through API


    Does anyone know how to add columns to comboboxes through API. I have seen
    it done before but cannot figure out how. Can anyone help me?

  2. #2
    Mattias Sjögren Guest

    Re: Adding Columns to comboboxes through API

    Lori,

    >Does anyone know how to add columns to comboboxes through API. I have seen
    >it done before but cannot figure out how. Can anyone help me?


    There's no way to do thatwith a regular Combobox. The options you have
    are to use a fixed-width font, create an owner-draw Combobox control
    and draw the columns yourself, or find a third-party control that
    supports it.


    Mattias

    ____________________________________________
    Mattias Sjögren - mattiass @ hem.passagen.se
    http://hem.spray.se/mattias.sjogren/

  3. #3
    Mattias Sjögren Guest

    Re: Adding Columns to comboboxes through API

    Lori,

    >Does anyone know how to add columns to comboboxes through API. I have seen
    >it done before but cannot figure out how. Can anyone help me?


    There's no way to do thatwith a regular Combobox. The options you have
    are to use a fixed-width font, create an owner-draw Combobox control
    and draw the columns yourself, or find a third-party control that
    supports it.


    Mattias

    ____________________________________________
    Mattias Sjögren - mattiass @ hem.passagen.se
    http://hem.spray.se/mattias.sjogren/

  4. #4
    Michael Culley Guest

    Re: Adding Columns to comboboxes through API


    mattiass,

    AFAIK this is possible. I am pretty sure I have seen it in VBPJ before. I
    don't think it works that well because if an item goes past the tab it pushes
    everything over in the other columns.

    Michael Culley

    mattiass.dont.want.spam@hem.passagen.se (Mattias Sjögren) wrote:
    >Lori,
    >
    >>Does anyone know how to add columns to comboboxes through API. I have

    seen
    >>it done before but cannot figure out how. Can anyone help me?

    >
    >There's no way to do thatwith a regular Combobox. The options you have
    >are to use a fixed-width font, create an owner-draw Combobox control
    >and draw the columns yourself, or find a third-party control that
    >supports it.
    >
    >
    >Mattias
    >
    >____________________________________________
    >Mattias Sjögren - mattiass @ hem.passagen.se
    > http://hem.spray.se/mattias.sjogren/



  5. #5
    Michael Culley Guest

    Re: Adding Columns to comboboxes through API


    mattiass,

    AFAIK this is possible. I am pretty sure I have seen it in VBPJ before. I
    don't think it works that well because if an item goes past the tab it pushes
    everything over in the other columns.

    Michael Culley

    mattiass.dont.want.spam@hem.passagen.se (Mattias Sjögren) wrote:
    >Lori,
    >
    >>Does anyone know how to add columns to comboboxes through API. I have

    seen
    >>it done before but cannot figure out how. Can anyone help me?

    >
    >There's no way to do thatwith a regular Combobox. The options you have
    >are to use a fixed-width font, create an owner-draw Combobox control
    >and draw the columns yourself, or find a third-party control that
    >supports it.
    >
    >
    >Mattias
    >
    >____________________________________________
    >Mattias Sjögren - mattiass @ hem.passagen.se
    > http://hem.spray.se/mattias.sjogren/



  6. #6
    Eric D. Burdo Guest

    Re: Adding Columns to comboboxes through API

    You need to use the SendMessage API and set tabstops. This breaks your
    combo box into 'columns' in a sense. When you add text, you need to
    separate each part via a tab char (vbTab). You can find sample code for
    this at: http://www.mvps.org/vbnet

    --

    Eric D. Burdo, Red-Leif International
    VB Programmer and Consultant
    <http://www.redleif.com>

    *** Please reply to the newsgroup so all can benefit. ***
    "Lori Taylor" <latwv@yahoo.com> wrote in message
    news:393e4392$1@news.devx.com...
    >
    > Does anyone know how to add columns to comboboxes through API. I have

    seen
    > it done before but cannot figure out how. Can anyone help me?




  7. #7
    Eric D. Burdo Guest

    Re: Adding Columns to comboboxes through API

    You need to use the SendMessage API and set tabstops. This breaks your
    combo box into 'columns' in a sense. When you add text, you need to
    separate each part via a tab char (vbTab). You can find sample code for
    this at: http://www.mvps.org/vbnet

    --

    Eric D. Burdo, Red-Leif International
    VB Programmer and Consultant
    <http://www.redleif.com>

    *** Please reply to the newsgroup so all can benefit. ***
    "Lori Taylor" <latwv@yahoo.com> wrote in message
    news:393e4392$1@news.devx.com...
    >
    > Does anyone know how to add columns to comboboxes through API. I have

    seen
    > it done before but cannot figure out how. Can anyone help me?




  8. #8
    Mark Alexander Bertenshaw Guest

    Re: Adding Columns to comboboxes through API

    Eric -

    The last time I looked, there was no CB_SETTABSTOPS message (believe me,
    I've tried looking for it).

    This is what is in winuser.h


    /*
    * Combo Box messages
    */
    #ifndef NOWINMESSAGES
    #define CB_GETEDITSEL 0x0140
    #define CB_LIMITTEXT 0x0141
    #define CB_SETEDITSEL 0x0142
    #define CB_ADDSTRING 0x0143
    #define CB_DELETESTRING 0x0144
    #define CB_DIR 0x0145
    #define CB_GETCOUNT 0x0146
    #define CB_GETCURSEL 0x0147
    #define CB_GETLBTEXT 0x0148
    #define CB_GETLBTEXTLEN 0x0149
    #define CB_INSERTSTRING 0x014A
    #define CB_RESETCONTENT 0x014B
    #define CB_FINDSTRING 0x014C
    #define CB_SELECTSTRING 0x014D
    #define CB_SETCURSEL 0x014E
    #define CB_SHOWDROPDOWN 0x014F
    #define CB_GETITEMDATA 0x0150
    #define CB_SETITEMDATA 0x0151
    #define CB_GETDROPPEDCONTROLRECT 0x0152
    #define CB_SETITEMHEIGHT 0x0153
    #define CB_GETITEMHEIGHT 0x0154
    #define CB_SETEXTENDEDUI 0x0155
    #define CB_GETEXTENDEDUI 0x0156
    #define CB_GETDROPPEDSTATE 0x0157
    #define CB_FINDSTRINGEXACT 0x0158
    #define CB_SETLOCALE 0x0159
    #define CB_GETLOCALE 0x015A
    #if(WINVER >= 0x0400)
    #define CB_GETTOPINDEX 0x015b
    #define CB_SETTOPINDEX 0x015c
    #define CB_GETHORIZONTALEXTENT 0x015d
    #define CB_SETHORIZONTALEXTENT 0x015e
    #define CB_GETDROPPEDWIDTH 0x015f
    #define CB_SETDROPPEDWIDTH 0x0160
    #define CB_INITSTORAGE 0x0161
    #endif /* WINVER >= 0x0400 */
    #if(WINVER >= 0x0400)
    #define CB_MSGMAX 0x0162
    #else
    #define CB_MSGMAX 0x015B
    #endif
    #endif /* !NOWINMESSAGES */



    --

    ---------------------------------------
    Mark Alexander Bertenshaw
    Programmer/Analyst
    Prime Response
    Brentford
    UK
    "Eric D. Burdo" <vbtips@redleif.com> wrote in message
    news:393fafda$1@news.devx.com...
    > You need to use the SendMessage API and set tabstops. This breaks your
    > combo box into 'columns' in a sense. When you add text, you need to
    > separate each part via a tab char (vbTab). You can find sample code for
    > this at: http://www.mvps.org/vbnet
    >
    > --
    >
    > Eric D. Burdo, Red-Leif International
    > VB Programmer and Consultant
    > <http://www.redleif.com>
    >
    > *** Please reply to the newsgroup so all can benefit. ***
    > "Lori Taylor" <latwv@yahoo.com> wrote in message
    > news:393e4392$1@news.devx.com...
    > >
    > > Does anyone know how to add columns to comboboxes through API. I have

    > seen
    > > it done before but cannot figure out how. Can anyone help me?

    >
    >




  9. #9
    Mark Alexander Bertenshaw Guest

    Re: Adding Columns to comboboxes through API

    Eric -

    The last time I looked, there was no CB_SETTABSTOPS message (believe me,
    I've tried looking for it).

    This is what is in winuser.h


    /*
    * Combo Box messages
    */
    #ifndef NOWINMESSAGES
    #define CB_GETEDITSEL 0x0140
    #define CB_LIMITTEXT 0x0141
    #define CB_SETEDITSEL 0x0142
    #define CB_ADDSTRING 0x0143
    #define CB_DELETESTRING 0x0144
    #define CB_DIR 0x0145
    #define CB_GETCOUNT 0x0146
    #define CB_GETCURSEL 0x0147
    #define CB_GETLBTEXT 0x0148
    #define CB_GETLBTEXTLEN 0x0149
    #define CB_INSERTSTRING 0x014A
    #define CB_RESETCONTENT 0x014B
    #define CB_FINDSTRING 0x014C
    #define CB_SELECTSTRING 0x014D
    #define CB_SETCURSEL 0x014E
    #define CB_SHOWDROPDOWN 0x014F
    #define CB_GETITEMDATA 0x0150
    #define CB_SETITEMDATA 0x0151
    #define CB_GETDROPPEDCONTROLRECT 0x0152
    #define CB_SETITEMHEIGHT 0x0153
    #define CB_GETITEMHEIGHT 0x0154
    #define CB_SETEXTENDEDUI 0x0155
    #define CB_GETEXTENDEDUI 0x0156
    #define CB_GETDROPPEDSTATE 0x0157
    #define CB_FINDSTRINGEXACT 0x0158
    #define CB_SETLOCALE 0x0159
    #define CB_GETLOCALE 0x015A
    #if(WINVER >= 0x0400)
    #define CB_GETTOPINDEX 0x015b
    #define CB_SETTOPINDEX 0x015c
    #define CB_GETHORIZONTALEXTENT 0x015d
    #define CB_SETHORIZONTALEXTENT 0x015e
    #define CB_GETDROPPEDWIDTH 0x015f
    #define CB_SETDROPPEDWIDTH 0x0160
    #define CB_INITSTORAGE 0x0161
    #endif /* WINVER >= 0x0400 */
    #if(WINVER >= 0x0400)
    #define CB_MSGMAX 0x0162
    #else
    #define CB_MSGMAX 0x015B
    #endif
    #endif /* !NOWINMESSAGES */



    --

    ---------------------------------------
    Mark Alexander Bertenshaw
    Programmer/Analyst
    Prime Response
    Brentford
    UK
    "Eric D. Burdo" <vbtips@redleif.com> wrote in message
    news:393fafda$1@news.devx.com...
    > You need to use the SendMessage API and set tabstops. This breaks your
    > combo box into 'columns' in a sense. When you add text, you need to
    > separate each part via a tab char (vbTab). You can find sample code for
    > this at: http://www.mvps.org/vbnet
    >
    > --
    >
    > Eric D. Burdo, Red-Leif International
    > VB Programmer and Consultant
    > <http://www.redleif.com>
    >
    > *** Please reply to the newsgroup so all can benefit. ***
    > "Lori Taylor" <latwv@yahoo.com> wrote in message
    > news:393e4392$1@news.devx.com...
    > >
    > > Does anyone know how to add columns to comboboxes through API. I have

    > seen
    > > it done before but cannot figure out how. Can anyone help me?

    >
    >




  10. #10
    Damit Senanayake Guest

    Re: Adding Columns to comboboxes through API

    "Mark Alexander Bertenshaw" <Mark.Bertenshaw@virgin.net> wrote in message
    news:39402d6d@news.devx.com...

    : The last time I looked, there was no CB_SETTABSTOPS message (believe me,
    : I've tried looking for it).

    I think Eric was thinking of LB_SETTABSTOPS... but what happens if you send
    LB_SETTABSTOPS to the listbox portion of the combobox (not in Dropdown List,
    obviously)?

    --
    Damit Senanayake | damit@mvps.org | http://members.xoom.com/damit
    Please reply to newsgroups, not by e-mail. | ICQ: 6930718





  11. #11
    Damit Senanayake Guest

    Re: Adding Columns to comboboxes through API

    "Mark Alexander Bertenshaw" <Mark.Bertenshaw@virgin.net> wrote in message
    news:39402d6d@news.devx.com...

    : The last time I looked, there was no CB_SETTABSTOPS message (believe me,
    : I've tried looking for it).

    I think Eric was thinking of LB_SETTABSTOPS... but what happens if you send
    LB_SETTABSTOPS to the listbox portion of the combobox (not in Dropdown List,
    obviously)?

    --
    Damit Senanayake | damit@mvps.org | http://members.xoom.com/damit
    Please reply to newsgroups, not by e-mail. | ICQ: 6930718





  12. #12
    Mark Alexander Bertenshaw Guest

    Re: Adding Columns to comboboxes through API

    Damit -

    I tried to enumerate windows on the _DropDown event last time, and I didn't
    find any more child controls other than an edit control. Just to humour
    you, I tried again, but then I noticed that the list box portion overlapped
    the edge of the window. Then I remembered that the list box is on the
    desktop window. So looking there, I discovered a window of class
    "ComboLBox". I tried sending LB_SETTABSTOPS to it, and it crashed. I will
    try again, but it is getting very late.

    Cheers,
    --

    ---------------------------------------
    Mark Alexander Bertenshaw
    Programmer/Analyst
    Prime Response
    Brentford
    UK
    "Damit Senanayake" <damit@mvps.org> wrote in message
    news:3940e3cc@news.devx.com...
    > "Mark Alexander Bertenshaw" <Mark.Bertenshaw@virgin.net> wrote in message
    > news:39402d6d@news.devx.com...
    >
    > : The last time I looked, there was no CB_SETTABSTOPS message (believe me,
    > : I've tried looking for it).
    >
    > I think Eric was thinking of LB_SETTABSTOPS... but what happens if you

    send
    > LB_SETTABSTOPS to the listbox portion of the combobox (not in Dropdown

    List,
    > obviously)?
    >
    > --
    > Damit Senanayake | damit@mvps.org | http://members.xoom.com/damit
    > Please reply to newsgroups, not by e-mail. | ICQ: 6930718
    >
    >
    >
    >




  13. #13
    Mark Alexander Bertenshaw Guest

    Re: Adding Columns to comboboxes through API

    Damit -

    I tried to enumerate windows on the _DropDown event last time, and I didn't
    find any more child controls other than an edit control. Just to humour
    you, I tried again, but then I noticed that the list box portion overlapped
    the edge of the window. Then I remembered that the list box is on the
    desktop window. So looking there, I discovered a window of class
    "ComboLBox". I tried sending LB_SETTABSTOPS to it, and it crashed. I will
    try again, but it is getting very late.

    Cheers,
    --

    ---------------------------------------
    Mark Alexander Bertenshaw
    Programmer/Analyst
    Prime Response
    Brentford
    UK
    "Damit Senanayake" <damit@mvps.org> wrote in message
    news:3940e3cc@news.devx.com...
    > "Mark Alexander Bertenshaw" <Mark.Bertenshaw@virgin.net> wrote in message
    > news:39402d6d@news.devx.com...
    >
    > : The last time I looked, there was no CB_SETTABSTOPS message (believe me,
    > : I've tried looking for it).
    >
    > I think Eric was thinking of LB_SETTABSTOPS... but what happens if you

    send
    > LB_SETTABSTOPS to the listbox portion of the combobox (not in Dropdown

    List,
    > obviously)?
    >
    > --
    > Damit Senanayake | damit@mvps.org | http://members.xoom.com/damit
    > Please reply to newsgroups, not by e-mail. | ICQ: 6930718
    >
    >
    >
    >




  14. #14
    Damit Senanayake Guest

    Re: Adding Columns to comboboxes through API

    Hi Mark,

    : I tried to enumerate windows on the _DropDown event last time, and I
    didn't
    : find any more child controls other than an edit control.

    Hmm... actually, I also realized (after posting :-( ) that the listbox is a
    child of the desktop.

    :I tried sending LB_SETTABSTOPS to it, and it crashed.

    That's interesting. What was the error, and what crashed? The
    desktop/Explorer? I suppose it would have been an access violation, since
    the lpiTabs parameter points to la-la land in the desktop's address space...
    looks like yet another job for SHLoadInProc! <vbg>

    Well, you don't need to put yourself out doing it; I was just giving a WAG.
    :-)
    --
    Damit Senanayake | damit@mvps.org | http://members.xoom.com/damit
    Please reply to newsgroups, not by e-mail. | ICQ: 6930718



  15. #15
    Damit Senanayake Guest

    Re: Adding Columns to comboboxes through API

    Hi Mark,

    : I tried to enumerate windows on the _DropDown event last time, and I
    didn't
    : find any more child controls other than an edit control.

    Hmm... actually, I also realized (after posting :-( ) that the listbox is a
    child of the desktop.

    :I tried sending LB_SETTABSTOPS to it, and it crashed.

    That's interesting. What was the error, and what crashed? The
    desktop/Explorer? I suppose it would have been an access violation, since
    the lpiTabs parameter points to la-la land in the desktop's address space...
    looks like yet another job for SHLoadInProc! <vbg>

    Well, you don't need to put yourself out doing it; I was just giving a WAG.
    :-)
    --
    Damit Senanayake | damit@mvps.org | http://members.xoom.com/damit
    Please reply to newsgroups, not by e-mail. | ICQ: 6930718



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center