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

Hybrid View

  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
    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/



  4. #4
    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?




  5. #5
    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?

    >
    >




  6. #6
    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





  7. #7
    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
    >
    >
    >
    >




  8. #8
    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



  9. #9
    Mark Alexander Bertenshaw Guest

    Re: Adding Columns to comboboxes through API

    Damit -

    > Well, you don't need to put yourself out doing it; I was just giving a

    WAG.
    > :-)


    That's all right, I only looked into it because I was interested. And yes,
    it was an Access Violation - but that's because I used the wrong declaration
    :-( I tried again, and it just doesn't work.

    BTW - what's a WAG?

    --

    ---------------------------------------
    Mark Alexander Bertenshaw
    Programmer/Analyst
    Prime Response
    Brentford
    UK



  10. #10
    Paul Little Guest

    Re: Adding Columns to comboboxes through API

    WAG = Wild *** Guess.
    --
    Paul Little, Senior Programmer/Analyst
    SVi Retail Systems
    San Diego, CA

    "Mark Alexander Bertenshaw" <Mark.Bertenshaw@virgin.net> wrote in message
    news:39421818$1@news.devx.com...

    > BTW - what's a WAG?





  11. #11
    Paul Clapham Guest

    Re: Adding Columns to comboboxes through API

    Too tacky! I only use SWAGs (Scientific Wild *** Guess).

    Paul Little <PLittle@SViRetail.com> wrote in message
    news:3946d93d$1@news.devx.com...
    > WAG = Wild *** Guess.
    > --
    > Paul Little, Senior Programmer/Analyst
    > SVi Retail Systems
    > San Diego, CA
    >
    > "Mark Alexander Bertenshaw" <Mark.Bertenshaw@virgin.net> wrote in message
    > news:39421818$1@news.devx.com...
    >
    > > BTW - what's a WAG?

    >
    >
    >




  12. #12
    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/

  13. #13
    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/



  14. #14
    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?




  15. #15
    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?

    >
    >




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