PDA

View Full Version : combobox align right ?



Lionheart008
19-01-2010, 21:53
hello all,
little question about combobox and lists. how can I create a combobox with 'right aligned' list ? see example with my last combobox ;)


Uses "console", "ui"

%Combo1 = 1001
%Combo2 = 1002
%Combo3 = 1003
%AddCbLbWidth = 70

Function tbmain() As Long
Local hDlg As DWord
Local lRes As Long
Local sArray(50) As String

Dialog New 0, "ComboBox trixy",-1,-1, 102,90, %WS_CAPTION Or %WS_SYSMENU, 0 To hDlg

'------------------------------------------------------------------
For lRes = 1 To UBound(sArray)
sArray(lRes) = "Standard list" + Str$(lRes)
Next
Control Add COMBOBOX, hDlg, %Combo1, sArray(),10,5,83,80, _
%CBS_AUTOHSCROLL Or %CBS_DROPDOWN Or %WS_TABSTOP Or %WS_VSCROLL
COMBOBOX Select hDlg, %Combo1, 1

'------------------------------------------------------------------
For lRes = 1 To UBound(sArray)
sArray(lRes) = "Left-aligned wide list" + Str$(lRes)
Next
Control Add COMBOBOX, hDlg, %Combo2, sArray(),10,25,83,80, _
%CBS_AUTOHSCROLL Or %CBS_DROPDOWN Or %WS_TABSTOP Or %WS_VSCROLL
Control Send hDlg, %Combo2, %CB_GETDROPPEDWIDTH, 0, 0 To lRes
Control Send hDlg, %Combo2, %CB_SETDROPPEDWIDTH, lRes + %AddCbLbWidth, 0
COMBOBOX Select hDlg, %Combo2, 1

'------------------------------------------------------------------
For lRes = 1 To UBound(sArray)
sArray(lRes) = "Right-aligned wide list" + Str$(lRes)
Next
Control Add COMBOBOX, hDlg, %Combo3, sArray(),10,45,83,80, _
%CBS_AUTOHSCROLL Or %CBS_DROPDOWN Or %WS_TABSTOP Or %WS_VSCROLL
COMBOBOX Select hDlg, %Combo3, 1

'------------------------------------------------------------------
Control Add Button, hDlg, %IDCANCEL, "Quity", 48, 72, 50, 14
'------------------------------------------------------------------
Dialog Show Modal hDlg Call DlgProc

End Function


CallBack Function DlgProc() As Long

Select Case CBMSG
Case %WM_COMMAND
Select Case CBCTL
Case %IDCANCEL
If CBCTLMSG = %BN_CLICKED Then
Dialog End CBHNDL
End If

End Select
End Select
End Function


best regards, frank