Solved

LB_SETTABSTOPS in a ComboBox List

Posted on 1997-08-30
6
769 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
Comment Utility
Edited text of question
0
 
LVL 3

Expert Comment

by:msmits
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 3

Expert Comment

by:msmits
Comment Utility
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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

771 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

10 Experts available now in Live!

Get 1:1 Help Now