Solved

LB_SETTABSTOPS in a ComboBox List

Posted on 1997-08-30
6
777 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

803 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