Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile Exe
#Dim All
'%Unicode=1
#Include "win32api.inc"
%IDC_ComboBox = 500
Global hDlg As Dword
Function PBMain() As Long
Dim MyArray(3) As String
Array Assign MyArray() = "zero", "one", "two", "three"
Dialog New Pixels, 0, "ComboBox Test",300,300,200,100, %WS_OverlappedWindow, 0 To hDlg
Control Add ComboBox, hDlg, %IDC_ComboBox, MyArray(), 20,10,165,100
ComboBox Select hDlg, %IDC_ComboBox, 1
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local temp$, iSelect As Long
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.CtlMsg
Case %CBN_SelChange
'get pre-selecton text
Control Get Text hDlg, %IDC_ComboBox To temp$ '<--- gets old text
Dialog Set Text hDlg, temp$
'get post-selection text
Control Send hDlg, %IDC_ComboBox, %CB_GetCurSel, 0, 0 To iSelect
ComboBox Get Text hDlg, %IDC_ComboBox, iSelect+1 To temp$
Dialog Set Text hDlg, temp$
Case %CBN_EditChange
'get text that user has edited
Control Get Text hDlg, %IDC_ComboBox To temp$
Dialog Set Text hDlg, temp$
End Select
End Select
End Function
'gbs_01227
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm