Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

LB_SETTABSTOPS in a ComboBox List

Posted on 1997-08-30
6
778 Views
Last Modified: 2013-12-03
I'm programming in C for Win 3.x with the SDK.

I can set column tabstops within a lisbox (using LB_SETTABSTOPS) and the list comes out nicely formatted when adding tabbed strings to it.

But, I can't figure out a way to get the list of a combobox to work the same way.

Can you?

slach
0
Comment
Question by:slach
  • 3
  • 2
6 Comments
 

Author Comment

by:slach
ID: 1405247
Edited text of question
0
 
LVL 3

Expert Comment

by:msmits
ID: 1405248
Bad Luck, the ComboBox doesn't support that functionality.
Maybe you can program your own ComboBox control to support it. Or you can do an CBS_OWNERDRAWFIXED or CBSOWNERDRAWVARIABLE style and draw the text yourself on the combobox.

0
 

Author Comment

by:slach
ID: 1405249
I wouldn't give up so easily....I feel a ComboBox's list is a standard Windows Listbox and would support tabstops.  The problem is getting a handle to it.  I believe the list is somehow owned by the desktop (this allows the list to extend outside the application's client area) and the combobox has a way of talking to the list.  
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:msmits
ID: 1405250
The controls are just implementations of different classes in windows. These classes have particular implementations, that are done in their message callback function. When this function doesn't support certain functionality (or maybe undocumented functionality) this is almost impossible to get at.
You can try to hook this function and add your extra functionality to it or disassemble it to check for undocumented stuff. The API documentation doesn't specify the functionality you require of the ComboBox, but it does for the listbox.

To get the handle is very easy. Just call CreateWindow() with the classname COMBOBOX. And talking to that beast you can do by sending the predefined messages CB_* via the SendMessage() function.
The way to get your functionality in is via the styles I described in my answer to your question.

Good Luck trying other solutions...
0
 
LVL 1

Accepted Solution

by:
belov earned 150 total points
ID: 1405251
When combobox is ready to show dropdown list,
that listbox is created, so you should do your
action in CBN_DROPDOWN notification. Drop
down list window is "ComboLBox" class window,
and system cannot have more than one window of that class.
Up to CBN_DROPDOWN handler call that
window should be already created by the system.
So you can FindWindow and set tabstops to it.
Or you may go more complex way and install
windows hook on CallWindowProc to alter
almost all in message handling.
0
 

Author Comment

by:slach
ID: 1405252
belov,
I tried your suggestion, didn't work.  I then realized I may also need to set the style of the combo box's list to LBS_USETABSTOPS, which I did in the code fragment below.  This also didn't work.  Any other suggestions?  I think there may be a message sent ot the listbox telling it that its style is changing - the list may then be rejecting the change.  Make sense?

HWND         hComboList;
DWORD        dwComboListStyle;

case WM_COMMAND:
  if(HIWORD(lParam)==CBN_DROPDOWN && LOWORD(lParam)==hComboBoxControl)
   {
    hComboList = FindWindow("ComboLBox",NULL);
    dwComboListStyle = GetWindowLong(hComboList,GWL_STYLE);
SetWindowLong(hComboList,GWL_STYLE,dwComboListStyle|LBS_USETABSTOPS);
   }  

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question