Posts: 45
Threads: 15
Joined: Jul 2006
Hi..i'm on to a new project i kinda think its a lil to big for me but i like to try new things..Just want to find out if QM can do it first before i start trying..What i want to do is make a dialog that when i type in a word i want it to search a txt.file that has 170,000 words in it to see if its a real word..its for when we play scrabble to save time looking in the dictionary..is QM able to do this? and if so can u point me in the right direction so i can play around with it?..thanks
Posts: 12,041
Threads: 140
Joined: Dec 2002
Example.
Function Dialog_DictionaryExample
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
;this code just creates a test file
str s=
;January Sausis
;February Vasaris
;March Kovas
s.setfile("$desktop$\test dictionary.txt")
;___________________________________
str ss.getfile("$desktop$\test dictionary.txt")
IStringMap- m=CreateStringMap(1|2)
m.AddList(ss " ")
ss.all
str controls = "3 4 8"
str e3 e4 e8
e8="January[]February[]March"
if(!ShowDialog("Dialog_DictionaryExample" &Dialog_DictionaryExample &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dictionary"
;3 Edit 0x54030080 0x200 8 22 96 14 ""
;4 Edit 0x54030080 0x200 108 22 96 14 ""
;5 Static 0x54000000 0x0 8 6 48 12 "English"
;6 Static 0x54000000 0x0 108 6 48 12 "Lithuanian"
;7 Static 0x54000000 0x0 8 42 60 12 "Available words"
;8 Edit 0x54230844 0x20000 8 56 96 48 ""
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2020006 "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case EN_CHANGE<<16|3
,str s1.getwintext(lParam) s2
,if(s1.len) m.Get2(s1 s2)
,s2.setwintext(id(4 hDlg))
,case IDOK
,case IDCANCEL
ret 1
You need QM 2.2.0.
Posts: 331
Threads: 60
Joined: May 2006
I want to limit the number of characters that can be typed by the user into an edit box.
This is what I have.
sel wParam
,case EN_CHANGE<<16|4
,pw.getwintext(id(4 hDlg))
,if len(pw)>16
I can tell if there are more than 16 characters but not sure how to stop the input at 16.
Posts: 12,041
Threads: 140
Joined: Dec 2002
Either pw.fix(16); pw.setwintext(...), or under WM_INITDIALOG set max edit control text length with SendMessage(editcontrolhandle EM_LIMITTEXT 16 0).
Posts: 331
Threads: 60
Joined: May 2006
Thanks, SendMessage((id(4 hDlg)) EM_LIMITTEXT 16 0) worked great.