Locating start in a combobox

Creating macros. Working with QM.

Locating start in a combobox

Postby ssimop on Thu Jul 27, 2017 4:06 pm

A long alphabetical list is to be stored and accessed through a read-only combobox. I need to locate the starting letter in the list to avoid tiresome pull-down actions. I wonder whether there exists something simpler than what I use. Any advice is much appreciated.

Function Dialog45     ?

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 183 136 "Dialog"
;3 ComboBox 0x54230243 0x0 33 23 96 212 ""
;6 Edit 0x54030080 0x200 95 7 17 12 ""
;4 Static 0x54000000 0x0 6 7 85 12 "Select Combo Start"
;1 Button 0x54030001 0x4 34 43 48 14 "OK"
;2 Button 0x54030000 0x4 88 43 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040500 "*" "" "" ""

str controls = "3 6"
str cb3 e6

cb3=
;apple
;cat
;class
;dog
;key
;lamp
;paper
;road
;star
;table
;tree
;unix
;victory
;water
;xenon
;yard
;zebra

if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case [EN_CHANGE<<16|6]
,_s.getwintext(id(6 hDlg))
,CB_SelectString(id(3 hDlg) _s)

,case IDOK
,case IDCANCEL
ret 1

User avatar
ssimop
Active Member
 
Posts: 913
Joined: Sun Oct 21, 2007 1:55 pm
Location: Greece

Re: Locating start in a combobox

Postby Gintaras on Thu Jul 27, 2017 6:35 pm

I think this is simple to create and simple to use.
Gintaras
Site Admin
 
Posts: 10386
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: Locating start in a combobox

Postby Dmowskavitto on Thu Aug 17, 2017 8:57 am

Code: Select all
private void findButton_Click(object sender, System.EventArgs e) {
    int index = comboBox1.FindString(textBox2.Text);
    comboBox1.SelectedIndex = index;
}

Warning: The code possibly is invalid because some important characters (tabs, spaces) disappeared. Read more.
Dmowskavitto
 
Posts: 1
Joined: Thu Aug 17, 2017 8:55 am


Return to General

Who is online

Users browsing this forum: No registered users and 2 guests

cron