- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my QuickWin-Application, I wanted to limit the possible Input-character-number of an Edit-Box. Therefore I used:
iret= DlgSendCtrlMessage(Dlg,IDC_EDIT,EM_LIMITTEXT,16,0)
But it didn't work, I could input many more characters than 16.
I also tried the Original API-calls
iret= SendDlgItemMessage(Dlg&hwnd,IDC_EDIT,EM_LIMITTEXT,16,0)
and
iret= SendMessage(hwndEditbox,EM_LIMITTEXT,16,0)
but they didn't work either.
Where is the mistake?
Thank you for your help.
Burkhard
iret= DlgSendCtrlMessage(Dlg,IDC_EDIT,EM_LIMITTEXT,16,0)
But it didn't work, I could input many more characters than 16.
I also tried the Original API-calls
iret= SendDlgItemMessage(Dlg&hwnd,IDC_EDIT,EM_LIMITTEXT,16,0)
and
iret= SendMessage(hwndEditbox,EM_LIMITTEXT,16,0)
but they didn't work either.
Where is the mistake?
Thank you for your help.
Burkhard
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IIRC in CVF 6.1 and later there's flag DLG_LIMITTEXT for DlgSet (not sure about exact name -- see docs).
In any version, though, SendMessage or its variations will not work from the same routine from which you call DlgInit; dialog is actually created on DlgModal and Dlg%hWnd is invalid before that. To overcome this, you have to use callback for dialog init:
Jugoslav
In any version, though, SendMessage or its variations will not work from the same routine from which you call DlgInit; dialog is actually created on DlgModal and Dlg%hWnd is invalid before that. To overcome this, you have to use callback for dialog init:
iSt = DlgSetSub(Dlg, IDD_MYDIALOG, OnDialogInit)which is called immediately before dialog is displayed (i.e. on DlgModal) and do any initial SendMessages from OnDialogInit.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many Thanks to you Yugoslav!
Your solution with "iSt = DlgSetSub(Dlg, IDD_MYDIALOG, OnDialogInit)" works.
The other type of solution with correct spelling
"DlgSet(Dlg,IDC_EDIT,16,DLG_TEXTLENGTH)"
does something else: The edit Box is filled with 16 Blanks, but the user is not limited to maximum input of 16 Characters.
Thanks again!! Burkhard
Your solution with "iSt = DlgSetSub(Dlg, IDD_MYDIALOG, OnDialogInit)" works.
The other type of solution with correct spelling
"DlgSet(Dlg,IDC_EDIT,16,DLG_TEXTLENGTH)"
does something else: The edit Box is filled with 16 Blanks, but the user is not limited to maximum input of 16 Characters.
Thanks again!! Burkhard

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page