- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I want to use dialogs in my program. A EDIT box is used as
output box. However, I will not write out results at once;
but at different time. If I use DLGSET to update the text in the EDIT box, I must store all
the texts in a long string "text", then DLGSET(dlg,DC_EDIT,text).
This is not a good way. If it is possible to just append text
to the edit box without update whole texts?
BTW, the reason why I use EDIT box is that I can copy out
whole (or part of) texts using CTRL+C.
Many thanks
Min
I want to use dialogs in my program. A EDIT box is used as
output box. However, I will not write out results at once;
but at different time. If I use DLGSET to update the text in the EDIT box, I must store all
the texts in a long string "text", then DLGSET(dlg,DC_EDIT,text).
This is not a good way. If it is possible to just append text
to the edit box without update whole texts?
BTW, the reason why I use EDIT box is that I can copy out
whole (or part of) texts using CTRL+C.
Many thanks
Min
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's a subroutine that should do the trick:
Few notes:
- This will work only from a callback function or if the dialog is modeless. Before DlgModal, you have to use DlgSet.
- This workarounds DFLOGM processing, so I think you won't be able to retrieve the text using DlgGet. If it's used for output only, that probably doesn't matter.
- It's recommended to check "Multi-line" style on control's property sheet. Note that you can send a newline as CHAR(13)//CHAR(10).
HTH
Jugoslav
SUBROUTINE AppendEditText(Dlg, ID, sText) USE DFWIN USE DFLOGM TYPE(Dialog):: Dlg INTEGER:: ID CHARACTER(*):: sText CHARACTER(LEN=LEN(sText)+1):: szText INTEGER:: nLength, hwndEdit, i hwndEdit = GetDlgItem(Dlg%hWnd, ID) szText=TRIM(sText)//CHAR(0) nLength = SendMessage ( hwndEdit, WM_GETTEXTLENGTH, 0, 0 ) i = SendMessage ( hwndEdit, EM_SETSEL, nLength, nLength ) i = SendMessage ( hwndEdit, EM_REPLACESEL, .FALSE., LOC(szText)) END SUBROUTINE AppendEditText
Few notes:
- This will work only from a callback function or if the dialog is modeless. Before DlgModal, you have to use DlgSet.
- This workarounds DFLOGM processing, so I think you won't be able to retrieve the text using DlgGet. If it's used for output only, that probably doesn't matter.
- It's recommended to check "Multi-line" style on control's property sheet. Note that you can send a newline as CHAR(13)//CHAR(10).
HTH
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[sigh] Forum software... last two lines of code should be:
i = SendMessage ( hwndEdit, EM_SETSEL, nLength, nLength) i = SendMessage ( hwndEdit, EM_REPLACESEL, 0, LOC(szText))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Jugoslav
Many thanks for your help.
Actually, I will use the EDIT box only for output. It doesn't matter
that I can not use dlgget to obtain the texts.
Min
Many thanks for your help.
Actually, I will use the EDIT box only for output. It doesn't matter
that I can not use dlgget to obtain the texts.
Min
![](/skins/images/B7BA37F9CE4B52FF7CAE1FB0388839C8/responsive_peak/images/icon_anonymous_message.png)
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