Solved

LB_SETTABSTOPS in a ComboBox List

Posted on 1997-08-30
6
772 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How Does Quick Books store date / time? 3 93
Windows Process running 3 47
Why is "packages element is not declared"? 2 129
Recommendation vb6 to vb.net or others 14 109
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now