How to use tabs in a listbox? 
Author Message
 How to use tabs in a listbox?

I have a list box that is displaying the results of an SQL query of a
FoxPro 2.5 table. I need to show three fields (multiple records)
 but I can not get them to line up.

Is there a way to use tabs in list box or emulate at least them?

I really don't want to get into a situation where I'm counting the
the number of characters in the fields and padding them on the fly
within the listbox.

Thanks,
Russ Posey

p.s. It looks like WinZip can do it, why can't I?



Wed, 02 Sep 1998 03:00:00 GMT  
 How to use tabs in a listbox?
Hello!

I assume you want to do something like this:
ListBox.AddItem Text1 & chr(8) & Text2 & chr(8) & Text3

To line up the columns you have to set tabstops into your listbox. You
must you the API function SendMessage to do this: Below follows an
example that works in either 16 and 32 bits environment:

'Put this code in a .bas file which you add to your project
#If Win32 Then
  Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam
As Long) As Long
  Public Const LB_SETTABSTOPS = &H192
#Else
  Declare Function SendMessage Lib "User" (ByVal hwnd As Integer,
ByVal msg As Integer, ByVal Wp As Integer, Lp As Any) As Long
  Public Const WM_USER = &H400
  Public Const LB_SETTABSTOPS = WM_USER + 19
#End If

'Here is the code to set tabstops.
  Dim lngRet As Long

  'Set tabstops
  #If Win32 Then
    ReDim arrTabs(0 To 2) As Long
  #Else
    ReDim arrTabs(0 To 2) As Integer
  #End If
  arrTabs(0) = 80
  arrTabs(1) = 300
  arrTabs(2) = 301
  lngRet = SendMessage(List1.hwnd, LB_SETTABSTOPS, 3, arrTabs(0))

Hope this helps!

Ulf Erik Forsbakk



Sat, 05 Sep 1998 03:00:00 GMT  
 How to use tabs in a listbox?

Quote:

>I have a list box that is displaying the results of an SQL query of a
>FoxPro 2.5 table. I need to show three fields (multiple records)
> but I can not get them to line up.

>Is there a way to use tabs in list box or emulate at least them?

>I really don't want to get into a situation where I'm counting the
>the number of characters in the fields and padding them on the fly
>within the listbox.

If you want to do it yourself, read the knowledge base article # Q71067. It
ain't exactly easy.

If you don't want to do it yourself, buy a control or find a shareware control
that does it for you - mlist.vbx works very well for vb 3.0, I haven't found a
shareware control for vb 4.0 yet.

Gordon Lawson, Senior Software Engineer
Computers Unlimited
Billings, MT
(406) 255-9500



Sun, 06 Sep 1998 03:00:00 GMT  
 How to use tabs in a listbox?
Re: How to use tabs in a listbox?
Quote:


>>I have a list box that is displaying the results of an SQL query of a
>>FoxPro 2.5 table. I need to show three fields (multiple records)
>> but I can not get them to line up.

>>Is there a way to use tabs in list box or emulate at least them?

>>I really don't want to get into a situation where I'm counting the
>>the number of characters in the fields and padding them on the fly
>>within the listbox.

Hi there!
You can find a routine in a package called QuickPak Pro from Crescent
software.
Another way is to use a grid.vbx and prevent lines to be displayed- your
list would look like a listbox and you'd have even more features!

That's all, folks!

Joachim Hornig


New HTML-archive software now available for free download at:
http://ourworld.compuserve.com/homepages/SOUNDVISION/kmainfo.htm



Mon, 07 Sep 1998 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Using SendMessage to set tabs in listbox

2. Force Tab selection using Tab Strip

3. Tab order when using Tab control

4. TAB and Shift+TAB using API

5. ListBox tabs

6. ListBox Tabs

7. Printing listbox contents with tabs

8. Right Align Tabs in ListBox - How?

9. Setting listbox tabs positions

10. Tab Stops Within Listbox?

11. Tabs in listbox (VB5)

12. Tabs in a Listbox

 

 
Powered by phpBB® Forum Software