Solved

LB_SETTABSTOPS in a ComboBox List

Posted on 1997-08-30
6
797 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
[X]
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
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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.  …
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 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