Posts: 576
Threads: 97
Joined: Aug 2007
is it possible to change the amount of characters allowed in an edit box?
for example i have a box that will only accept 4 charachters such as "4000"
i want it to except more like "400000"
thanks
Posts: 153
Threads: 33
Joined: Aug 2009
Function Dialog2
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str e3
if(!ShowDialog("Dialog2" &Dialog2 &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 134 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x200 8 18 96 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x203000D "*" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case EN_CHANGE<<16|3
,_s.getwintext(lParam)
,if(_s.len>=4)
,,_s.fix(4)
,,_s.setwintext(lParam)
,case IDOK
,case IDCANCEL
ret 1
Posts: 576
Threads: 97
Joined: Aug 2007
not quite what im looking for
edit box is already existing
Posts: 153
Threads: 33
Joined: Aug 2009
Posts: 12,140
Threads: 142
Joined: Dec 2002
Try to send EM_LIMITTEXT message. But in most cases it will not succeed, because normally the app does not rely on it.
Macro Macro1467
SendMessage id(15 "Notepad") EM_LIMITTEXT 4 0
Posts: 576
Threads: 97
Joined: Aug 2007
Gint,
That works but once it gets to a certain amount it seems to not work anymore?
For example, it allows 7 characters to be entered...i can change it to allow only 6 or 5 or 4 or any less.
But as soon as I try to allow it more it doesnt let me.
Any other ideas?
Thank you
Edit:
I found this def function
Macro Macro2
SendMessage id(22 "Secure Client DB") WM_SETTEXT "7,231,154" 1
With that above I can enter the correct amount which is 7 digits....but when i change it to this...
Macro Macro2
SendMessage id(22 "Secure Client DB") WM_SETTEXT "16,231,154" 1
It will not work and just throws a window error back at me.
Posts: 576
Threads: 97
Joined: Aug 2007
Gintaras,
Any idea on this sir?
Thank you
Posts: 12,140
Threads: 142
Joined: Dec 2002
No ideas. It is how the program works.
Posts: 576
Threads: 97
Joined: Aug 2007
Hmm...
Possible to block the controls of the program to stop it from limiting characters?
Just trying to throw some ideas out there and see if anyone comes up with anything!
Thank you!
Posts: 576
Threads: 97
Joined: Aug 2007
Posts: 12,140
Threads: 142
Joined: Dec 2002
Quote:Possible to block the controls of the program to stop it from limiting characters?
I think, impossible.
Posts: 576
Threads: 97
Joined: Aug 2007
I'm lost on this one. This is a must have for the project i'm developing!
I will continue to thrash at it, if you come up with anything please share!
Thanks
Edit:
Can GetWindowLong and SetWindowLong be used to change the current style of a given child window? If so please give example.
Posts: 12,140
Threads: 142
Joined: Dec 2002
Posts: 576
Threads: 97
Joined: Aug 2007
I have tried using SetWinStyle but can not figure out exactly what style I need to use?
Posts: 12,140
Threads: 142
Joined: Dec 2002
Posts: 576
Threads: 97
Joined: Aug 2007
To set the style of the window to a normal edit box without limitations.
Also,
found this code on the forum and is it possible this is what may be being used to limit the characters?
Macro Macro
,case EN_CHANGE<<16|4
,,_s.getwintext(id(4 hDlg))
,,if(_s.len>3)
,,,key B
That is used in a dialog on here to only allow said number of characters into an edit box in a dialog
If so...anyway around it?
Thanks
Posts: 12,140
Threads: 142
Joined: Dec 2002
Quote:To set the style of the window to a normal edit box without limitations.
Such style does not exist. Only message EM_LIMITTEXT can set Edit control max text length, but if it does not work, the program maybe use something like the code you posted, and you cannot change it if you don't have source code of the program.
Posts: 576
Threads: 97
Joined: Aug 2007
I have tried everything I know, completely stumped!
Thank you
|