heh heh!


Imagine a GUI form with two listboxes side by side.

The GUI form is yay-wide, the two listboxes occupy the entire width of the ListBox. You've implemented Geoff W's dredged-from-memory trick for setting the column widths to be twice-yay wide, so the user can scroll sideways in a listbox when the contents get to big.

The user (you) gets tired of this continual scrolling.
<pre> Enter THE SQUEEZE.
</pre>

You'll need a GUI form with two listboxes, which we will call Me.lbLeft and Me.lbRight. Use Toolbox to place a spin button control between them (or above them in-between), and let's call this spinbitton sbSqueeze.

In the form's code write:

<pre>Private Sub sbSqueeze_SpinDown()
'MsgBox "down"
Call cmd_Squeeze(Me.lbFoundStrings, Me.lbProcedure, Me.sbSqueeze, -1)
End Sub

Private Sub sbSqueeze_SpinUp()
'MsgBox "up"
Call cmd_Squeeze(Me.lbFoundStrings, Me.lbProcedure, Me.sbSqueeze, 1)
End Sub
</pre>


and in your utility library introduce:



<pre>Public Sub cmd_Squeeze(lbLeft As ListBox, lbRight As ListBox,_
sb As SpinButton, lngDirection As Long)
' Procedure : cmd_Squeeze
' Description: Modifies the appearance of the listboxes according to the Spin Button.
' Copyright: Chris Greaves Inc.
' Inputs: Left- and Righ listboxes, Spin button, long direction (+1, -1)
' Returns: None
' Assumes: Nothing
' Side Effects: None.
' Tested: By a call from the user.

If lngDirection = -1 Then
If lbLeft.Width > 72 Then
lbLeft.Width = lbLeft.Width - 1 ' left box becomes narraower
lbRight.Left = lbRight.Left - 1 ' right box shifts left
lbRight.Width = lbRight.Width + 1 ' right box becomes wider
sb.Left = sb.Left - 1 ' spin button shifts left
Else ' Listbox is lesss that 72points. make no change
End If
Else
End If

If lngDirection = 1 Then
If lbRight.Width > 72 Then
lbRight.Width = lbRight.Width - 1 ' right box becomes narraower
lbRight.Left = lbRight.Left + 1 ' right box shifts right
lbLeft.Width = lbLeft.Width + 1 ' left box becomes wider
sb.Left = sb.Left + 1 ' spin button shifts left
Else ' Listbox is lesss that 72points. make no change
End If
Else
End If

End Sub
</pre>




En, as they say here, joy!